Esempio n. 1
0
        private void save_button_Click(object sender, EventArgs e)
        {
            Pets    pet    = new Pets();
            Clients client = new Clients();

            pet.ID    = Convert.ToInt32(pets_dataGridView.SelectedRows[0].Cells["idDataGridViewTextBoxColumn"].Value);
            client.ID = Convert.ToInt32(pets_dataGridView.SelectedRows[0].Cells["clientidDataGridViewTextBoxColumn"].Value);
            pet.GetInfo();
            client.GetInfo();
            if (newVisit)
            {
                AddVisitForm AVF = this.Owner as AddVisitForm;
                if (AVF != null)
                {
                    AVF.SetPet(pet);
                    AVF.SetClient(client);
                }
            }
            else
            {
                EditVisitForm EVF = this.Owner as EditVisitForm;
                if (EVF != null)
                {
                    EVF.SetPet(pet);
                    EVF.SetClient(client);
                }
            }
            this.Close();
        }
Esempio n. 2
0
 private void save_button_Click(object sender, EventArgs e)
 {
     if (fio_textBox.Text == String.Empty)
     {
         MessageBox.Show("Введите имя клиента");
     }
     else
     {
         Clients oldClient = (Clients)client.Clone();
         client.Fio       = fio_textBox.Text;
         client.Character = Convert.ToInt32(character_numericUpDown.Value);
         client.Phone     = phone_textBox.Text;
         client.Social    = social_textBox.Text;
         client.About     = about_textBox.Text;
         client.Bonus     = Convert.ToInt32(bonus_textBox.Text);
         client.Sms       = sms_checkBox.Checked;
         if (client.UpdateClient() == true)
         {
             user.AddLog(String.Format("Изменил параметры КЛИЕНТА ФИО: <{0}> -> <{1}>, " +
                                       "Характер: <{2}> -> <{3}>, Телефон: <{4}> -> <{5}>, " +
                                       "Соц.сети: <{6}> -> <{7}>, Инфо: <{8}> -> <{9}>," +
                                       "Бонусы: <{10}> -> <{11}>, СМС <{12}> -> <{13}> в справочнике КЛИЕНТОВ", oldClient.Fio, client.Fio,
                                       oldClient.Character, client.Character, oldClient.Phone, client.Phone,
                                       oldClient.Social, client.Social, oldClient.About, client.About,
                                       oldClient.Bonus, client.Bonus, oldClient.Sms, client.Sms));
             if (addVisit)
             {
                 AddVisitForm AVF = this.Owner as AddVisitForm;
                 AVF.SetClient(client);
             }
             if (editVisit)
             {
                 EditVisitForm EVF = this.Owner as EditVisitForm;
                 EVF.SetClient(client);
             }
         }
         else
         {
             MessageBox.Show("Ошибка сохранения");
         }
         this.Close();
     }
 }
Esempio n. 3
0
        private void editVisit_button_Click(object sender, EventArgs e)
        {
            if ((user.GetUserRole() != "Администратор") && ((bool)visitList_dataGridView.SelectedRows[0].Cells["status"].Value == true))
            {
                MessageBox.Show("Запрещено редактировать посещение со статусом ИСПОЛНЕНО");
            }
            else
            {
                if (visitList_dataGridView.SelectedRows.Count > 0)
                {
                    Visit editVisit = new Visit();
                    editVisit.ID = Convert.ToInt32(visitList_dataGridView.SelectedRows[0].Cells["idDataGridViewTextBoxColumn"].Value);

                    editVisit.GetInfo();
                    EditVisitForm EVF       = new EditVisitForm(user, editVisit);
                    Container     container = this.MdiParent as Container;
                    container.MakeFormHooks(EVF);
                    EVF.ShowDialog();
                    GetVisitsByDate(Convert.ToDateTime(visits_dateTimePicker.Value.Date.ToShortDateString() + " 0:00:00"),
                                    Convert.ToDateTime(visits_dateTimePicker.Value.Date.ToShortDateString() + " 23:59:59"));
                    SelectRow(editVisit.ID);
                }
            }
        }
Esempio n. 4
0
        private void save_button_Click(object sender, EventArgs e)
        {
            if (name_textBox.Text == String.Empty)
            {
                MessageBox.Show("У питомца должна быть кличка");
            }
            else if (client_textBox.Text == String.Empty)
            {
                MessageBox.Show("У питомца должен быть хозяин");
            }
            else if (breed_textBox.Text == String.Empty)
            {
                MessageBox.Show("У питомца должна быть порода");
            }
            else
            {
                pet.Name = name_textBox.Text;
                if (bday_radioButton.Checked)
                {
                    pet.Bday = bday_dateTimePicker.Value;
                    //pet.Age = Convert.ToInt32(age_textBox.Text);
                }
                else
                {
                    //pet.Age = Convert.ToInt32(age_textBox.Text);
                    pet.Bday = DateTime.Parse("1900-01-01");
                }
                pet.About = about_textBox.Text;
                if (alive_checkBox.Checked)
                {
                    pet.ALive = true;
                }
                else
                {
                    pet.ALive = false;
                }
                if (pet.UpdatePet() == true)
                {
                    user.AddLog(String.Format("Изменил параметры ПИТОМЦА Кличка: <{0}> -> <{1}>, " +
                                              "Хозяин: <{2}> -> <{3}>, Порода: <{4}> -> <{5}>, " +
                                              "Дата рождения: <{6}> -> <{7}>, Инфо: <{8}> -> <{9}>," +
                                              "Жив: <{10}> -> <{11}> в базе ПИТОМЦЕВ", oldPet.Name, pet.Name,
                                              oldPet.ClientName, pet.ClientName, oldPet.Breed, pet.Breed,
                                              oldPet.Bday, pet.Bday, oldPet.About, pet.About,
                                              oldPet.ALive, pet.ALive));

                    if (addVisit)
                    {
                        AddVisitForm AVF = this.Owner as AddVisitForm;
                        AVF.SetPet(pet);
                        Clients client = new Clients();
                        client.ID = pet.ClientId;
                        client.GetInfo();
                        AVF.SetClient(client);
                    }
                    if (editVisit)
                    {
                        EditVisitForm EVF = this.Owner as EditVisitForm;
                        EVF.SetPet(pet);
                        Clients client = new Clients();
                        client.ID = pet.ClientId;
                        client.GetInfo();
                        EVF.SetClient(client);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Ошибка сохранения");
                }
                this.Close();
            }
        }