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

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