예제 #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);
     }
 }