public override object GetNewBill(UserInfo currentUser) { bill = new Sale_eb_bill(); bill.applier_name = currentUser.realName; bill.sys_no = GetNextSysNo(BillType); bill.bl_date = DateTime.Now; return(bill); }
public override string SaveBill(System.Web.Mvc.FormCollection fc, UserInfo user) { bill = new Sale_eb_bill(); SomeUtils.SetFieldValueToModel(fc, bill); if (string.IsNullOrWhiteSpace(bill.customer_name)) { return("客户名称必须填写,请在代码处输入后按回车搜索"); } if (string.IsNullOrWhiteSpace(bill.product_model)) { return("产品必须填写,请在代码处输入后按回车搜索"); } if (string.IsNullOrEmpty(bill.bl_project)) { return("备料明细必须至少勾选一个"); } bill.applier_id = user.userId; bill.apply_time = DateTime.Now; var existedBill = db.Sale_eb_bill.Where(e => e.sys_no == bill.sys_no).FirstOrDefault(); if (existedBill == null) { db.Sale_eb_bill.InsertOnSubmit(bill); } else { SomeUtils.CopyPropertyValue(bill, existedBill); } try { db.SubmitChanges(); } catch (Exception ex) { return(ex.Message); } return(""); }
public EBSv(string sysNo) { bill = db.Sale_eb_bill.Single(e => e.sys_no == sysNo); }