Exemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            OrderSet orderSet = new OrderSet();

            orderSet.IdProduct  = Convert.ToInt32(comboBoxNameProduct.SelectedItem.ToString().Split('.')[0]);
            orderSet.IdEmployee = Convert.ToInt32(comboBoxNameEmployee.SelectedItem.ToString().Split('.')[0]);
            orderSet.IdClient   = Convert.ToInt32(comboBoxNameClient.SelectedItem.ToString().Split('.')[0]);
            orderSet.Date       = textBoxDate.Text;
            Program.wFShop.OrderSet.Add(orderSet);
            Program.wFShop.SaveChanges();
            ShowOrders();
        }
Exemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewEmployee.SelectedItems.Count == 1)
     {
         OrderSet orderSet = listViewEmployee.SelectedItems[0].Tag as OrderSet;
         orderSet.IdProduct  = Convert.ToInt32(comboBoxNameProduct.SelectedItem.ToString().Split('.')[0]);
         orderSet.IdEmployee = Convert.ToInt32(comboBoxNameEmployee.SelectedItem.ToString().Split('.')[0]);
         orderSet.IdClient   = Convert.ToInt32(comboBoxNameClient.SelectedItem.ToString().Split('.')[0]);
         orderSet.Date       = textBoxDate.Text;
         Program.wFShop.SaveChanges();
         ShowOrders();
     }
 }
Exemplo n.º 3
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewEmployee.SelectedItems.Count == 1)
         {
             OrderSet orderSet = listViewEmployee.SelectedItems[0].Tag as OrderSet;
             Program.wFShop.OrderSet.Remove(orderSet);
             Program.wFShop.SaveChanges();
             ShowOrders();
         }
         comboBoxNameProduct.SelectedItem = null;
         comboBoxNameClient.SelectedItem  = null;
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 4
0
        private void listViewEmployee_SelectedIndexChanged(object sender, EventArgs e)
        {
            {
                if (listViewEmployee.SelectedItems.Count == 1)
                {
                    OrderSet orderSet = listViewEmployee.SelectedItems[0].Tag as OrderSet;

                    comboBoxNameClient.SelectedIndex   = comboBoxNameClient.FindString(orderSet.IdClient.ToString());
                    comboBoxNameEmployee.SelectedIndex = comboBoxNameEmployee.FindString(orderSet.IdEmployee.ToString());
                    comboBoxNameProduct.SelectedIndex  = comboBoxNameProduct.FindString(orderSet.IdProduct.ToString());
                    textBoxDate.Text = orderSet.Date;
                }
                else
                {
                    comboBoxNameClient.SelectedItem   = null;
                    comboBoxNameEmployee.SelectedItem = null;
                    comboBoxNameProduct.SelectedItem  = null;
                    textBoxDate.Text = "";
                }
            }
        }