Пример #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ItsSet its = new ItsSet();

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