/// <summary>
 /// 取得提交过来的数据
 /// </summary>
 private void getDataFromClient()
 {
     this.roleInfo = new RoleDto();
     this.roleInfo.Role = MakeUtil.getRequestDataToModel<RoleModel>(Request, typeof(RoleModel), -1);
     this.roleInfo.RolePowerList = new List<RolePowerModel>();
     IList<PowerNameDto> powerNameList = this.roleEbi.getPowerNameList();
     foreach (PowerNameDto powerName in powerNameList)
     {
         if (MakeUtil.getStringFromRequestByName(Request, powerName.PowerName, -1).Trim().Length > 0)
         {
             this.roleInfo.RolePowerList.Add(new RolePowerModel
             {
                 RoleID = this.roleInfo.Role.Evenid.ToString(),
                 Modules = powerName.Modules,
                 PowerName = powerName.PowerName
             });
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!MakeUtil.checkSysConfirm(Session, Response)) return;
            if (!this.Page.IsPostBack)
            {
                try
                {
                    int evenid = int.Parse(MakeUtil.getStringFromRequestByName(Request, "Evenid", -1).Trim());
                    this.roleInfo = this.roleEbi.get(evenid);
                    if (null == this.roleInfo)
                    {
                        Script.alertMsg("找不到相关的角色资料", this.Page);
                        Script.closeDivWin(this.Page, "RoleModify" + evenid.ToString());
                        return;
                    }
                    this.bindAll();
                    this.setButtonsState();
                }
                catch (MakeException makeEx)
                {
                    Script.alertMsg(makeEx.Message, this.Page);
                    return;
                }

            }
        }
Example #3
0
        public IList<RoleDto> getDtoList(IList<QueryModel> qmList, int limitCount)
        {
            SqlConnection cn = null;
            IList<RoleDto> roleDtoList = new List<RoleDto>();
            try
            {
                cn = DbHelperSQL.getConnection();
                IList<RoleModel> roleModelList = this.roleDal.getModelList(cn, null, qmList, limitCount);
                foreach (RoleModel model in roleModelList)
                {
                    RoleDto role = new RoleDto();
                    role.Role=model;
                    IList<QueryModel> qmlist = new List<QueryModel>();
                    qmlist.Add(MakeUtil.getQueryModel("RoleID", "'", SqlWhere.WhereOperator.Equal, model.RoleID));
                    role.RolePowerList = this.rolePowerDal.getModelList(cn, null, qmlist, -1);

                    IList<QueryModel> uqmList = new List<QueryModel>();
                    role.UserCount = this.userDal.getModelList(cn,null,uqmList,-1).Count;

                    uqmList.Clear();
                    uqmList.Add(MakeUtil.getQueryModel("Login", "", SqlWhere.WhereOperator.Equal, "0"));

                    role.DisabledUserCount = this.userDal.getModelList(cn, null, uqmList, -1).Count;
                    roleDtoList.Add(role);
                }
            }
            catch (DalException dalEx)
            {
                throw new MakeException(ExpSort.数据库, dalEx.Message);
            }
            finally
            {
                DbHelperSQL.closeConnection(cn);
            }
            return roleDtoList;
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // if (!MakeUtil.checkSysConfirm(Session, Response)) return;
            if (!this.Page.IsPostBack)
            {
                string copy = MakeUtil.getStringFromRequestByName(Request, "copy", -1).Trim();
                try
                {
                    if (copy == "1")
                    {
                        int evenid = int.Parse(MakeUtil.getStringFromRequestByName(Request, "evenid", -1).Trim());
                        this.roleInfo = this.roleEbi.get(evenid);

                        this.roleInfo.Role.RoleName = "";
                    }
                    else
                    {
                        this.roleInfo = new RoleDto();
                        this.roleInfo.Role = new RoleModel();
                        this.roleInfo.RolePowerList = new List<RolePowerModel>();
                    }
                }
                catch (MakeException makeEx)
                {
                    Script.alertMsg(makeEx.Message,this.Page);
                    return;
                }
                this.bindAll();
            }
        }
Example #5
0
        public RoleDto get(int evenid)
        {
            SqlConnection cn = null;
            RoleDto role = new RoleDto();
            try
            {
                cn = DbHelperSQL.getConnection();
                IList<QueryModel> qmList = new List<QueryModel>();
                qmList.Add(MakeUtil.getQueryModel("evenid","'",SqlWhere.WhereOperator.Equal,evenid.ToString()));
                RoleModel roleModel = this.roleDal.getModel(cn,null,qmList);
                if (null == roleModel)
                {
                    return null;
                }
                role.Role = roleModel;
                qmList.Clear();
                qmList.Add(MakeUtil.getQueryModel("RoleId", "'", SqlWhere.WhereOperator.Equal, roleModel.Evenid.ToString()));
                role.RolePowerList = this.rolePowerDal.getModelList(cn,null,qmList,-1);
                qmList.Clear();

                role.UserCount = this.userDal.getModelList(cn,null,qmList,-1).Count;

                qmList.Clear();
                qmList.Add(MakeUtil.getQueryModel("Login", "", SqlWhere.WhereOperator.Equal, "0"));

                role.DisabledUserCount = this.userDal.getModelList(cn,null,qmList,-1).Count;
            }
            catch (DalException dalEx)
            {
                throw new MakeException(ExpSort.数据库, dalEx.Message);
            }
            finally
            {
                DbHelperSQL.closeConnection(cn);
            }
            return role;
        }