Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BaseKeyWordValue            = Request["BaseKeyWordValue"] == null ? "" : Request["BaseKeyWordValue"];
        HideQueryBox                = Request["HideQueryBox"] == null ? "" : Request["HideQueryBox"];
        ReportKey                   = Request["argReportKey"] == null ? "" : Request["argReportKey"];
        BaseResid                   = Request["BaseResid"] == null ? "" : Request["BaseResid"];
        SearchTitle                 = Request["SearchTitle"] == null ? "" : Request["SearchTitle"];
        IsDynamicallyCreatTableHead = Request["IsDynamicallyCreatTableHead"] == null ? "" : Request["IsDynamicallyCreatTableHead"];

        string vCommonSearchField = CommonGetInfo.GetALLCommonSearchField(BaseResid, ReportKey, "", IsDynamicallyCreatTableHead, true, false, true).Split(new string[] { "[#]" }, StringSplitOptions.RemoveEmptyEntries)[0];

        if (!string.IsNullOrWhiteSpace(vCommonSearchField))
        {
            CommonSearchField = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ReadDataColumnSet> >(vCommonSearchField);
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserID   = this.CurrentUser.ID;
        UserName = this.CurrentUser.Name;
        string Condition = "";
        string json      = "";
        string typeValue = Request["typeValue"];

        int PageSize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
        int PageNumber = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);


        if (typeValue == "GetDataByType")
        {
            string ByType = Request["ByType"] == null ? "" : Request["ByType"].ToString();

            if (ByType == "0")
            {
                typeValue = "CommonGetDataByProc";
            }
            else
            {
                typeValue = "GetDataByUserDefinedSql";
            }
        }

        switch (typeValue)
        {
        case "GetDataByUserDefinedSql":
        {
            string            ResID            = "";
            string            SortField        = "";
            string            SortBy           = "";
            string            QueryKeystr      = "";
            string            ROW_NUMBER_ORDER = "";
            bool              NoPaging         = false;
            List <ReportFoot> vReportFoots     = null;

            if (!string.IsNullOrEmpty(Request["ReportFoot"]))
            {
                string s = Request["ReportFoot"].ToString();
                vReportFoots = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ReportFoot> >(s);
            }

            if (!string.IsNullOrEmpty(Request["Condition"]))
            {
                Condition = Request["Condition"].ToString();
            }

            QueryKeystr = Request["QueryKeystr"] == null ? "" : Request["QueryKeystr"].ToString();

            if (!string.IsNullOrWhiteSpace(QueryKeystr))
            {
                if (QueryKeystr.Substring(0, 4).ToLower().Trim() == "and")
                {
                    Condition = Condition + QueryKeystr;
                }
                else
                {
                    Condition = Condition + " and " + QueryKeystr;
                }
            }

            if (!string.IsNullOrEmpty(Request["page"]))
            {
                PageNumber = Convert.ToInt32(Request["page"]);
            }
            if (Request["sort"] != null)
            {
                SortField = Request["sort"].ToString();
            }
            if (Request["order"] != null)
            {
                SortBy = Request["order"].ToString();
            }
            if (Request["ROW_NUMBER_ORDER"] != null)
            {
                ROW_NUMBER_ORDER = Request["ROW_NUMBER_ORDER"].ToString();
            }
            if (Request["NoPaging"] != null)
            {
                NoPaging = true;
            }
            if (Request["UserDefinedSql"] != null)
            {
                ResID = Request["UserDefinedSql"].ToString().Trim();
            }
            json = CommonGetInfo.GetDataByUserDefinedSql(ResID, PageNumber, PageSize, SortField, SortBy, UserID, Condition, ROW_NUMBER_ORDER, NoPaging, vReportFoots, false);
            break;
        }

        case "GetALLCommonSearchField":
        {
            string argResourcesId = Request["argResourcesId"] == null ? "" : Request["argResourcesId"].ToString();
            string argSearchType  = Request["argSearchType"] == null ? "" : Request["argSearchType"].ToString();
            string argReportKey   = Request["argReportKey"] == null ? "" : Request["argReportKey"].ToString();

            string argIsDynamicallyCreatTableHead = Request["argIsDynamicallyCreatTableHead"] == null ? "" : Request["argIsDynamicallyCreatTableHead"].ToString();
            json = CommonGetInfo.GetALLCommonSearchField(argResourcesId, argReportKey, argSearchType, argIsDynamicallyCreatTableHead);
        }
        break;

        case "GetDictionaryReturnRelatedColumn":
            Services  oServices      = new Services();
            string    ResourceID     = Request["ResourceID"];
            string    ResourceColumn = Request["ResourceColumn"];
            DataTable dt             = oServices.GetDictionaryReturnRelatedColumn(ResourceID, ResourceColumn).Tables[0];
            json = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
            break;

        case "GetDictionaryReturnColumn":
            oServices      = new Services();
            ResourceID     = Request["ResourceID"];
            ResourceColumn = Request["ResourceColumn"];
            bool IsMultiselect = Convert.ToBoolean(Convert.ToInt32(Request["IsMultiselect"]));
            dt = oServices.GetDictionaryReturnColumn(ResourceID, ResourceColumn);
            string gridField   = "";
            string searchField = "";
            // string DicResourceID = "";
            string str = "";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                if (DbField.GetInt(ref dr, "DataType") == 9)
                {
                    string strEnable = "s='<input type=\"checkbox\" name=\"ch_IsEnable\" value=\"_blank\" id=\"ch_IsEnable\" disabled=\"true\"  '+(row." + DbField.GetStr(ref dr, "CD_DISPNAME") + "==\"1\"?\"Checked\":\"\")+' />';";
                    gridField += ",{field: '" + DbField.GetStr(ref dr, "CD_DISPNAME") + "',title:'" + DbField.GetStr(ref dr, "CD_DISPNAME") + "',width:100, sortable:true ,align:'center',formatter: function (value, row, index) {" + strEnable + " return s;}}";
                }
                else
                {
                    gridField += ",{field: '" + DbField.GetStr(ref dr, "CD_DISPNAME") + "',title:'" + DbField.GetStr(ref dr, "CD_DISPNAME") + "',width:100, sortable:true ,align:'center'}";
                }

                searchField += ",{field:'" + DbField.GetStr(ref dr, "CD_DISPNAME") + "'}";
            }

            dt = oServices.GetDictionaryReturnRelatedColumn(ResourceID, ResourceColumn).Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                if (!IsMultiselect)
                {
                    str += "," + DbField.GetStr(ref dr, "ResColCNName") + ":\"'+rowData." + DbField.GetStr(ref dr, "DicColCNName") + "+'\"";
                }
                else
                {
                    str += "," + DbField.GetStr(ref dr, "ResColCNName") + ":" + DbField.GetStr(ref dr, "DicColCNName") + "";
                }
            }
            if (!IsMultiselect)
            {
                gridField = "{title:'选择',field:'选择',width:50,align:'center' ,formatter:function(value,rowData,rowIndex){return '<a href=\"javascript:\" onclick=SelectOneRow({" + str.Substring(1) + "})>选择</a>';}}" + gridField;
            }
            else
            {
                gridField = "{field: 'ID',title:'',checkbox:true,width:30, sortable:false ,align:'center'}" + gridField;
            }
            if (gridField.Trim() != "")
            {
                gridField = "[[" + gridField + "]]";
            }
            if (searchField.Trim() != "")
            {
                searchField = "[#][" + searchField.Substring(1) + "]";
            }
            json = gridField + searchField;
            break;

        case "GetDictionaryList":
            oServices      = new Services();
            ResourceID     = Request["ResourceID"];
            ResourceColumn = Server.UrlDecode(Request["ResourceColumn"]);
            if (Request["Condition"] != null)
            {
                Condition = Server.UrlDecode(Request["Condition"]);
            }


            string        DicResourceID = oServices.GetDictionaryReturnResourceID(ResourceID, ResourceColumn);
            PageParameter p             = new PageParameter();
            p.PageIndex = PageNumber - 1;
            p.PageSize  = PageSize;
            p.SortField = "ID";
            p.SortBy    = "";
            DataSet ds       = oServices.GetPageOfDataList(Convert.ToInt64(DicResourceID), CommonMethod.FilterSql(Condition), p, "test");
            string  RowCount = oServices.GetDataListRecordCount(Convert.ToInt64(DicResourceID), UserID, CommonMethod.FilterSql(Condition)).ToString();
            json = "{\"total\":" + RowCount + ",\"rows\":" + Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0]) + "}";
            break;

        case "GetDataOfReportOfDynamicHeadReportColumnStrBySqlStr":
        {
            string ByType = Request["ByType"] == null ? "" : Request["ByType"].ToString();
            string filterRulesByHeadStr = "";
            string frozenColumnsJson    = "";
            string DynamicHeadReportStr = Request["DynamicHeadReportStr"];

            if (ByType == "0")
            {
                string    ProcName        = Request["ProcName"] == null ? "" : Request["ProcName"].ToString();
                string    ProcOutPutCount = Request["ProcOutPutCount"] == null ? "" : Request["ProcOutPutCount"].ToString();
                string    ProcInPutStr    = Request["ProcInPutStr"] == null ? "" : Request["ProcInPutStr"].ToString();
                DataTable vDT             = new DataTable();
                json = CommonGetDataByProc(CommonGetInfo.GetUser(), ProcOutPutCount, ProcInPutStr, ProcName, "", PageSize.ToString(), PageNumber.ToString(), "", "", "", "", out vDT, false, null, true);
            }
            else
            {
                string UserDefinedSql = Request["UserDefinedSql"] == null ? "" : Request["UserDefinedSql"].ToString();
                string SortField      = Request["sort"] == null ? "" : Request["sort"].ToString();
                string SortBy         = Request["order"] == null ? "" : Request["order"].ToString();
                Condition = Request["Condition"] == null ? "" : Request["Condition"].ToString();
                string            ROW_NUMBER_ORDER = Request["ROW_NUMBER_ORDER"].ToString();
                bool              NoPaging         = Request["NoPaging"] == null ? false : true;
                bool              IsExport         = Request["IsExport"] == null ? false : true;;
                List <ReportFoot> vReportFoots     = null;
                if (!string.IsNullOrEmpty(Request["ReportFoot"]))
                {
                    string s = Request["ReportFoot"].ToString();
                    vReportFoots = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ReportFoot> >(s);
                }
                json = CommonGetInfo.GetDataByUserDefinedSql(UserDefinedSql, PageNumber, PageSize, SortField, SortBy, UserID, "", ROW_NUMBER_ORDER, NoPaging, vReportFoots, IsExport, Condition.Trim());
            }
            json = CommonGetInfo.GetColumnsJson(null, out filterRulesByHeadStr, out frozenColumnsJson, json, DynamicHeadReportStr) + "#" + filterRulesByHeadStr + "#" + frozenColumnsJson;
        }
        break;

        case "CommonGetUserDefinedToolBars":
        {
            string keyWordValue      = Request["keyWordValue"] == null ? "" : Request["keyWordValue"].ToString();
            string argToolBarType    = Request["argToolBarType"] == null ? "" : Request["argToolBarType"].ToString();
            bool   argIsUseNewEasyui = Request["argIsUseNewEasyui"] == null ? true : (Request["argIsUseNewEasyui"].ToString() == "1" ? true : false);
            string DelNameStr        = "";
            json  = "^" + CommonGetInfo.CommonGetUserDefinedToolBars(keyWordValue, out DelNameStr, argToolBarType, argIsUseNewEasyui) + "^";
            json += "***" + DelNameStr;
        }
        break;

        case "CommonGetDataByProc":
        {
            string ProcName        = Request["ProcName"] == null ? "" : Request["ProcName"].ToString();
            string ProcOutPutCount = Request["ProcOutPutCount"] == null ? "" : Request["ProcOutPutCount"].ToString();
            string ProcInPutStr    = Request["ProcInPutStr"] == null ? "" : Request["ProcInPutStr"].ToString();

            string SortField = Request["sort"] == null ? "" : Request["sort"].ToString();
            string SortBy    = Request["order"] == null ? "" : Request["order"].ToString();

            bool IsExport = Request["IsExport"] == null ? false : true;

            DataTable vDT = new DataTable();
            json = CommonGetDataByProc(CommonGetInfo.GetUser(), ProcOutPutCount, ProcInPutStr, ProcName, "", PageSize.ToString(), PageNumber.ToString(), "1", "", SortField, SortBy, out vDT, false, null, IsExport);
            break;
        }

        default:
            break;
        }
        Response.Write(json);
    }