Beispiel #1
0
        public ActionResult Data(string funcName)
        {
            var sysfun = RequestFunctions.GetItem(funcName);

            if (sysfun == null)
            {
                throw LangTexts.Current.GetFormatLangText("9001", "请求系统方法[{0}] 未定义!", funcName).CreateException();
            }

            var paras    = new Dictionary <string, string>();
            var type     = Request.QueryString["type"];
            var encoding = Request.QueryString["encoding"];

            foreach (var q in Request.QueryString.AllKeys
                     .Where(k => !(k.Equals("encoding", StringComparison.OrdinalIgnoreCase) ||
                                   k.Equals("type", StringComparison.OrdinalIgnoreCase))))
            {
                paras.Add(q, Request.QueryString[q]);
            }

            var result = new ContentResult
            {
                Content         = sysfun.Func(paras),
                ContentEncoding = string.IsNullOrEmpty(encoding)?
                                  string.IsNullOrEmpty(sysfun.Encoding) ? Encoding.UTF8 : Encoding.GetEncoding(sysfun.Encoding):
                                  Encoding.GetEncoding(encoding),
                ContentType = string.IsNullOrEmpty(type)?
                              string.IsNullOrEmpty(sysfun.ContentType) ? "applicaton/json" : sysfun.ContentType:
                              type.Equals("html", StringComparison.OrdinalIgnoreCase)?"text/html":
                              type.Equals("json", StringComparison.OrdinalIgnoreCase)?"application/json":
                              "appliation/json"
            };

            return(result);
        }
 protected void btnSubmit_Request_Click(object sender, EventArgs e)
 {
     RequestFunctions.submitRequest(rbRepairType1, rbRepairType2, carMakeDropdown);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionFunctions.checkRequestsSubmittedToday(SessionFunctions.getRequestsSubmittedToday());
     RequestFunctions.loadFormData(lblCustomerName, lblCurrentDate, rbRepairType1, rbRepairType2, carMakeDropdown);
 }