コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            paramsContainer = new ParamsContainer(context, nullTenantResponse: true);
            if (!paramsContainer.ApplicationID.HasValue)
            {
                return;
            }

            string responseText = string.Empty;

            string command = PublicMethods.parse_string(context.Request.Params["Command"], false);

            switch (command)
            {
            case "GetReport":
                string reportName = PublicMethods.parse_string(context.Request.Params["ReportName"], false);

                ModuleIdentifier?moduleIdentifier = null;
                try { moduleIdentifier = (ModuleIdentifier)Enum.Parse(typeof(ModuleIdentifier), context.Request.Params["ModuleIdentifier"]); }
                catch { moduleIdentifier = null; }

                bool excel     = string.IsNullOrEmpty(context.Request.Params["Excel"]) ? false : context.Request.Params["Excel"].ToLower() == "true";
                bool rtl       = string.IsNullOrEmpty(context.Request.Params["RTL"]) ? false : context.Request.Params["RTL"].ToLower() == "true";
                bool isPersian = string.IsNullOrEmpty(context.Request.Params["Lang"]) ? false : context.Request.Params["Lang"].ToLower() == "fa";

                List <string> paramsList = ListMaker.get_string_items(context.Request.Params["ParamsOrder"], '|');

                List <ReportParameter> parameters = new List <ReportParameter>();

                parameters.Add(ReportUtilities.get_parameter("CurrentUserID", "Guid", paramsContainer.CurrentUserID.ToString()));

                for (int i = 0; i < paramsList.Count; ++i)
                {
                    string[] item       = paramsList[i].Split(':');
                    string   paramName  = item[0];
                    string   paramType  = item[1];
                    string   paramValue = context.Request.Params[paramName];

                    parameters.Add(ReportUtilities.get_parameter(paramName, paramType, paramValue));
                }

                Dictionary <string, string> dictionary = _get_dictionary("Dictionary");

                int pageNumber = string.IsNullOrEmpty(context.Request.Params["PageNumber"]) ? 1 : int.Parse(context.Request.Params["PageNumber"]);
                int pageSize   = string.IsNullOrEmpty(context.Request.Params["PageSize"]) ? 100 : int.Parse(context.Request.Params["PageSize"]);

                if (!string.IsNullOrEmpty(reportName) && moduleIdentifier.HasValue)
                {
                    get_report(moduleIdentifier.Value, reportName, excel, rtl, isPersian, ref dictionary,
                               pageNumber, pageSize, ref responseText, parameters,
                               PublicMethods.parse_string(context.Request.Params["PS"]));
                }
                _return_response(ref responseText);
                return;
            }

            paramsContainer.return_response(PublicConsts.BadRequestResponse);
        }