Ejemplo n.º 1
0
 public ShowOrderForm(string orderID, Users user)
 {
     this.checkedOrderBusinessLogic = new CheckedOrderBusinessLogic();
     this.mCORBusinessLogic         = new MCORBusinessLogic();
     InitializeComponent();
     this.user               = user;
     checkedOrder            = this.checkedOrderBusinessLogic.GetOrderByID(orderID);
     txbDepartment.Text      = checkedOrder.Department;
     txbCreator.Text         = checkedOrder.Creator;
     label10.Text            = checkedOrder.Status;
     txbProvider.Text        = checkedOrder.Provider;
     dtpInputDate.Text       = checkedOrder.InputDate.ToString();
     txbTotalMoney.Text      = checkedOrder.TotalMoney.ToString();
     textBox1.Text           = checkedOrder.Remark;
     menuCheckedOrder_R      = this.mCORBusinessLogic.GetMCORByCheckedOrderID(orderID);
     dgvOrderShow.DataSource = menuCheckedOrder_R;
     setColumn();
 }
Ejemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定验收后此订单不可更改!\n是否确定?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                OrderBusinessLogic        orderBusinessLogic        = new OrderBusinessLogic();
                CheckedOrderBusinessLogic checkedOrderBusinessLogic = new CheckedOrderBusinessLogic();
                MCORBusinessLogic         mCORBusinessLogic         = new MCORBusinessLogic();
                CheckedOrder checkedOrder = new CheckedOrder();//验收单
                Order        order        = orderBusinessLogic.GetOrderByID(orderID);
                checkedOrder.CheckedOrderID = order.OrderID;
                checkedOrder.OrderNumber    = order.OrderNumber;
                checkedOrder.Provider       = order.Provider;
                checkedOrder.Status         = "已验收";
                checkedOrder.VeriDate       = order.VeriDate;
                checkedOrder.Verifier       = order.Verifier;
                checkedOrder.Remark         = textBox1.Text.Trim();
                checkedOrder.Department     = order.Department;
                checkedOrder.Creator        = order.Creator;
                checkedOrder.TotalMoney     = Convert.ToDouble(label7.Text);
                checkedOrder.InputDate      = order.InputDate;
                order.Status = "已验收";
                bool flag1, flag2;
                try
                {
                    flag1 = checkedOrderBusinessLogic.AddOrder(checkedOrder);
                    flag2 = orderBusinessLogic.UpdataOrder(order);
                }
                catch (Exception)
                {
                    throw;
                }
                if (flag1 && flag2)
                {
                    int count = dgvOrderCheck.Rows.Count;
                    for (int i = 0; i < count; i++)
                    {
                        if (dgvOrderCheck.Rows[i].Cells[3].Value != null && dgvOrderCheck.Rows[i].Cells[8].Value != null)
                        {
                            MenuCheckedOrder_R MCOR = new MenuCheckedOrder_R();
                            MCOR.MenuCheckedOrderID = Guid.NewGuid().ToString();
                            MCOR.CheckedOrderID     = order.OrderID;
                            MCOR.MenuName           = dgvOrderCheck.Rows[i].Cells[3].Value.ToString();
                            MCOR.Unit      = dgvOrderCheck.Rows[i].Cells[4].Value.ToString();
                            MCOR.Quote     = Convert.ToDouble(dgvOrderCheck.Rows[i].Cells[5].Value);
                            MCOR.Rate      = Convert.ToDouble(dgvOrderCheck.Rows[i].Cells[6].Value);
                            MCOR.Price     = Convert.ToDouble(dgvOrderCheck.Rows[i].Cells[7].Value);
                            MCOR.Count     = Convert.ToDouble(dgvOrderCheck.Rows[i].Cells[8].Value);
                            MCOR.Money     = Convert.ToDouble(dgvOrderCheck.Rows[i].Cells[9].Value);
                            MCOR.InputDate = order.InputDate;
                            //MOR.Remark = null;
                            mCORBusinessLogic.AddMCOR(MCOR);
                        }
                    }
                    MessageBox.Show("您已成功保存验收单!", "提示");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("保存失败!");
                }
            }
        }