Example #1
0
        public void Show(int id)
        {
            try
            {
                SystemUserGroupWrapper obj = SystemUserGroupWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtGroupNameCn.Text      = obj.GroupNameCn.ToString();
                    this.txtGroupNameEn.Text      = obj.GroupNameEn.ToString();
                    this.txtGroupDescription.Text = obj.GroupDescription.ToString();



                    hidSystemUserGroupID.Text = id.ToString();


                    winSystemUserGroupEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "错误信息:数据不存在";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }
Example #2
0
        protected void storeSystemUserGroup_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            int    recordCount   = 0;
            string sortFieldName = "";

            if (e.Sort != null)
            {
                sortFieldName = e.Sort;
            }

            int startIndex = 0;

            if (e.Start > -1)
            {
                startIndex = e.Start;
            }

            int limit = this.PagingToolBar1.PageSize;

            int pageIndex = 1;

            if ((startIndex % limit) == 0)
            {
                pageIndex = startIndex / limit + 1;
            }
            else
            {
                pageIndex = startIndex / limit;
            }

            storeSystemUserGroup.DataSource = SystemUserGroupWrapper.FindAllByOrderBy(sortFieldName, (e.Dir == Ext.Net.SortDirection.DESC), pageIndex, limit, out recordCount);
            e.Total = recordCount;

            storeSystemUserGroup.DataBind();
        }
        private void InitStore1()
        {
            SystemUserGroupWrapper   systemUserGroupWrapper = SystemUserGroupWrapper.FindById(UserGroupID);
            List <SystemRoleWrapper> list1 = SystemRoleWrapper.FindAll();                                                //得到所有的角色
            List <string>            list2 = SystemUserGroupWrapper.GetUserGroupAssignedRoleIDs(systemUserGroupWrapper); //得到用户的所有角色编号
            List <SystemRoleWrapper> list3 = list1.FindAll(p => !list2.Contains(p.RoleID.ToString()));

            Store1.DataSource = list3;
            Store1.DataBind();
        }
Example #4
0
        protected void Store1_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            SystemUserWrapper             systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <SystemUserGroupWrapper> list1             = SystemUserGroupWrapper.FindAll(); //得到所有的用户组
            List <string> list2 = SystemUserWrapper.GetUserAssignedGroupIDs(systemUserWrapper); //得到用户的所有用户组编号
            List <SystemUserGroupWrapper> list3 = list1.FindAll(p => !list2.Contains(p.GroupID.ToString()));

            Store1.DataSource = list3;
            Store1.DataBind();
        }
        protected void storeSystemUserGroup_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            PageQueryParams pageQueryParams = WebUIHelper.GetPageQueryParamFromStoreRefreshDataEventArgs(e, this.PagingToolBar1);

            RecordSortor recordSortor = WebUIHelper.GetRecordSortorFromStoreRefreshDataEventArgs(e);

            storeSystemUserGroup.DataSource = SystemUserGroupWrapper.FindAllByOrderBy(recordSortor.OrderByColumnName, recordSortor.IsDesc, pageQueryParams);
            e.Total = pageQueryParams.RecordCount;

            storeSystemUserGroup.DataBind();
        }
        private void InitStore2()
        {
            SystemUserGroupWrapper   systemUserGroupWrapper = SystemUserGroupWrapper.FindById(UserGroupID);
            List <string>            list2 = SystemUserGroupWrapper.GetUserGroupAssignedRoleIDs(systemUserGroupWrapper);
            List <SystemRoleWrapper> list3 = new List <SystemRoleWrapper>();

            foreach (string s in list2)
            {
                list3.Add(SystemRoleWrapper.FindById(Int32.Parse(s)));
            }
            Store2.DataSource = list3;
            Store2.DataBind();
        }
Example #7
0
        protected void Store2_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            SystemUserWrapper             systemUserWrapper = SystemUserWrapper.FindById(UserID);
            List <string>                 list2             = SystemUserWrapper.GetUserAssignedGroupIDs(systemUserWrapper);
            List <SystemUserGroupWrapper> list3             = new List <SystemUserGroupWrapper>();

            foreach (string s in list2)
            {
                list3.Add(SystemUserGroupWrapper.FindById(Int32.Parse(s)));
            }
            Store2.DataSource = list3;
            Store2.DataBind();
        }
Example #8
0
        public void DeleteRecord(int id)
        {
            try
            {
                SystemUserGroupWrapper.DeleteByID(id);

                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
 public void Save_UserGroupRole(string json)
 {
     try
     {
         KeyValuePair <string, string>[] selectIDs = JSON.Deserialize <KeyValuePair <string, string>[]>(json);
         List <String> list = new List <string>();
         foreach (KeyValuePair <string, string> row in selectIDs)
         {
             list.Add(row.Key);
         }
         SystemUserGroupWrapper.PatchAssignUserGroupRoles(SystemUserGroupWrapper.FindById(UserGroupID), list);
     }
     catch (Exception ex)
     {
         ResourceManager.AjaxSuccess      = false;
         ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
     }
 }
Example #10
0
        public void Save_UserGroupRole(string json)
        {
            try
            {
                List <SystemRoleWrapper> selectIDs = JSON.Deserialize <List <SystemRoleWrapper> >(json);

                List <String> list = new List <string>();
                foreach (SystemRoleWrapper row in selectIDs)
                {
                    list.Add(row.RoleID.ToString());
                }
                SystemUserGroupWrapper.PatchAssignUserGroupRoles(SystemUserGroupWrapper.FindById(UserGroupID), list);
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
            }
        }
Example #11
0
        protected void btnSaveSystemUserGroup_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemUserGroupWrapper obj = new SystemUserGroupWrapper();
                obj.GroupNameCn      = this.txtGroupNameCn.Text.Trim();
                obj.GroupNameEn      = this.txtGroupNameEn.Text.Trim();
                obj.GroupDescription = this.txtGroupDescription.Text.Trim();


                SystemUserGroupWrapper.Save(obj);

                winSystemUserGroupAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
Example #12
0
        protected void btnSaveSystemUserGroup_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemUserGroupWrapper obj = SystemUserGroupWrapper.FindById(int.Parse(hidSystemUserGroupID.Text.Trim()));
                obj.GroupNameCn      = this.txtGroupNameCn.Text.Trim();
                obj.GroupNameEn      = this.txtGroupNameEn.Text.Trim();
                obj.GroupDescription = this.txtGroupDescription.Text.Trim();

                SystemUserGroupWrapper.Update(obj);

                winSystemUserGroupEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }