2024-05-05 22:00:25 +04:00
|
|
|
|
using Database;
|
|
|
|
|
using System;
|
2024-04-16 22:38:56 +04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace View
|
|
|
|
|
{
|
|
|
|
|
public partial class InviteForm : Form
|
|
|
|
|
{
|
2024-05-05 22:00:25 +04:00
|
|
|
|
public int DateId;
|
|
|
|
|
private Abstracts db;
|
|
|
|
|
public InviteForm(Abstracts abstracts)
|
2024-04-16 22:38:56 +04:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-05-05 22:00:25 +04:00
|
|
|
|
db = abstracts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
var item = comboBox1.SelectedItem as User;
|
|
|
|
|
if (item != null)
|
|
|
|
|
{
|
|
|
|
|
db.CreateInvite(new()
|
|
|
|
|
{
|
|
|
|
|
userId = item.Id,
|
|
|
|
|
typeId = DateId
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.Cancel; Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InviteForm_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var list = db.GetUsers();
|
|
|
|
|
comboBox1.DataSource = list;
|
|
|
|
|
comboBox1.DisplayMember = "name";
|
|
|
|
|
comboBox1.ValueMember = "Id";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
}
|
2024-04-16 22:38:56 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|