private void buttonEnter_Click(object sender, EventArgs e) { var this_topic = topiclogic.Read(new TopicBindingModel { Name = Convert.ToString(dataGridView.SelectedRows[0].Cells[0].Value) })[0]; topiclogic.CreateOrUpdate(new TopicBindingModel { Name = Convert.ToString(dataGridView.SelectedRows[0].Cells[0].Value), NumberOfMessages = this_topic.NumberOfMessages, NumberOfVisitors = this_topic.NumberOfVisitors + 1 }); var form = Container.Resolve <FormMessages>(); form.nameTopic = Convert.ToString(dataGridView.SelectedRows[0].Cells[0].Value); if (form.ShowDialog() == DialogResult.OK) { LoadData(); } }
private void buttonSend_Click(object sender, EventArgs e) { var this_topic = topiclogic.Read(new TopicBindingModel { Name = nameTopic })[0]; Console.WriteLine(nameTopic); topiclogic.CreateOrUpdate(new TopicBindingModel { Name = nameTopic, NumberOfMessages = this_topic.NumberOfMessages + 1, NumberOfVisitors = this_topic.NumberOfVisitors }); if (string.IsNullOrEmpty(TextBox1.Text)) { MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } logic.CreateOrUpdate(new MessageBindingModel { Text = TextBox1.Text, Time = DateTime.Now, LoginUser = Program.Visitor.LoginUser, NameTopic = nameTopic }); if (Program.Visitor.Status != null) { vlogic.CreateOrUpdate(new VisitorBindingModel { LoginUser = Program.Visitor.LoginUser, Password = Program.Visitor.Password, Decency = Program.Visitor.Decency, Email = Program.Visitor.Email, Status = Program.Visitor.Status, TotalTime = Program.Visitor.TotalTime, CountOfMessages = Program.Visitor.CountOfMessages + 1 }); Program.Visitor.CountOfMessages += 1; MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; Close(); } }
private void ButtonSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { logic.CreateOrUpdate(new TopicBindingModel { Name = textBox1.Text }); MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }