Пример #1
0
        public GetFormFieldByViewIdReturn GetFormViewByViewId(int ViewId
                                                              , int CurUserId, string CurUserIden
                                                              )
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetFormFieldByViewIdReturn re = new GetFormFieldByViewIdReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.FieldCol = CPFormTemplate.Instance(CurUserId).GetFormFieldByViewId(ViewId);
                re.View     = CPFormTemplate.Instance(CurUserId).GetFormViewByViewId(ViewId, false);
                re.Result   = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #2
0
        public GetMsgReturn GetMsg(int MsgType, int MsgCount, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetMsgReturn re = new GetMsgReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.MsgCol = CPMsgs.Instance().GetMsg(CurUserId, CPEnum.ConvertMsgTypeEnum(MsgType), MsgCount);
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #3
0
        //http://localhost:9000/CPSite/api/GridEngine/SynGridFieldInfo?GridId=1&CurUserId=1&CurUserIden=E0A04F94-90D5-4C2A-8C9D-836813F73DC4
        public CPWebApiBaseReturnEntity SynGridFieldInfo(int GridId, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.Result = CPGridEngine.Instance(CurUserId).SyncFieldInfo(GridId);
                if (re.Result == false)
                {
                    re.ErrorMsg = "从数据库同步字段信息时出错了!";
                }
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
            }
            return(re);
        }
Пример #4
0
        public CPWebApiBaseReturnEntity ImportGridInnerFunc(int GridId, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                CPGridEngine.Instance(CurUserId).ImportInnerFunc(GridId);
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #5
0
        public CPWebApiBaseReturnEntity UpdateTreeDataParent(int TreeDataSourceId, string SourcePKValue, string TargetPKValue, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                string errorMsg = "";
                re.Result = CPTreeEngine.Instance().UpdateTreeDataParent(TreeDataSourceId, SourcePKValue, TargetPKValue, ref errorMsg);
                if (re.Result == false)
                {
                    re.ErrorMsg = errorMsg;
                }
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #6
0
        //http://localhost:9000/CPSite/api/FormEngine/InitFormDefaultView?FormId=1&CurUserId=1&CurUserIden=E0A04F94-90D5-4C2A-8C9D-836813F73DC4
        public CPWebApiBaseReturnEntity InitFormDefaultViewForEditor(int FormId, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.Result = CPFormTemplate.Instance(CurUserId).InitFormDefaultViewForEditor(FormId);
                if (re.Result == false)
                {
                    re.ErrorMsg = "自动初始化一个默认视图时出错!";
                }
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #7
0
        public FileResult DownloadTabConfig(string TabIds, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                throw new Exception("系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!");
            }
            TabIds = TabIds.Replace("@", ",");
            TabIds = CPAppContext.FormatSqlPara(TabIds);
            List <int> col = new List <int>();

            TabIds.Split(',').ToList().ForEach(t => {
                if (string.IsNullOrEmpty(t) == false)
                {
                    col.Add(int.Parse(t));
                }
            });
            string sXml = CPTabEngine.Instance().GetTabConfigXml(col);

            byte[] byteArray = System.Text.Encoding.Default.GetBytes(sXml);
            return(File(byteArray, "application/x-msdownload", "标签页配置.CPXml"));
        }
Пример #8
0
        public GetUserByUserNameOrLoginNameReturn GetUserByUserNameOrLoginName(string NameEx, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            NameEx      = CPAppContext.FormatSqlPara(NameEx);
            GetUserByUserNameOrLoginNameReturn re = new GetUserByUserNameOrLoginNameReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.UserCol = COOrgans.Instance().GetUserByUserNameOrLoginName(NameEx);
                re.UserCol = re.UserCol.OrderBy(t => t.UserName).ToList();
                re.Result  = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #9
0
        public GetDbNameReturn GetDbName(string dbIns, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetDbNameReturn re = new GetDbNameReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            re.Result = true;
            try
            {
                re.DbName = CPAppContext.GetDbName(dbIns);

                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #10
0
        public CPWebApiBaseReturnEntity SynTabConfig(int TargetSysId, bool IsCreateNew, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                var files = Request.Form.Files;
                foreach (var file in files)
                {
                    //  var filename = ContentDispositionHeaderValue
                    //                   .Parse(file.ContentDisposition)
                    //                .FileName
                    //                .Trim('"');
                    ////  filename = _FilePath + $@"\{filename}";
                    //  size += file.Length;
                    byte[] bData = null;
                    using (var fileStream = file.OpenReadStream())
                        using (var ms = new MemoryStream())
                        {
                            fileStream.CopyTo(ms);
                            bData = ms.ToArray();
                            //var fileBytes = ms.ToArray();
                            //string s = Convert.ToBase64String(fileBytes);
                            //// act on the Base64 data
                        }
                    if (bData != null)
                    {
                        if (IsCreateNew)
                        {
                            re.Result = CPTabEngine.Instance().InitTabFromConfigXml(TargetSysId, bData);
                        }
                        else
                        {
                            re.Result = CPTabEngine.Instance().SyncTabFromConfigXml(TargetSysId, bData);
                        }
                    }
                }
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #11
0
        public GetChildModuleReturn GetChildModule(int SysId, int ParentModuleId, bool IsLoadChildModule, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetChildModuleReturn re = new GetChildModuleReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                List <CPPortalModule> moduleCol = CPModuleEngine.Instance(CurUserId).GetModules(CurUserId, SysId, ParentModuleId);
                re.ModuleCol = new List <CPPortalModuleClient>();
                Mapper.Initialize(cfg =>
                {
                    cfg.CreateMap <CPPortalModule, CPPortalModuleClient>();
                });
                moduleCol.ForEach(t =>
                {
                    CPPortalModuleClient c = AutoMapper.Mapper.Map <CPPortalModuleClient>(t);
                    c.ChildModule          = new List <CPPortalModuleClient>();
                    if (IsLoadChildModule)
                    {
                        List <CPPortalModule> cModuleCol = CPModuleEngine.Instance(CurUserId).GetModules(CurUserId, SysId, t.Id);
                        cModuleCol.ForEach(f =>
                        {
                            CPPortalModuleClient tmp = AutoMapper.Mapper.Map <CPPortalModuleClient>(f);
                            c.ChildModule.Add(tmp);
                        });
                    }
                    re.ModuleCol.Add(c);
                });
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #12
0
        // GET: /<controller>/
        public IActionResult FileUpload()
        {
            base.SetGlobalViewBag();
            string BusinessCode = CPAppContext.QueryString <string>("BusinessCode");

            BusinessCode = CPAppContext.FormatSqlPara(BusinessCode);
            string ReturnMethod   = CPAppContext.QueryString <string>("ReturnMethod");
            string AllowFileTypes = CPAppContext.QueryString <string>("AllowFileTypes");
            string AllowFileCount = CPAppContext.QueryString <string>("AllowFileCount");
            string FilePath       = BusinessCode + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + new CPRuntimeContext().HHMMSSLongString() + "/";

            ViewBag.BusinessCode   = BusinessCode;
            ViewBag.ReturnMethod   = ReturnMethod;
            ViewBag.FilePath       = FilePath;
            ViewBag.AllowFileTypes = AllowFileTypes;
            ViewBag.AllowFileCount = AllowFileCount;
            return(View());
        }
Пример #13
0
        public GetDbInfoReturn GetDbInfo(string dbIns, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetDbInfoReturn re = new GetDbInfoReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            re.Result = true;
            try
            {
                re.DbName = CPAppContext.GetDbName(dbIns);
                List <CPDbTable> tableCol = CPAppContext.GetTable(dbIns);
                re.TableCol = new List <GetDbInfoReturnItem>();
                tableCol.ForEach(t =>
                {
                    GetDbInfoReturnItem i = new GetDbInfoReturnItem();
                    i.TableName           = t.TableName;
                    i.PKNames             = t.PKNames;
                    re.TableCol.Add(i);
                });
                List <CPDbTable> viewCol = CPAppContext.GetView(dbIns);
                viewCol.ForEach(t =>
                {
                    GetDbInfoReturnItem i = new GetDbInfoReturnItem();
                    i.TableName           = t.TableName;
                    i.PKNames             = t.PKNames;
                    re.TableCol.Add(i);
                });
                re.TableCol = re.TableCol.OrderBy(c => c.TableName).ToList();
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #14
0
        public GetAllDepReturn GetAllDep(int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetAllDepReturn re = new GetAllDepReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                List <CODep> allDep = COOrgans.Instance().GetAllDep();
                re.DepCol = new List <CODepOrganSel>();
                allDep.Where(t => t.ParentId.Value.Equals(-1)).ToList().ForEach(t =>
                {
                    CODepOrganSel item = new CODepOrganSel();
                    item.Id            = t.Id;
                    item.DepName       = t.DepName;
                    item.ChildDep      = this.GetChildDep(allDep, t.Id);
                    if (item.ChildDep.Count > 0)
                    {
                        item.HasChildDep = true;
                    }
                    else
                    {
                        item.HasChildDep = false;
                    }
                    re.DepCol.Add(item);
                });
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #15
0
        public GetUserByMyDepReturn GetUserByMyDep(int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            GetUserByMyDepReturn re = new GetUserByMyDepReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                string depIds = CPExpressionHelper.Instance.RunCompile("${CPUser.DepIds()}");
                re.UserCol = new List <COUser>();
                depIds.Split(',').ToList().ForEach(t =>
                {
                    if (string.IsNullOrEmpty(t) == false)
                    {
                        List <COUser> col = COOrgans.Instance().GetUserByDepId(int.Parse(t));
                        col.ForEach(u =>
                        {
                            if (re.UserCol.Where(f => f.Id.Equals(u.Id)).Count() <= 0)
                            {
                                re.UserCol.Add(u);
                            }
                        });
                    }
                });

                re.UserCol = re.UserCol.OrderBy(t => t.UserName).ToList();
                re.Result  = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #16
0
        public CPWebApiBaseReturnEntity SetRoleModuleIdsToSession(int RoleId, int SysId, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            CPWebApiBaseReturnEntity re = new CPWebApiBaseReturnEntity();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                List <CPPortalModule> col = CPModuleEngine.Instance(CurUserId).GetModulesWithRight(new List <int>()
                {
                    RoleId
                }, SysId);
                string ids = "";
                col.ForEach(t =>
                {
                    if (string.IsNullOrEmpty(ids))
                    {
                        ids = t.Id.ToString();
                    }
                    else
                    {
                        ids += "," + t.Id.ToString();
                    }
                });
                CPAppContext.GetHttpContext().Session.SetString("CurUserModuleRightInRole", ids);
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #17
0
        public GetTabInfoReturn GetTabInfo(string TabCode, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            TabCode     = CPAppContext.FormatSqlPara(TabCode);
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);

            GetTabInfoReturn re = new GetTabInfoReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.Tab = CPTabEngine.Instance().GetTab(TabCode, true);
                #region 处理
                List <CPTabItem> cCol = new List <CPTabItem>();
                re.Tab.ItemCol.ForEach(t =>
                {
                    bool isShow = true;
                    if (t.IsUseExpressionShow.Value)
                    {
                        string leftValue  = CPExpressionHelper.Instance.RunCompile(t.LeftExpression);
                        string rightValue = CPExpressionHelper.Instance.RunCompile(t.RightExpression);

                        if (t.ShowMethod == CPTabEnum.ShowMethodEnum.EqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase))
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.NotEqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase) == false)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.GreaterThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft >= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.GreaterThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft > dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.LessThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft <= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.LessThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft < dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.Contains)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) != -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTabEnum.ShowMethodEnum.DoesNotContain)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) == -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        isShow = true;
                    }
                    if (isShow)
                    {
                        t.TargetUrl = CPExpressionHelper.Instance.RunCompile(t.TargetUrl);
                        cCol.Add(t);
                    }
                });
                #region 添加修改配置按钮
                if (re.Tab.SysId.HasValue && re.Tab.SysId.Value.Equals(CPAppContext.InnerSysId) == false)
                {
                    string UserAdminSysIds = CPExpressionHelper.Instance.RunCompile("${CPUser.UserAdminSysIds()}");
                    if (UserAdminSysIds.Split(',').ToList().Contains(re.Tab.SysId.ToString()))
                    {
                        CPTabItem func1 = new CPTabItem();
                        func1.EleTitle            = "修改配置";
                        func1.IsUseExpressionShow = false;
                        func1.ShowOrder           = 99999;
                        func1.TabId     = re.Tab.Id;
                        func1.TargetUrl = "/Plat/Form/FormView?FormCode=Form201709231502250010&SceneCode=Scene201709231514430010&ViewCode=View201709231514390010&DeviceType=1&InitGroupCode=Group201709231514470010&SysId=1&PKValues=" + re.Tab.Id;
                        cCol.Add(func1);
                    }
                }
                #endregion
                re.Tab.ItemCol = cCol;
                #endregion
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #18
0
        public GetTreeInfoReturn GetTreeInfo(string TreeCode, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            TreeCode    = CPAppContext.FormatSqlPara(TreeCode);
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);

            GetTreeInfoReturn re = new GetTreeInfoReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                re.Tree = CPTreeEngine.Instance().GetTree(TreeCode, true, true);

                #region 处理
                List <CPTreeFunc> cCol = new List <CPTreeFunc>();
                re.Tree.FuncCol.ForEach(t =>
                {
                    bool isShow = true;
                    if (t.IsUseExpressionShow.Value)
                    {
                        string leftValue  = CPExpressionHelper.Instance.RunCompile(t.LeftExpression);
                        string rightValue = CPExpressionHelper.Instance.RunCompile(t.RightExpression);

                        if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.EqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase))
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.NotEqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase) == false)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.GreaterThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft >= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.GreaterThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft > dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.LessThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft <= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.LessThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft < dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.Contains)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) != -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPTreeEnum.ShowMethodEnum.DoesNotContain)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) == -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        isShow = true;
                    }
                    if (isShow)
                    {
                        t.JSMethod = CPExpressionHelper.Instance.RunCompile(t.JSMethod);
                        cCol.Add(t);
                    }
                });
                #region 添加修改配置按钮
                if (re.Tree.SysId.HasValue && re.Tree.SysId.Value.Equals(CPAppContext.InnerSysId) == false)
                {
                    string UserAdminSysIds = CPExpressionHelper.Instance.RunCompile("${CPUser.UserAdminSysIds()}");
                    if (UserAdminSysIds.Split(',').ToList().Contains(re.Tree.SysId.ToString()))
                    {
                        CPTreeFunc func1 = new CPTreeFunc();
                        func1.FuncTitle           = "修改配置";
                        func1.ShowOrder           = 999999;
                        func1.FuncIcon            = "icon-shezhi1";
                        func1.IsUseExpressionShow = false;
                        func1.JSMethod            = "CPTreeUpdateConfig(" + re.Tree.Id + ")";
                        func1.ShowPosition        = CPTreeEnum.ShowPositionEnum.TopAndRight;
                        func1.SourceId            = -1;
                        func1.TreeId = re.Tree.Id;
                        cCol.Add(func1);
                    }
                }
                #endregion
                re.Tree.FuncCol = cCol;
                #endregion


                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #19
0
        public GetFormInfoReturn GetFormInfo(string FormCode, string SceneCode, string ViewCode, string InitGroupCode,
                                             string RightGroupCode, string PKValues
                                             , int CurUserId, string CurUserIden, string DeviceType = "1",
                                             bool IsView = false
                                             )
        {
            GetFormInfoReturn re = new GetFormInfoReturn();

            try
            {
                base.SetHeader();
                FormCode       = CPAppContext.FormatSqlPara(FormCode);
                SceneCode      = CPAppContext.FormatSqlPara(SceneCode);
                ViewCode       = CPAppContext.FormatSqlPara(ViewCode);
                InitGroupCode  = CPAppContext.FormatSqlPara(InitGroupCode);
                RightGroupCode = CPAppContext.FormatSqlPara(RightGroupCode);
                PKValues       = CPAppContext.FormatSqlPara(PKValues);
                CurUserIden    = CPAppContext.FormatSqlPara(CurUserIden);
                DeviceType     = CPAppContext.FormatSqlPara(DeviceType);

                if (this.CheckUserIden(CurUserId, CurUserIden) == false)
                {
                    re.Result   = false;
                    re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                    return(re);
                }
                CPForm form = CPFormTemplate.Instance(CurUserId).GetForm(FormCode, true, true, false, false, false, true);
                form.ViewCol = new List <CPFormView>();
                form.ViewCol.Add(CPFormTemplate.Instance(CurUserId).GetFormView(ViewCode, true));
                //re.Form = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<CPForm, CPFormClient>()
                //                                  .Map(form);
                Mapper.Initialize(cfg =>
                {
                    cfg.CreateMap <CPForm, CPFormClient>();
                });

                re.Form = AutoMapper.Mapper.Map <CPFormClient>(form);
                CPFormGroup rightGroup = CPFormTemplate.Instance(CurUserId).GetFormRightGroup(RightGroupCode, true);
                // re.FieldRightCol = (rightGroup == null ? null : rightGroup.FieldRightCol);
                CPFormGroup initGroup = CPFormTemplate.Instance(CurUserId).GetFormInitGroup(InitGroupCode, true);
                re.Form.FieldInitCol = (initGroup == null ? null : initGroup.FieldInitCol);
                re.ViewHTML          = CPFormTemplate.Instance(CurUserId).FormatFormViewHtml(form, form.FieldCol, form.ViewCol[0],
                                                                                             (rightGroup == null ? null : rightGroup.FieldRightCol),
                                                                                             CPEnum.ConvertDeviceTypeEnum(int.Parse(DeviceType)), true, IsView);
                //获取应用场景
                re.Form.UseSceneCol = new List <CPFormUseScene>();
                re.Form.UseSceneCol.Add(CPFormTemplate.Instance(CurUserId).GetFormUseScene(SceneCode, true));
                re.Form.UseSceneCol.ForEach(t =>
                {
                    t.FormSavedInfo = CPExpressionHelper.Instance.RunCompile(t.FormSavedInfo);

                    //处理按钮是否显示
                    List <CPFormUseSceneFunc> funcCol = new List <CPFormUseSceneFunc>();
                    t.FuncCol.ForEach(func => {
                        if (func.FuncIsShowInView == CPFormEnum.FuncIsShowInViewEnum.ShowAll)
                        {
                            funcCol.Add(func);
                        }
                        else if (func.FuncIsShowInView == CPFormEnum.FuncIsShowInViewEnum.OnlyWriteShow)
                        {
                            if (IsView == false)
                            {
                                funcCol.Add(func);
                            }
                        }
                        else if (func.FuncIsShowInView == CPFormEnum.FuncIsShowInViewEnum.OnlyReadShow)
                        {
                            if (IsView == true)
                            {
                                funcCol.Add(func);
                            }
                        }
                    });
                    #region 添加修改配置按钮
                    if (re.Form.SysId.HasValue && re.Form.SysId.Value.Equals(CPAppContext.InnerSysId) == false)
                    {
                        string UserAdminSysIds = CPExpressionHelper.Instance.RunCompile("${CPUser.UserAdminSysIds()}");
                        if (UserAdminSysIds.Split(',').ToList().Contains(re.Form.SysId.ToString()))
                        {
                            CPFormUseSceneFunc func1 = new CPFormUseSceneFunc();
                            func1.FuncTitle          = "修改配置";
                            func1.ShowOrder          = 999999;
                            func1.FuncIcon           = "icon-shezhi1";
                            func1.IsControlByRight   = false;
                            func1.FuncIsShowInView   = CPFormEnum.FuncIsShowInViewEnum.ShowAll;
                            func1.FuncExeJS          = "CPFormUpdateConfig(" + re.Form.Id + ")";
                            func1.SceneID            = t.Id;
                            funcCol.Add(func1);
                        }
                    }
                    #endregion
                    t.FuncCol = funcCol;
                    t.FuncCol = t.FuncCol.OrderBy(c => c.ShowOrder).ToList();
                });

                //读取真实数据
                re.FormDataJSON = CPFormEngine.Instance(CurUserId).GetFormDataJSON(form, form.ChildTableCol,
                                                                                   form.FieldCol, re.Form.FieldInitCol, PKValues, re.Form.UseSceneCol[0]);
                re.Result = true;
                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #20
0
        public GetGridDataReturn GetGridData(string GridCode, int CurUserId, string CurUserIden,
                                             int page, int pageSize, string OtherCondition)
        {
            base.SetHeader();
            GridCode    = CPAppContext.FormatSqlPara(GridCode);
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            //OtherCondition = CPAppContext.FormatSqlPara(OtherCondition);
            if (OtherCondition != null)
            {
                OtherCondition = System.Web.HttpUtility.UrlDecode(OtherCondition);
                OtherCondition = OtherCondition.Replace("@", "%");
            }
            GetGridDataReturn re = new GetGridDataReturn();

            try
            {
                CPGrid Grid    = CPGridEngine.Instance(CurUserId).GetGrid(GridCode, true, true);
                string orderBy = "";
                #region 获取排序字段
                List <string> querys     = CPAppContext.GetHttpContext().Request.Query.Keys.Where(t => t.StartsWith("sort[")).ToList();
                var           queryCount = querys.Count(m => m.EndsWith("[field]"));
                for (int i = 0; i < queryCount; i++)
                {
                    //请查询字段和对应的值存储在一个字典中
                    string field = CPAppContext.QueryString <string>("sort[" + i + "][field]");
                    field = field.Replace("Column", "");
                    List <CPGridColumn> colTmp = Grid.ColumnCol.Where(c => c.Id.Equals(int.Parse(field))).ToList();
                    if (colTmp.Count > 0)
                    {
                        field = colTmp[0].FieldName;
                    }
                    string fieldValue = CPAppContext.QueryString <string>("sort[" + i + "][dir]");
                    if (string.IsNullOrEmpty(orderBy))
                    {
                        orderBy = field + " " + fieldValue;
                    }
                    else
                    {
                        orderBy += "," + field + " " + fieldValue;
                    }
                }
                #endregion


                if (this.CheckUserIden(CurUserId, CurUserIden) == false)
                {
                    re.Result   = false;
                    re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                    return(re);
                }

                try
                {
                    int       recordSize = 0;
                    DataTable dt         = CPGridEngine.Instance(CurUserId).ReadDataAndFormat(Grid, page, pageSize, OtherCondition, orderBy, out recordSize);
                    re.RecordSize = recordSize;
                    re.DataJson   = CPUtils.DataTable2Json(dt);
                    re.Result     = true;
                }
                catch (Exception ex)
                {
                    re.Result   = false;
                    re.ErrorMsg = ex.Message.ToString();
                }

                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }
Пример #21
0
        public GetGridInfoReturn GetGridInfo(string GridCode, string OtherCondition, int CurUserId, string CurUserIden)
        {
            base.SetHeader();
            GridCode    = CPAppContext.FormatSqlPara(GridCode);
            CurUserIden = CPAppContext.FormatSqlPara(CurUserIden);
            if (OtherCondition != null)
            {
                OtherCondition = System.Web.HttpUtility.UrlDecode(OtherCondition);
                OtherCondition = OtherCondition.Replace("@", "%");
            }
            GetGridInfoReturn re = new GetGridInfoReturn();

            if (this.CheckUserIden(CurUserId, CurUserIden) == false)
            {
                re.Result   = false;
                re.ErrorMsg = "系统检测到非法获取数据,请传入正确的用户会话Key与用户Id参数!";
                return(re);
            }
            try
            {
                CPGrid Grid = CPGridEngine.Instance(CurUserId).GetGrid(GridCode, true, true);

                #region 处理列表列有统计值时,计算统计值结果
                CPGridEngine.Instance(CurUserId).StatisticsColumnSum(Grid, OtherCondition);
                #endregion

                #region 处理列是否显示
                Grid.ColumnCol.ForEach(t =>
                {
                    if (t.IsUseExpressionShow.Value)
                    {
                        string leftValue  = CPExpressionHelper.Instance.RunCompile(t.LeftExpression);
                        string rightValue = CPExpressionHelper.Instance.RunCompile(t.RightExpression);
                        bool bResult      = false;
                        if (t.ShowMethod == CPGridEnum.ShowMethodEnum.EqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase))
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.NotEqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase) == false)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.GreaterThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft >= dRight)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.GreaterThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft > dRight)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.LessThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft <= dRight)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.LessThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft < dRight)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.Contains)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) != -1)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.DoesNotContain)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) == -1)
                            {
                                bResult = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    bResult = false;
                                }
                                else
                                {
                                    bResult = true;
                                }
                            }
                        }
                        if (bResult == false)
                        {
                            t.IsShow = false;
                        }
                    }
                });
                #endregion
                AutoMapper.Mapper.Initialize(cfg =>
                {
                    cfg.CreateMap <CPGrid, CPGridClient>();
                });
                re.Grid = AutoMapper.Mapper.Map <CPGridClient>(Grid);

                #region 处理按钮
                List <CPGridFunc> tCol = new List <CPGridFunc>();
                re.Grid.FuncCol.ForEach(t =>
                {
                    bool isShow = true;
                    if (t.IsUseExpressionShow.Value)
                    {
                        string leftValue  = CPExpressionHelper.Instance.RunCompile(t.LeftExpression);
                        string rightValue = CPExpressionHelper.Instance.RunCompile(t.RightExpression);

                        if (t.ShowMethod == CPGridEnum.ShowMethodEnum.EqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase))
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.NotEqualTo)
                        {
                            if (leftValue.Equals(rightValue, StringComparison.CurrentCultureIgnoreCase) == false)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.GreaterThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft >= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.GreaterThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft > dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.LessThanOrEqualTo)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft <= dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.LessThan)
                        {
                            double dLeft  = 0;
                            double dRight = 0;
                            try
                            {
                                dLeft = Convert.ToDouble(leftValue);
                            }
                            catch (Exception ex) { }
                            try
                            {
                                dRight = Convert.ToDouble(rightValue);
                            }
                            catch (Exception ex) { }
                            if (dLeft < dRight)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.Contains)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) != -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                        else if (t.ShowMethod == CPGridEnum.ShowMethodEnum.DoesNotContain)
                        {
                            if (leftValue.IndexOf(rightValue, StringComparison.CurrentCultureIgnoreCase) == -1)
                            {
                                isShow = t.IsShowByExpression.Value;
                            }
                            else
                            {
                                if (t.IsShowByExpression.Value)
                                {
                                    isShow = false;
                                }
                                else
                                {
                                    isShow = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        isShow = true;
                    }
                    if (isShow)
                    {
                        t.FuncContext = CPExpressionHelper.Instance.RunCompile(t.FuncContext);
                        tCol.Add(t);
                    }
                });
                #region 添加修改配置按钮
                if (re.Grid.SysId.HasValue && re.Grid.SysId.Value.Equals(CPAppContext.InnerSysId) == false)
                {
                    string UserAdminSysIds = CPExpressionHelper.Instance.RunCompile("${CPUser.UserAdminSysIds()}");
                    if (UserAdminSysIds.Split(',').ToList().Contains(re.Grid.SysId.ToString()))
                    {
                        CPGridFunc func1 = new CPGridFunc();
                        func1.FuncTitle           = "修改配置";
                        func1.FuncOrder           = 999999;
                        func1.FuncType            = CPGridEnum.FuncTypeEnum.ExecuteJs;
                        func1.FuncOpenWinTitle    = func1.FuncTitle;
                        func1.FuncIcon            = "icon-shezhi1";
                        func1.IsUseExpressionShow = false;
                        func1.OpenWinHeight       = 768;
                        func1.OpenWinWidth        = 1024;
                        func1.FuncContext         = "CPGridUpdateConfig(" + re.Grid.Id + ")";
                        tCol.Add(func1);
                    }
                }
                #endregion
                re.Grid.FuncCol = tCol;
                #endregion

                #region 处理多表头
                re.Grid.HeaderGroup = new List <GetGridInfoHeaderGroup>();
                List <string> addedHeader = new List <string>();
                re.Grid.ColumnCol.ForEach(t =>
                {
                    if (addedHeader.Contains(t.ColumnTitleGroup1) == false)
                    {
                        GetGridInfoHeaderGroup group1 = new GetGridInfoHeaderGroup();
                        group1.GroupTitle             = t.ColumnTitleGroup1;
                        group1.ChildColumnId          = new List <int>();
                        group1.ChildGroupCol          = new List <GetGridInfoHeaderGroup>();
                        #region 找出所有的子列
                        List <CPGridColumn> tmpCol = re.Grid.ColumnCol.Where(c => c.ColumnTitleGroup1.Equals(t.ColumnTitleGroup1)).ToList();
                        if (string.IsNullOrEmpty(t.ColumnTitleGroup1))
                        {
                            tmpCol.ForEach(c =>
                            {
                                group1.ChildColumnId.Add(c.Id);
                            });
                        }
                        else
                        {
                            List <string> added2 = new List <string>();
                            tmpCol.ForEach(c =>
                            {
                                //如果一级不为空,则看看有没有二级子表头
                                if (added2.Contains(c.ColumnTitleGroup2) == false)
                                {
                                    List <CPGridColumn> tmpCol2       = re.Grid.ColumnCol.Where(f => f.ColumnTitleGroup1.Equals(t.ColumnTitleGroup1) && f.ColumnTitleGroup2.Equals(c.ColumnTitleGroup2)).ToList();
                                    GetGridInfoHeaderGroup groupChild = new GetGridInfoHeaderGroup();
                                    groupChild.GroupTitle             = c.ColumnTitleGroup2;
                                    groupChild.ChildColumnId          = new List <int>();
                                    groupChild.ChildGroupCol          = new List <GetGridInfoHeaderGroup>();
                                    tmpCol2.ForEach(f =>
                                    {
                                        groupChild.ChildColumnId.Add(f.Id);
                                    });
                                    added2.Add(c.ColumnTitleGroup2);
                                    group1.ChildGroupCol.Add(groupChild);
                                }
                            });
                        }
                        #endregion
                        re.Grid.HeaderGroup.Add(group1);
                        addedHeader.Add(t.ColumnTitleGroup1);
                    }
                });
                #endregion
                re.Result = true;
                #region 处理编辑列表,下拉 列表数据源
                re.ListDataJson = "";
                try
                {
                    re.ListDataJson = JsonConvert.SerializeObject(CPGridEngine.Instance(CurUserId).ReadListDataAndFormat(re.Grid));
                }
                catch (Exception ex)
                {
                    re.Result   = false;
                    re.ErrorMsg = ex.Message;
                }
                #endregion

                return(re);
            }
            catch (Exception ex)
            {
                re.Result   = false;
                re.ErrorMsg = ex.Message.ToString();
                return(re);
            }
        }