示例#1
0
 /// <summary>
 /// 是否可以执行打印命令
 /// </summary>
 /// <returns></returns>
 private bool OnCanExecutePrintCommand()
 {
     if (Equals(RoleInfoList, null) || !RoleInfoList.Any())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#2
0
        /// <summary>
        /// 取得分页数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        private void getRolePageData(int pageIndex, int pageSize)
        {
#if DEBUG
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
#endif
            //pageRepuestParams.SortField = "LastUpdatedTime";
            pageRepuestParams.SortOrder = "desc";

            pageRepuestParams.PageIndex = pageIndex;
            pageRepuestParams.PageSize  = pageSize;


            //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
            //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/EnterpriseInfo/Get?id='1'")).Content.ReadAsStringAsync());

            var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <RoleModel> > >(GlobalData.ServerRootUri + "RoleManager/PageData", Utility.JsonHelper.ToJson(pageRepuestParams));

#if DEBUG
            stopwatch.Stop();
            Utility.LogHelper.Info("获取角色信息用时(毫秒):" + stopwatch.ElapsedMilliseconds);
            Utility.LogHelper.Info("角色信息内容:" + Utility.JsonHelper.ToJson(result));
#endif

            if (!Equals(result, null) && result.Successed)
            {
                Application.Current.Resources["UiMessage"] = result?.Message;
                LogHelper.Info(Application.Current.Resources["UiMessage"].ToString());
                if (result.Data.Data.Any())
                {
                    //RoleInfoList = new ObservableCollection<RoleModel>(result.Data.Data);
                    RoleInfoList = new ObservableCollection <RoleModel>();
                    foreach (var data in result.Data.Data)
                    {
                        RoleModel role = new RoleModel();
                        role = data;
                        role.PropertyChanged += OnPropertyChangedCommand;
                        RoleInfoList.Add(role);
                    }
                    int TotalCounts = result.Data.Total;
                }
                else
                {
                    RoleInfoList?.Clear();
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                RoleInfoList = new ObservableCollection <RoleModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询角色信息失败,请联系管理员!";
            }
        }
示例#3
0
        /// <summary>
        /// 取得分页数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        private void getRolePageData(int pageIndex, int pageSize)
        {
#if DEBUG
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
#endif
            pageRepuestParams.SortOrder = "desc";

            pageRepuestParams.PageIndex = pageIndex;
            pageRepuestParams.PageSize  = pageSize;

            var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <RoleModel> > >(GlobalData.ServerRootUri + "RoleManager/PageData", Utility.JsonHelper.ToJson(pageRepuestParams));

#if DEBUG
            stopwatch.Stop();
            Utility.LogHelper.Info("获取角色信息用时(毫秒):" + stopwatch.ElapsedMilliseconds);
            Utility.LogHelper.Info("角色信息内容:" + Utility.JsonHelper.ToJson(result));
#endif

            if (!Equals(result, null) && result.Successed)
            {
                Application.Current.Resources["UiMessage"] = result?.Message;
                LogHelper.Info(Application.Current.Resources["UiMessage"].ToString());
                if (result.Data.Data.Any())
                {
                    foreach (var data in result.Data.Data)
                    {
                        RoleModel role = new RoleModel();
                        role = data;
                        role.PropertyChanged += OnPropertyChangedCommand;
                        RoleInfoList.Add(role);
                    }
                    int TotalCounts = result.Data.Total;
                }
                else
                {
                    RoleInfoList?.Clear();
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                RoleInfoList = new ObservableCollection <RoleModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询角色信息失败,请联系管理员!";
            }
        }
示例#4
0
        /// <summary>
        /// 模型数据改变
        /// </summary>
        /// <param name="obj"></param>
        private void dataChanged(RoleModel commSocketServerModel)
        {
            getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize);
            var tmpModel = RoleInfoList.FirstOrDefault(a => a.Id == commSocketServerModel.Id);

            this.RoleInfo = RoleInfoList.FirstOrDefault();
            ////新增、不存在的数据插入到第一行便于查看
            //if (Equals(tmpModel, null))
            //{
            //    this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    //this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    EnterpriseInfoList.RemoveAt(this.EnterpriseInfoList.Count - 1);
            //}
            //else
            //{
            //    //修改的更新后置于第一行,便于查看
            //    tmpModel = enterpriseModel;
            //    EnterpriseInfoList.Move(EnterpriseInfoList.IndexOf(tmpModel), 0);
            //    tmpModel = enterpriseModel;
            //}
        }
示例#5
0
文件: RoleInfo.aspx.cs 项目: qdjx/C5
        //列表绑定
        private void ListBind()
        {
            //筛选条件
            var FilterFields = new List <ListFilterField>();

            if (!string.IsNullOrWhiteSpace(inpFilter.Text.Trim()))
            {
                FilterFields.Add(new ListFilterField
                {
                    Name       = "NameAndTitle",
                    CmpareMode = FilterCmpareMode.Like,
                    Value      = new List <string>(inpFilter.Text.Trim().Split(' '))
                });
            }

            //排序字段
            var OrderByFields = new List <ListOrderField>();

            foreach (string item in new string[] { "ListOrderByID", "ListOrderByName", "ListOrderByTitle", "ListOrderByEnabled" })
            {
                GetOrderByField(RoleInfoList, item, OrderByFields, out OrderByFields);
            }

            //显示列表页
            var userInfos = Ziri.BLL.SYS.Role.GetRoleInfos(FilterFields, OrderByFields
                                                           , RoleInfoListPager.PageSize, RoleInfoListPager.PageIndex, out long rowCount, out AlertMessage alertMessage);

            RoleInfoList.DataSource = userInfos;
            RoleInfoList.DataBind();
            RoleInfoListPager.RowCount = rowCount;

            //提示信息
            if (alertMessage != null)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ListMessage"
                                                        , string.Format("<script> swal('{0}', '', '{1}'); </script>", alertMessage.Message, alertMessage.Type));
            }
        }