/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, LblistEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SaveForm(string keyValue, LblistEntity entity) { if (string.IsNullOrEmpty(keyValue)) { var data = lblistbll.GetList(entity.dictitemid, entity.empid); if (data != null && data.Count() > 0) { lblistbll.UpdateByisnew(entity.dictitemid, entity.empid); } entity.isnew = 1; entity.inputtime = DateTime.Now; try { if (!string.IsNullOrEmpty(OperatorProvider.Provider.Current().OldSystemUserID)) { entity.inputuserid = Convert.ToInt16(OperatorProvider.Provider.Current().OldSystemUserID); } else { entity.inputuserid = 0; } } catch (Exception) { } } else { LblistEntity ent = lblistbll.GetEntity(keyValue.ToInt()); if (ent != null) { if (ent.isnew == 0) { return(Error("已经过期领用不允许编辑!")); } } else { return(Error("编辑数据不存在,请确定后再操作。")); } } entity.lbenddate = entity.lbbegindate.AddMonths(entity.lbmonth); lblistbll.SaveForm(keyValue, entity); return(Success("操作成功。")); }
public ActionResult RemoveForm(int keyValue) { LblistEntity entity = lblistbll.GetEntity(keyValue); if (entity != null) { if (entity.isnew == 0) { return(Error("已经过期领用不允许删除!")); } else { lblistbll.RemoveForm(keyValue); return(Success("删除成功。")); } } else { return(Error("删除数据不存在,请刷新页面操作。")); } }