Example #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ProgramProductSet programProduct = new ProgramProductSet();

            programProduct.Name        = textBoxName.Text;
            programProduct.Descriptoin = textBoxDescription.Text;
            programProduct.Price       = Convert.ToInt32(textBoxPrice.Text);
            Program.entities1c.ProgramProductSet.Add(programProduct);
            Program.entities1c.SaveChanges();
            ShowProgramProduct();
        }
Example #2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewProgramProduct.SelectedItems.Count == 1)
     {
         ProgramProductSet programProduct = listViewProgramProduct.SelectedItems[0].Tag as ProgramProductSet;
         programProduct.Name        = textBoxName.Text;
         programProduct.Descriptoin = textBoxDescription.Text;
         programProduct.Price       = Convert.ToInt32(textBoxPrice.Text);
         Program.entities1c.SaveChanges();
         ShowProgramProduct();
     }
 }
Example #3
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (comboBoxAgent.SelectedItem != null && comboBoxClient.SelectedItem != null && comboBoxPP.SelectedItem != null && textBoxAmount.Text.Length > 0)
     {
         ProgramProductSet programProduct
             = Program.entities1c.ProgramProductSet.Find(Convert.ToInt32(comboBoxPP.SelectedItem.ToString().Split('.')[0]));
         int a          = Convert.ToInt32(textBoxAmount.Text);
         int totalprice = programProduct.Price * a;
         textBoxTotalPrice.Text = totalprice.ToString();
     }
     else
     {
         textBoxTotalPrice.Text = "";
     }
 }
Example #4
0
 private void listViewProgramProduct_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewProgramProduct.SelectedItems.Count == 1)
     {
         ProgramProductSet programProduct = listViewProgramProduct.SelectedItems[0].Tag as ProgramProductSet;
         textBoxName.Text        = programProduct.Name;
         textBoxDescription.Text = programProduct.Descriptoin;
         textBoxPrice.Text       = programProduct.Price.ToString();
     }
     else
     {
         textBoxName.Text        = "";
         textBoxDescription.Text = "";
         textBoxPrice.Text       = "";
     }
 }
Example #5
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewProgramProduct.SelectedItems.Count == 1)
         {
             ProgramProductSet programProduct = listViewProgramProduct.SelectedItems[0].Tag as ProgramProductSet;
             Program.entities1c.ProgramProductSet.Remove(programProduct);
             Program.entities1c.SaveChanges();
             ShowProgramProduct();
         }
         textBoxName.Text        = "";
         textBoxDescription.Text = "";
         textBoxPrice.Text       = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }