Beispiel #1
0
        private void SendAnswerForm_Load(object sender, EventArgs e)
        {
            DaoRecall daoRecall = new DaoRecall();

            recall             = daoRecall.GetRecallOnId(Data.context, Data.intValue);
            recallTextBox.Text = recall.Comment;
        }
Beispiel #2
0
        private void ViewRecallForm_Load(object sender, EventArgs e)
        {
            Recall    recall    = new Recall();
            DaoRecall daoRecall = new DaoRecall();

            recall             = daoRecall.GetRecallOnId(Data.context, Data.intValue);
            topicTextBox.Text  = recall.TopicRecall;
            recallTextBox.Text = recall.Comment;
        }
Beispiel #3
0
        private void recallUser_Click(object sender, EventArgs e)
        {
            string   surname       = surnameTextbox.Text;
            string   name          = nameTextbox.Text;
            string   patronymic    = patronymicTextbox.Text;
            string   topicRecall   = topicTextbox.Text;
            string   commentReccal = commentTextbox.Text;
            string   email         = "";
            string   typeRecall    = "";
            string   subjectRecall = "";
            Room     room          = null;
            Employee employee      = null;

            if (appealRadioButton.Checked == true)
            {
                typeRecall = "жалоба";
            }
            else if (sentenceRadioButton.Checked == true)
            {
                typeRecall = "предложение";
            }
            else if (thanksRadioButton.Checked == true)
            {
                typeRecall = "благодарность";
            }
            if (hostelRadioButton.Checked == true)
            {
                subjectRecall = "гостиница";
            }
            else if (staffRadioButton.Checked == true)
            {
                staffComboBox.Enabled    = true;
                nameStaffTextBox.Visible = true;
                subjectRecall            = "персонал";
                employee = daoEmployee.GetEmployeeOnId(Data.context, (int)staffComboBox.SelectedValue);
            }
            else if (roomRadioButton.Checked == true)
            {
                roomComboBox.Enabled = true;
                subjectRecall        = "комната";
                DaoRoom daoRoom = new DaoRoom();
                room = daoRoom.GetRoomOnId(Data.context, (int)roomComboBox.SelectedValue);
            }
            if (emailRadioYes.Checked == true)
            {
                email = emailTextbox.Text;
            }
            string   s = DateTime.Now.ToString("u");
            DateTime d = Convert.ToDateTime(DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss'.'fff"));

            if (name != "")
            {
                HotelUser hotelUser = Data.context.HotelUsers.Add(new HotelUser {
                    Surname = surname, Name = name, Patronymic = patronymic, Email = email
                });
                Recall recall = Data.context.Recalls.Add(new Recall {
                    Comment = commentReccal, HotelUser = hotelUser, TopicRecall = topicRecall, TypeRecall = typeRecall, SubjectRecall = subjectRecall, Employee = employee, Room = room, DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss'.'fff"))
                });
                Data.context.SaveChanges();
                appealRadioButton.Checked = true;
                hostelRadioButton.Checked = true;
                surnameTextbox.Text       = "";
                nameTextbox.Text          = "";
                patronymicTextbox.Text    = "";
                topicTextbox.Text         = "";
                commentTextbox.Text       = "";
                emailTextbox.Text         = "";
                emailRadioNo.Checked      = true;
                staffComboBox.Enabled     = false;
                emailTextbox.Enabled      = false;
            }
            else
            {
                MessageBox.Show("Заполните обязательное поле Имя");
            }
        }