public MenuCheckedOrder_R GetMenuCheckedOrder_RByID(string ID) { MenuCheckedOrder_R mor = new MenuCheckedOrder_R(); mor = this.MenuCheckedOrder_RDataContext.MenuCheckedOrder_R.SingleOrDefault(o => o.MenuCheckedOrderID == ID); return(mor); }
public bool UpdataMOR(MenuCheckedOrder_R MOR) { try { MenuCheckedOrder_RDataContext.SubmitChanges(); return(true); } catch (Exception) { return(false); } }
//添加用户 public bool AddMCOR(MenuCheckedOrder_R MCOR) { try { this.MenuCheckedOrder_RDataContext.MenuCheckedOrder_R.InsertOnSubmit(MCOR); this.MenuCheckedOrder_RDataContext.SubmitChanges(); return(true); } catch { return(false); } }
//通过主键 public bool DeleteMCORById(string checkedOrderID) { try { MenuCheckedOrder_R MOR = this.MenuCheckedOrder_RDataContext.MenuCheckedOrder_R.SingleOrDefault(o => o.CheckedOrderID == checkedOrderID); this.MenuCheckedOrder_RDataContext.MenuCheckedOrder_R.DeleteOnSubmit(MOR); this.MenuCheckedOrder_RDataContext.SubmitChanges(); return(true); } catch { return(false); } }
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("保存失败!"); } } }
public bool UpdataMOR(MenuCheckedOrder_R MOR) { return(mCORDataAccess.UpdataMOR(MOR)); }
public bool AddMCOR(MenuCheckedOrder_R MCOR) { return(mCORDataAccess.AddMCOR(MCOR)); }