Example #1
0
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UC_UserRoles_Load(object sender, EventArgs e)
        {
            //初始化
            _menuTypeBll  = new MenuTypeBll();
            _userRolesBll = new UserRolesBll();
            _rolesBll     = new RolesBll();

            if (_user != null)
            {
                label_UserName.Text       = _user.UserName;
                label_EmployeeID.Text     = _user.EmployeeID;
                label_Sex.Text            = _user.Sex == 0 ? "男" : "女";
                label_DepartmentName.Text = _user.DepartmentID.ToString();

                switch (_user.UserType.GetHashCode())
                {
                case 0: label_UserType.Text = "试用期"; break;

                case 1: label_UserType.Text = "临时员工"; break;

                case 2: label_UserType.Text = "正式员工"; break;

                case 3: label_UserType.Text = "已离职"; break;

                case 4: label_UserType.Text = "已停用"; break;
                }
            }

            //获取用户角色
            GetUserRolesByUserID();
            //初始化
            Init_TreeViewRoles();
        }
Example #2
0
        public JsonResult InitSingle()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            #region InitSingle
            Guid ID = RequestParameters.PGuid("ID");
            if (ID != Guid.Empty)
            {
                var cBll          = new RolesBll();
                var item          = cBll.GetObjectById(ID);
                var szDetailModel = new ResultDetail();
                szDetailModel.Entity    = item;
                szDetailModel.ErrorType = 1;
                return(Json(szDetailModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
Example #3
0
        /// <summary>
        /// LOAD
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UC_RoleManager_Load(object sender, EventArgs e)
        {
            _menuTypeBll = new MenuTypeBll();
            _rolesBll    = new RolesBll();

            Init_TreeViewRoles();
        }
Example #4
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            bool  isAdd            = iCurrentPageNodeId == AddPageNodeId ? true : false;
            int   iCurrentButtonId = (int)EButtonType.Save;
            var   tempNoAuth       = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            #region AddOrUpdate
            string RoleCode = RequestParameters.Pstring("RoleCode");
            string RoleName = RequestParameters.Pstring("RoleName");
            string Remark   = RequestParameters.Pstring("Remark");
            if (RoleName.Length <= 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数不能为空.";
                return(Json(sRetrunModel));
            }

            Roles item = new Roles();
            Guid  ID   = RequestParameters.PGuid("ID");
            item.RoleID          = ID;
            item.OperateDate     = DateTime.Now;
            item.RoleCode        = RoleCode;
            item.RoleName        = RoleName;
            item.Remark          = Remark;
            item.WelfareCentreID = Utits.WelfareCentreID;

            ParamState = "1";
            ParamID    = ID.ToString();
            var  cBll   = new RolesBll();
            bool isFlag = cBll.AddOrUpdateDao(item);
            if (isFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
Example #5
0
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UC_RoleMenusManager_Load(object sender, EventArgs e)
        {
            _menuTypeBll     = new MenuTypeBll();
            _menusBll        = new MenusBll();
            _roleMenusBll    = new RoleMenusBll();
            _rolesBll        = new RolesBll();
            _dicDataGridView = new Dictionary <int, Menus>();

            //初始化
            Init_TreeViewRoles();
            //初始化
            Init_TreeViewMenus(1);

            treeView_Roles.Focus();
        }
Example #6
0
        private string GetRoleID()
        {
            var buf  = new StringBuilder();
            var cBll = new RolesBll();
            var list = cBll.SearchListByValid(Utits.WelfareCentreID);

            if (list != null)
            {
                foreach (var item in list)
                {
                    buf.AppendFormat("<option value=\"{0}\">{1}</option>", item.RoleID, item.RoleName);
                }
            }
            return(buf.ToString());
        }
Example #7
0
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            int[] iRangeButton       = { (int)EButtonType.Delete, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            //注释时间 20190306 林中枝
            //后期多条删除数据时  酌情修改
            //string _ids = RequestParameters.Pstring("ids");
            //if (string.IsNullOrEmpty(_ids))
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);

            //}
            //string[] strids = _ids.Split(',');
            //System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            //for (int i = 0; i < strids.Length; i++)
            //{
            //    if (RegexValidate.IsGuid(strids[i]))
            //    {
            //        arrayList.Add(strids[i]);
            //    }
            //}
            //string[] ids = (string[])arrayList.ToArray(typeof(string));
            //if (!ids.Any())
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);

            //}
            Guid ID = RequestParameters.PGuid("ids");
            if (ID == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var  cBll   = new RolesBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.Delete:    //删除
                ParamState = "3";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Deleted);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Valid);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.OperateDataStatus(ID, Utits.WelfareCentreID, (int)ESystemStatus.Forbidden);
                break;
            }
            if (isFlag)
            {
                ParamID = ID.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
Example #8
0
        public JsonResult SearchList()
        {
            #region 权限控制
            int[] iRangePage         = { ListPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            //当前页
            int iCurrentPage = RequestParameters.Pint("currentPage");
            iCurrentPage = iCurrentPage <= 0 ? 1 : iCurrentPage;
            //索引页
            int iPageIndex = iCurrentPage - 1;
            //一页的数量
            int iPageSize = RequestParameters.Pint("pageSize");
            iPageSize = iPageSize <= 0 ? 5 : iPageSize;
            iPageSize = iPageSize > 100 ? 100 : iPageSize;
            //总记录数量
            int iTotalRecord = 0;

            #region 查询条件
            var searchCondition = new ConditionModel();

            var  WhereList       = new List <WhereCondition>();
            Guid welfareCentreId = Utits.WelfareCentreID;
            if (welfareCentreId != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "WelfareCentreID";
                whereCondition.FieldValue    = welfareCentreId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string Name = RequestParameters.Pstring("Name");
            if (Name.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "RoleName";
                whereCondition.FieldValue    = Name;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }
            int?IsValid = RequestParameters.PintNull("IsValid");
            if (IsValid != null)
            {
                if (IsValid == 1)
                {
                    var whereCondition = new WhereCondition();
                    whereCondition.FieldName     = "IsValid";
                    whereCondition.FieldValue    = IsValid;
                    whereCondition.FieldOperator = EnumOper.Equal;
                    WhereList.Add(whereCondition);
                }
                else
                {
                    var whereCondition = new WhereCondition();
                    whereCondition.FieldName     = "IsValid";
                    whereCondition.FieldValue    = 1;
                    whereCondition.FieldOperator = EnumOper.ExclamationEqual;
                    WhereList.Add(whereCondition);
                }
            }
            searchCondition.WhereList = WhereList;

            var    OrderList = new List <OrderCondition>();
            string sortfield = RequestParameters.Pstring("sortfield");
            if (sortfield.Length <= 0)
            {
                sortfield = "OperateDate";
            }
            var orderCondition = new OrderCondition();
            orderCondition.FiledOrder = sortfield;
            orderCondition.Ascending  = RequestParameters.Pstring("sorttype") == "asc" ? true : false;
            OrderList.Add(orderCondition);

            searchCondition.OrderList = OrderList;
            #endregion

            var cBll = new RolesBll();
            var list = cBll.SearchByPageCondition(iPageIndex, iPageSize, ref iTotalRecord, searchCondition);
            iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize;
            int pageCount    = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1;
            var sReturnModel = new ResultList();
            sReturnModel.ErrorType   = 1;
            sReturnModel.CurrentPage = iCurrentPage;
            sReturnModel.PageSize    = iPageSize;
            sReturnModel.TotalRecord = iTotalRecord;
            sReturnModel.PageCount   = pageCount;
            sReturnModel.Data        = list;
            return(Json(sReturnModel));
        }