예제 #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem.Equals("Посетитель"))
            {
                visitorlogic.CreateOrUpdate(new VisitorBindingModel {
                    LoginUser       = textBoxLogin.Text,
                    Password        = textBoxPassword.Text,
                    Email           = textBoxEmail.Text,
                    CountOfMessages = 0,
                    Decency         = 1000,
                    TotalTime       = 0,
                    Status          = "approved"
                });
            }
            if (comboBox1.SelectedItem.Equals("Модератор"))
            {
                moderatorlogic.CreateOrUpdate(new ModeratorBindingModel
                {
                    LoginUser    = textBoxLogin.Text,
                    Password     = textBoxPassword.Text,
                    Email        = textBoxEmail.Text,
                    AmountOfHelp = 0,
                    TotalTime    = 0
                });
            }
            var form = Container.Resolve <FormSignIn>();

            form.ShowDialog();
            DialogResult = DialogResult.OK;
            Close();
        }
예제 #2
0
        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();
            }
        }