/// <summary> /// 得到一个对象实体 /// </summary> public void InitControl() { InitBindDrop(); if (!string.IsNullOrEmpty(_key)) { bpms_roles = bpms_rolesibll.GetEntity(_key); ControlBindHelper.SetWebControls(this.Page, bpms_roles); } }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public int Insert(BPMS_Roles entity) { entity.SortCode = CommonHelper.GetInt(this.GetMaxCode()); int IsOk = DataFactory.DbUtils().Insert(entity); #region 写日操作日志 if (IsOk > 0) { BPMS_SysLogDAL.Instance.AddTaskLog <BPMS_Roles>(entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return(IsOk); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public int Update(BPMS_Roles entity) { #region 获取旧值 var oldEntity = this.GetEntity(BPMS_SysLogDAL.Instance.GetKeyFieldValue <BPMS_Roles>(entity).ToString()); #endregion int IsOk = DataFactory.DbUtils().Update(entity, "RoleId"); #region 写日操作日志 if (IsOk > 0) { BPMS_SysLogDAL.Instance.UpdateTaskLog <BPMS_Roles>(oldEntity, entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return(IsOk); }
public void LoadAction() { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.Expires = 0; Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "No-Cache"); string active = HttpContext.Current.Request["action"]; //提交类型 string orderField = HttpContext.Current.Request["pqGrid_OrderField"]; //排序字段 string orderType = HttpContext.Current.Request["pqGrid_OrderType"]; //排序类型 string pqGrid_Sort = HttpContext.Current.Request["pqGrid_Sort"]; //要显示字段 string key = HttpContext.Current.Request["key"]; //主键 string OrganizationId = HttpContext.Current.Request["OrganizationId"]; //公司主键 switch (active) { case "GridBindList": //加载列表 Response.Write(JsonHelper.PqGridJson <BPMS_Roles>(bpms_rolesibll.GetList(OrganizationId), pqGrid_Sort)); Response.End(); break; case "InitRoles": //加载列表 Response.Write(JsonHelper.ListToJson <BPMS_Roles>(bpms_rolesibll.GetList(OrganizationId), "JSON")); Response.End(); break; case "Delete": //删除数据 bpms_roles = bpms_rolesibll.GetEntity(key); if (bpms_roles.AllowDelete == 0) { Response.Write(string.Format(MessageHelper.MSG0009, bpms_roles.FullName)); Response.End(); } else { Response.Write(bpms_rolesibll.Delete(key)); Response.End(); } break; default: break; } }
/// <summary> /// 确认事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Accept_Click(object sender, EventArgs e) { bool IsOk = false; bpms_roles = ControlBindHelper.GetWebControls <BPMS_Roles>(this.Page); bpms_roles.Enabled = Enabled.Checked ? 1 : 0; bpms_roles.AllowEdit = AllowEdit.Checked ? 1 : 0; bpms_roles.AllowDelete = AllowDelete.Checked ? 1 : 0; if (!string.IsNullOrEmpty(_key))//判断是否编辑 { bpms_roles.RoleId = _key; bpms_roles.ModifyDate = DateTime.Now; bpms_roles.ModifyUserId = RequestSession.GetSessionUser().UserId; bpms_roles.ModifyUserName = RequestSession.GetSessionUser().UserName; IsOk = bpms_rolesibll.Update(bpms_roles); if (IsOk) { ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0006); } } else { bpms_roles.OrganizationId = _OrganizationId; bpms_roles.RoleId = CommonHelper.GetGuid; bpms_roles.CreateUserId = RequestSession.GetSessionUser().UserId; bpms_roles.CreateUserName = RequestSession.GetSessionUser().UserName; IsOk = bpms_rolesibll.Insert(bpms_roles); if (IsOk) { ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0005); } } if (!IsOk) { ShowMsgHelper.Alert_Error(MessageHelper.MSG0022); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Update(BPMS_Roles entity) { return(dal.Update(entity) >= 0 ? true : false); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Insert(BPMS_Roles entity) { return(dal.Insert(entity) >= 0 ? true : false); }