コード例 #1
0
 private void Change_B_Click(object sender, EventArgs e)
 {
     try
     {
         if (Products_LB.SelectedItems.Count == 1)
         {
             PositionListBox dialog = new PositionListBox(Products_LB.Items.Cast <String>().ToList());
             dialog.Text         = "Изменение информации";
             dialog.Title_L.Text = "Изменение информации";
             dialog.Info_TB.Text = Products_LB.SelectedItem.ToString();
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 OperationsProducts product = new OperationsProducts();
                 product.Change(Products_LB.SelectedItem.ToString(), dialog.Info_TB.Text);
                 Products[Products_LB.SelectedIndex] = dialog.Info_TB.Text;
             }
         }
         else
         {
             throw new Exception("Необходимо выбрать одну позицию для изменения");
         }
     }
     catch (Exception Ex)
     {
         Error(Ex);
     }
 }
コード例 #2
0
 private void Added_Add_B_Click(object sender, EventArgs e)
 {
     try
     {
         PositionListBox Dialog = new PositionListBox(Added_LB.Items.Cast <String>().ToList());
         if (Dialog.ShowDialog() == DialogResult.OK)
         {
             Added_LB.Items.Add(Dialog.Info_TB.Text);
         }
     }
     catch (Exception Ex)
     {
         Error(Ex);
     }
 }
コード例 #3
0
 private void Add_B_Click(object sender, EventArgs e)
 {
     try
     {
         PositionListBox dialog = new PositionListBox(Products_LB.Items.Cast <String>().ToList());
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             OperationsProducts product = new OperationsProducts();
             product.Add(dialog.Info_TB.Text);
             Products.Add(dialog.Info_TB.Text);
         }
     }
     catch (Exception Ex)
     {
         Error(Ex);
     }
 }
コード例 #4
0
 private void Deleted_Change_B_Click(object sender, EventArgs e)
 {
     try
     {
         if (Deleted_LB.SelectedItem != null)
         {
             PositionListBox Dialog = new PositionListBox(Deleted_LB.Items.Cast <String>().ToList());
             Dialog.Info_TB.Text = Deleted_LB.SelectedItem.ToString();
             if (Dialog.ShowDialog() == DialogResult.OK)
             {
                 Deleted_LB.Items[Deleted_LB.SelectedIndex] = Dialog.Info_TB.Text;
             }
         }
         else
         {
             throw new Exception("Необходимо выбрать позицию для изменения");
         }
     }
     catch (Exception Ex)
     {
         Error(Ex);
     }
 }