Ejemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ClientsFizSet clientsFizSet = new ClientsFizSet();

            clientsFizSet.FirstName  = textBoxFirstName.Text;
            clientsFizSet.LastName   = textBoxLastName.Text;
            clientsFizSet.MiddleName = textBoxMiddleName.Text;
            clientsFizSet.Phone      = textBoxPhone.Text;
            Program.asdf.ClientsFizSet.Add(clientsFizSet);
            Program.asdf.SaveChanges();
            ShowClientsFiz();
        }
Ejemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClientsFiz.SelectedItems.Count == 1)
     {
         ClientsFizSet clientsFizSet = listViewClientsFiz.SelectedItems[0].Tag as ClientsFizSet;
         clientsFizSet.FirstName  = textBoxFirstName.Text;
         clientsFizSet.LastName   = textBoxLastName.Text;
         clientsFizSet.MiddleName = textBoxMiddleName.Text;
         clientsFizSet.Phone      = textBoxPhone.Text;
         Program.asdf.SaveChanges();
         ShowClientsFiz();
     }
 }
Ejemplo n.º 3
0
 private void listViewClientsFiz_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClientsFiz.SelectedItems.Count == 1)
     {
         ClientsFizSet clientsFizSet = listViewClientsFiz.SelectedItems[0].Tag as ClientsFizSet;
         textBoxFirstName.Text  = clientsFizSet.FirstName;
         textBoxLastName.Text   = clientsFizSet.LastName;
         textBoxMiddleName.Text = clientsFizSet.MiddleName;
         textBoxPhone.Text      = clientsFizSet.Phone;
     }
     else
     {
         textBoxFirstName.Text  = "";
         textBoxLastName.Text   = "";
         textBoxMiddleName.Text = "";
         textBoxPhone.Text      = "";
     }
 }
Ejemplo n.º 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClientsFiz.SelectedItems.Count == 1)
         {
             ClientsFizSet clientsFizSet = listViewClientsFiz.SelectedItems[0].Tag as ClientsFizSet;
             Program.asdf.ClientsFizSet.Remove(clientsFizSet);
             Program.asdf.SaveChanges();
             ShowClientsFiz();
         }
         textBoxFirstName.Text  = "";
         textBoxLastName.Text   = "";
         textBoxMiddleName.Text = "";
         textBoxPhone.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, запись используется!", "Ошибка!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }