コード例 #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Ceh cehSet = new Ceh();

            cehSet.Name_ceha   = textBoxNameCeha.Text;
            cehSet.Number_ceha = Convert.ToInt32(textBoxNumberCeha.Text);
            Program.HaloPolymer.Ceh.Add(cehSet);
            Program.HaloPolymer.SaveChanges();
            ShowCeh();
        }
コード例 #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewCeh.SelectedItems.Count == 1)
     {
         Ceh cehSet = listViewCeh.SelectedItems[0].Tag as Ceh;
         cehSet.Name_ceha   = textBoxNameCeha.Text;
         cehSet.Number_ceha = Convert.ToInt32(textBoxNumberCeha.Text);
         Program.HaloPolymer.SaveChanges();
         ShowCeh();
     }
 }
コード例 #3
0
 private void listViewCeh_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewCeh.SelectedItems.Count == 1)
     {
         Ceh cehSet = listViewCeh.SelectedItems[0].Tag as Ceh;
         textBoxNameCeha.Text   = cehSet.Name_ceha;
         textBoxNumberCeha.Text = cehSet.Number_ceha.ToString();
     }
     else
     {
         textBoxNameCeha.Text   = "";
         textBoxNumberCeha.Text = "";
     }
 }
コード例 #4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewCeh.SelectedItems.Count == 1)
         {
             Ceh cehSet = listViewCeh.SelectedItems[0].Tag as Ceh;
             Program.HaloPolymer.Ceh.Remove(cehSet);
             Program.HaloPolymer.SaveChanges();
             ShowCeh();
         }
         textBoxNameCeha.Text   = "";
         textBoxNumberCeha.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }