/// <summary> /// 添加与编辑OUT00记录 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="model">OUT00表实体</param> /// <param name="content">更新说明</param> /// <param name="isCache">是否更新缓存</param> /// <param name="isAddUseLog">是否添加用户操作日志</param> public void Save(Page page, OUT00 model, string content = null, bool isCache = true, bool isAddUseLog = true) { try { //保存 model.Save(); //判断是否启用缓存 if (CommonBll.IsUseCache() && isCache) { SetModelForCache(model); } if (isAddUseLog) { if (string.IsNullOrEmpty(content)) { content = "{0}" + (model.Id == 0 ? "添加" : "编辑") + "OUT00记录成功,ID为【" + model.Id + "】"; } //添加用户访问记录 UseLogBll.GetInstence().Save(page, content); } } catch (Exception e) { var result = "执行OUT00Bll.Save()函数出错!"; //出现异常,保存出错日志信息 CommonBll.WriteLog(result, e); } }
/// <summary> /// 主表保存 /// </summary> /// <returns></returns> public string MAINEdit() { string _IN_ID = tbxIN_ID.Text; try { var model = new IN00(x => x.IN_ID == _IN_ID); var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); string _SHOP_ID = ddlSHOP_NAME.SelectedValue; if (String.IsNullOrEmpty(_IN_ID)) { model.SetIsNew(true); model.CRT_DATETIME = DateTime.Now; model.CRT_USER_ID = OlUser.Manager_LoginName; DataTable dt = new DataTable(); dt = (DataTable)SPs.Get_ORDER_SEED(_SHOP_ID, "IN00").ExecuteDataTable(); _IN_ID = dt.Rows[0]["PLANE_ID"].ToString(); tbxIN_ID.Text = _IN_ID; //var model = Purchase00.SingleOrDefault(x => x.Purchase_ID == _Pur00_id); } model.SHOP_ID = _SHOP_ID; model.IN_ID = _IN_ID.ToString(); model.STATUS = ConvertHelper.Cint(ddlStatus.SelectedValue); model.INPUT_DATE = ConvertHelper.StringToDatetime(dpINPUT_DATE.SelectedDate.ToString()); model.OUT_SHOP = ddlOUT_SHOP.SelectedValue; model.STOCK_ID = ddlSTOCK_ID.SelectedValue; model.USER_ID = OlUser.Manager_LoginName; model.APP_USER = OlUser.Manager_LoginName; model.APP_DATETIME = tbxAPP_DATETIME.Text == "" ? DateTime.Parse("1900-01-01 00:00:00") : DateTime.Now; string _RELATE_ID = tbxRELATE_ID.Text; model.RELATE_ID = _RELATE_ID; if (!String.IsNullOrEmpty(_RELATE_ID)) { var modelOrder = new OUT00(x => x.OUT_ID == _RELATE_ID); modelOrder.Exported = 1; modelOrder.Exported_ID = _RELATE_ID; modelOrder.Save(); } model.Memo = tbxMemo.Text; model.LOCKED = ConvertHelper.StringToByte(ckLOCKED.Checked ? "1" : "0"); model.MOD_DATETIME = DateTime.Now; model.MOD_USER_ID = OlUser.Manager_LoginName; model.LAST_UPDATE = DateTime.Now; model.Trans_STATUS = 0; IN00Bll.GetInstence().Save(this, model); LoadMAIN(); } catch (Exception err) { return(err.Message); } return(""); }