示例#1
0
文件: ITS.cs 项目: babikov02/1---
        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
文件: ITS.cs 项目: babikov02/1---
 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
文件: DealITS.cs 项目: babikov02/1---
 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
文件: ITS.cs 项目: babikov02/1---
 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
文件: ITS.cs 项目: babikov02/1---
 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);
     }
 }