예제 #1
0
파일: FormClient.cs 프로젝트: Kari937/start
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Table_1 clientSet = new Table_1();

            clientSet.FirstName  = textBoxFirstName.Text;
            clientSet.MiddleName = textBoxMiddleName.Text;
            clientSet.LastName   = textBoxLastName.Text;
            clientSet.Phone      = textBoxPhone.Text;
            clientSet.Email      = textBoxEmail.Text;
            Program.fir.Table_1.Add(clientSet);
            Program.fir.SaveChanges();
            ShowClient();
        }
예제 #2
0
파일: FormClient.cs 프로젝트: Kari937/start
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         Table_1 clientSet = listViewClient.SelectedItems[0].Tag as Table_1;
         clientSet.FirstName  = textBoxFirstName.Text;
         clientSet.MiddleName = textBoxMiddleName.Text;
         clientSet.LastName   = textBoxLastName.Text;
         clientSet.Phone      = textBoxPhone.Text;
         clientSet.Email      = textBoxEmail.Text;
         Program.fir.SaveChanges();
         ShowClient();
     }
 }
예제 #3
0
파일: FormClient.cs 프로젝트: Kari937/start
 private void listViewClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         Table_1 clientSet = listViewClient.SelectedItems[0].Tag as Table_1;
         textBoxFirstName.Text  = clientSet.FirstName;
         textBoxMiddleName.Text = clientSet.MiddleName;
         textBoxLastName.Text   = clientSet.LastName;
         textBoxPhone.Text      = clientSet.Phone;
         textBoxEmail.Text      = clientSet.Email;
     }
     else
     {
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
 }
예제 #4
0
파일: FormClient.cs 프로젝트: Kari937/start
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClient.SelectedItems.Count == 1)
         {
             Table_1 clientSet = listViewClient.SelectedItems[0].Tag as Table_1;
             Program.fir.Table_1.Remove(clientSet);
             Program.fir.SaveChanges();
             ShowClient();
         }
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }