Ejemplo n.º 1
0
        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 = Request["action"];                                          //提交类型
            string orderField = Request["pqGrid_OrderField"];                           //排序字段
            string orderType = Request["pqGrid_OrderType"];                             //排序类型
            string pqGrid_Sort = Request["pqGrid_Sort"];                                //要显示字段
            string key = Request["key"];                                                //主键
            string OrganizationId = Request["OrganizationId"];                          //公司主键
            switch (active)
            {
                case "GridBindList"://加载列表
                    Response.Write(JsonHelper.PqGridJson<AMS_Roles>(ams_rolesbll.GetList(OrganizationId), pqGrid_Sort));
                    Response.End();
                    break;
                case "InitRoles"://加载列表
                    Response.Write(JsonHelper.ListToJson<AMS_Roles>(ams_rolesbll.GetList(OrganizationId), "JSON"));
                    Response.End();
                    break;
                case "Delete":    //删除数据
                    ams_roles = ams_rolesbll.GetEntity(key);
                    if (ams_roles.AllowDelete == 0)
                    {
                        Response.Write(string.Format(MessageHelper.MSG0009, ams_roles.FullName));
                        Response.End();
                    }
                    else
                    {
                        Response.Write(ams_rolesbll.Delete(key));
                        Response.End();
                    }
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="entity">实体类</param>
 /// <returns></returns>
 public bool Update(AMS_Roles entity)
 {
     //return dal.Update(entity) >= 0 ? true : false;
     #region 获取旧值
     var oldEntity = this.GetEntity(AMS_SysLogBLL.Instance.GetKeyFieldValue<AMS_Roles>(entity).ToString());
     #endregion
     int IsOk = DbUtils.Update(entity, "RoleId");
     #region 写日操作日志
     if (IsOk > 0)
     {
         AMS_SysLogBLL.Instance.UpdateTaskLog<AMS_Roles>(oldEntity, entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName);
     }
     #endregion
     return IsOk >= 0 ? true : false;
 }
Ejemplo n.º 3
0
 public string Insert_Update(AMS_Roles role, string OrganizationId, string key)
 {
     bool IsOk = false;
     if (!string.IsNullOrEmpty(key))//判断是否编辑
     {
         role.RoleId = key;
         role.ModifyDate = DateTime.Now;
         role.ModifyUserId = RequestSession.GetSessionUser().UserId.ToString();
         role.ModifyUserName = RequestSession.GetSessionUser().UserName.ToString();
         IsOk = ams_rolesbll.Update(role);
         if (IsOk) { return ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0006); }
     }
     else
     {
         role.OrganizationId = OrganizationId;
         role.RoleId = CommonHelper.GetGuid;
         role.CreateDate = DateTime.Now;
         role.CreateUserId = RequestSession.GetSessionUser().UserId.ToString();
         role.CreateUserName = RequestSession.GetSessionUser().UserName.ToString();
         IsOk = ams_rolesbll.Insert(role);
         if (IsOk) { return ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0005); }
     }
     if (!IsOk)
         return ShowMsgHelper.Alert_Error(MessageHelper.MSG0022);
     return null;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="entity">实体类</param>
 /// <returns></returns>
 public bool Insert(AMS_Roles entity)
 {
     //return dal.Insert(entity) >= 0 ? true : false;
     entity.SortCode = CommonHelper.GetInt(this.GetMaxCode());
     int IsOk = DbUtils.Insert(entity);
     #region 写日操作日志
     if (IsOk > 0)
     {
         AMS_SysLogBLL.Instance.AddTaskLog<AMS_Roles>(entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName);
     }
     #endregion
     return IsOk >= 0 ? true : false;
 }