Beispiel #1
0
        private void btnNewOrder_Click(object sender, EventArgs e)
        {
            try
            {
                string   customerName = cbCustomers.Text;
                DateTime date         = dtpDate.Value;

                if (!string.IsNullOrEmpty(customerName))
                {
                    Payment_Order order      = new Payment_Order();
                    int           customerId = (from c in ent.Customers
                                                where c.name == customerName
                                                select c.id).FirstOrDefault();
                    order.customer_id = customerId;
                    order.Date        = date;
                    ent.Payment_Order.Add(order);
                    ent.SaveChanges();
                    MessageBox.Show("Order Added!", "",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    PaymentOrder_Load(sender, e);
                    obj = new PaymentOrderInfo(order);
                    obj.Show();
                }
                else
                {
                    MessageBox.Show("Enter Order Name!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void btnEditOrder_Click_1(object sender, EventArgs e)
        {
            try
            {
                string   customerName = cbCustomers.Text;
                DateTime date         = dtpDate.Value;

                if (!string.IsNullOrEmpty(txtOrderNumber.Text))
                {
                    int           orderNumber = int.Parse(txtOrderNumber.Text);
                    Payment_Order order       = (from o in ent.Payment_Order
                                                 where o.number == orderNumber
                                                 select o).FirstOrDefault();
                    int customerId = (from c in ent.Customers
                                      where c.name == customerName
                                      select c.id).FirstOrDefault();
                    order.customer_id = customerId;
                    order.Date        = date;
                    ent.SaveChanges();
                    MessageBox.Show("Order Updated!", "",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    PaymentOrder_Load(sender, e);
                }
                else
                {
                    MessageBox.Show("Select order to delete", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
 private void btnEditItems_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtOrderNumber.Text))
         {
             int           orderNumber = int.Parse(txtOrderNumber.Text);
             Payment_Order order       = (from o in ent.Payment_Order
                                          where o.number == orderNumber
                                          select o).FirstOrDefault();
             obj = new PaymentOrderInfo(order);
             obj.Show();
         }
         else
         {
             MessageBox.Show("Select order first!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 public PaymentOrderInfo(Payment_Order payment_Order)
 {
     InitializeComponent();
     ent   = new WarehouseDB();
     order = payment_Order;
 }