示例#1
0
        private void btnPackageOrder_Click(object sender, EventArgs e)
        {
            frmPackage frm = new frmPackage();

            this.Close();
            frm.Show();
        }
        private void btnOrder_Click(object sender, EventArgs e)
        {
            Bill          bill          = new Bill();
            Order         order         = new Order();
            frmPackage    frm           = new frmPackage();
            PackageOrders packageOrders = new PackageOrders();
            int           customerId    = 0;

            customerId = Convert.ToInt32(lvCustomers.SelectedItems[0].SubItems[0].Text);
            bool result = false;

            bill.ServiceTypeId = 5;
            bill.PersonnelId   = General._personnelId;
            bill.Date          = DateTime.Now;
            result             = bill.setByPackId(bill);

            packageOrders.CustomerID = customerId;
            packageOrders.AdditionID = bill.getByPackageBillbyCustomerId(customerId);
            packageOrders.Statement  = "Paket";
            packageOrders.PackageOrderAdd(packageOrders);

            if (lvOrders.Items.Count > 0)
            {
                for (int i = 0; i < lvOrders.Items.Count; i++)
                {
                    order.ProductId = Convert.ToInt32(lvOrders.Items[i].SubItems[2].Text);
                    order.BillID    = bill.getByAdditionPack(5);
                    order.Quantity  = Convert.ToInt32(lvOrders.Items[i].SubItems[1].Text);
                    order.setSaveOrderPack(order);
                }

                this.Close();
                frm.Show();
            }
            else
            {
                if (lvNewAdded.Items.Count > 0)
                {
                    for (int i = 0; i < lvNewAdded.Items.Count; i++)
                    {
                        order.ProductId = Convert.ToInt32(lvNewAdded.Items[i].SubItems[1].Text);
                        order.BillID    = bill.getByAdditionPack(5);
                        order.Quantity  = Convert.ToInt32(lvNewAdded.Items[i].SubItems[2].Text);
                        order.setSaveOrderPack(order);
                    }
                }

                if (removed.Count > 0)
                {
                    foreach (string item in removed)
                    {
                        order.setDeleteOrder(Convert.ToInt32(item));
                    }
                }

                this.Close();
                frm.Show();
            }
        }