예제 #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Table_2 rieltorsSet = new Table_2();

            rieltorsSet.FirstName  = textBoxFirstName.Text;
            rieltorsSet.MiddleName = textBoxMiddleName.Text;
            rieltorsSet.LastName   = textBoxLastName.Text;
            rieltorsSet.Percentage = textBoxPercentage.Text;
            Program.fir.Table_2.Add(rieltorsSet);
            Program.fir.SaveChanges();
            ShowRieltors();
        }
예제 #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewRieltors.SelectedItems.Count == 1)
     {
         Table_2 rieltorsSet = listViewRieltors.SelectedItems[0].Tag as Table_2;
         rieltorsSet.FirstName  = textBoxFirstName.Text;
         rieltorsSet.MiddleName = textBoxMiddleName.Text;
         rieltorsSet.LastName   = textBoxLastName.Text;
         rieltorsSet.Percentage = textBoxPercentage.Text;
         Program.fir.SaveChanges();
         ShowRieltors();
     }
 }
예제 #3
0
 private void listViewRieltors_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewRieltors.SelectedItems.Count == 1)
     {
         Table_2 rieltorsSet = listViewRieltors.SelectedItems[0].Tag as Table_2;
         textBoxFirstName.Text  = rieltorsSet.FirstName;
         textBoxMiddleName.Text = rieltorsSet.MiddleName;
         textBoxLastName.Text   = rieltorsSet.LastName;
         textBoxPercentage.Text = rieltorsSet.Percentage;
     }
     else
     {
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPercentage.Text = "";
     }
 }
예제 #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewRieltors.SelectedItems.Count == 1)
         {
             Table_2 rieltorsSet = listViewRieltors.SelectedItems[0].Tag as Table_2;
             Program.fir.Table_2.Remove(rieltorsSet);
             Program.fir.SaveChanges();
             ShowRieltors();
         }
         textBoxFirstName.Text  = "";
         textBoxMiddleName.Text = "";
         textBoxLastName.Text   = "";
         textBoxPercentage.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }