コード例 #1
0
ファイル: FormClient.cs プロジェクト: St0rmrag3/BS
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ClientsSet clientSet = new ClientsSet();

            clientSet.FirstName  = textBoxFirstName.Text;
            clientSet.MiddleName = textBoxMiddleName.Text;
            clientSet.LastName   = textBoxLastName.Text;
            clientSet.Phone      = textBoxPhone.Text;
            clientSet.Email      = textBoxEmail.Text;
            Program.BSTDB.ClientsSet.Add(clientSet);
            Program.BSTDB.SaveChanges();
            ShowClient();
        }
コード例 #2
0
ファイル: FormClient.cs プロジェクト: St0rmrag3/BS
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientsSet clientSet = listViewClient.SelectedItems[0].Tag as ClientsSet;
         clientSet.FirstName  = textBoxFirstName.Text;
         clientSet.MiddleName = textBoxMiddleName.Text;
         clientSet.LastName   = textBoxLastName.Text;
         clientSet.Phone      = textBoxPhone.Text;
         clientSet.Email      = textBoxEmail.Text;
         Program.BSTDB.SaveChanges();
         ShowClient();
     }
 }
コード例 #3
0
ファイル: FormClient.cs プロジェクト: St0rmrag3/BS
 private void listViewClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewClient.SelectedItems.Count == 1)
     {
         ClientsSet clientSet = listViewClient.SelectedItems[0].Tag as ClientsSet;
         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 プロジェクト: St0rmrag3/BS
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewClient.SelectedItems.Count == 1)
         {
             ClientsSet clientSet = listViewClient.SelectedItems[0].Tag as ClientsSet;
             Program.BSTDB.ClientsSet.Remove(clientSet);
             Program.BSTDB.SaveChanges();
             ShowClient();
         }
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPhone.Text      = "";
         textBoxEmail.Text      = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }