コード例 #1
0
ファイル: HKService.ashx.cs プロジェクト: sundysj/Hongkun
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                Common.Transfer Trans   = new Common.Transfer();
                HttpRequest     Request = context.Request;

                Trans.Class   = "HKParkCostInfo";
                Trans.Command = "TempPayFees";
                //获取content内容
                System.IO.Stream s = System.Web.HttpContext.Current.Request.InputStream;
                byte[]           b = new byte[s.Length];
                s.Read(b, 0, (int)s.Length);
                string ContentStr = System.Text.Encoding.UTF8.GetString(b);
                if (ContentStr != "")
                {
                    Trans.Attribute = ContentStr;
                }
                PubContext.Operate(ref Trans);

                context.Response.Write(Trans.Output());
            }
            catch (Exception ex)
            {
                context.Response.Write(new ApiResult(false, ex.Message + Environment.NewLine + ex.StackTrace).toJson());
            }
        }
コード例 #2
0
        private void RecordOperationLog(Transfer transNew1)
        {
            Common.Transfer tranNew2 = new Transfer()
            {
                Result     = transNew1.Result,
                Attribute  = transNew1.Attribute,
                Command    = transNew1.Command,
                Class      = transNew1.Class,
                Mac        = transNew1.Mac,
                QYID       = transNew1.QYID,
                QYUnitType = transNew1.QYUnitType,
                ClassLog   = transNew1.Class,
                CommandLog = transNew1.Command
            };

            tranNew2.Class   = "RecordClientInfo";
            tranNew2.Command = "RecordOperationLog";
            var HashString = tranNew2.Attribute.ToString() + DateTime.Now.ToString("yyyyMMdd") + "20200110Client";

            tranNew2.Mac = AppPKI.getMd5Hash(HashString);

            PubContext.Operate(ref tranNew2);
        }
コード例 #3
0
ファイル: JHService.ashx.cs プロジェクト: sundysj/Hongkun
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            try
            {
                Common.Transfer Trans = new Common.Transfer();

                HttpRequest Request = context.Request;
                if (!Request.Params.AllKeys.Contains("Class"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Class").toJson());
                    return;
                }
                Trans.Class = Request["Class"].ToString();
                if (string.IsNullOrEmpty(Trans.Class))
                {
                    context.Response.Write(new ApiResult(false, "Class不能为空").toJson());
                    return;
                }
                if (!Request.Params.AllKeys.Contains("Command"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Command").toJson());
                    return;
                }
                Trans.Command = Request["Command"].ToString();

                if (string.IsNullOrEmpty(Trans.Command))
                {
                    context.Response.Write(new ApiResult(false, "Command不能为空").toJson());
                    return;
                }

                if (!Request.Params.AllKeys.Contains("Mac"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Mac").toJson());
                    return;
                }
                Trans.Mac = Request["Mac"].ToString();
                if (string.IsNullOrEmpty(Trans.Mac))
                {
                    context.Response.Write(new ApiResult(false, "Mac不能为空").toJson());
                    return;
                }
                //获取content内容
                System.IO.Stream s = System.Web.HttpContext.Current.Request.InputStream;
                byte[]           b = new byte[s.Length];
                s.Read(b, 0, (int)s.Length);
                string ContentStr = System.Text.Encoding.UTF8.GetString(b);
                if (ContentStr != "")
                {
                    Trans.Agreement = ContentStr;
                }
                PubContext.Operate(ref Trans);

                Compress(context);
                context.Response.Write(Trans.Output());
            }
            catch (Exception ex)
            {
                context.Response.Write(new ApiResult(false, ex.Message + Environment.NewLine + ex.StackTrace).toJson());
            }
        }
コード例 #4
0
ファイル: Api.ashx.cs プロジェクト: sundysj/Hongkun
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            try
            {
                Common.Transfer Trans = new Common.Transfer();

                HttpRequest Request = context.Request;
                Dictionary <string, string> param = new Dictionary <string, string>();
                foreach (string key in Request.Form.AllKeys)
                {
                    param.Add(key, Request.Params[key]);
                }
                if (!param.ContainsKey("Class"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Class").toJson());
                    return;
                }
                Trans.Class = param["Class"].ToString();
                if (string.IsNullOrEmpty(Trans.Class))
                {
                    context.Response.Write(new ApiResult(false, "Class不能为空").toJson());
                    return;
                }
                if (!param.ContainsKey("Command"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Command").toJson());
                    return;
                }
                Trans.Command = param["Command"].ToString();

                if (string.IsNullOrEmpty(Trans.Command))
                {
                    context.Response.Write(new ApiResult(false, "Command不能为空").toJson());
                    return;
                }

                string json = JsonConvert.SerializeObject(new { Attribute = param });
                Trans.Attribute = JsonConvert.DeserializeXmlNode(json).OuterXml;
                if (string.IsNullOrEmpty(Trans.Attribute))
                {
                    context.Response.Write(new ApiResult(false, "Attribute不能为空").toJson());
                    return;
                }
                PubInfo Rp         = (PubInfo)Assembly.Load("Business").CreateInstance("Business." + Trans.Class);
                var     HashString = Trans.Attribute.ToString() + DateTime.Now.ToString("yyyyMMdd") + Rp.Token;
                var     Mac        = AppPKI.getMd5Hash(HashString);
                Trans.Mac = Mac;
                if (Trans.Class == "Files")
                {
                    new Files().ProcessRequest(context);
                }
                else
                {
                    PubContext.Operate(ref Trans);
                }

                Compress(context);
                context.Response.Write(Trans.Output());
            }
            catch (Exception ex)
            {
                context.Response.Write(new ApiResult(false, ex.Message + Environment.NewLine + ex.StackTrace).toJson());
            }
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            try
            {
                Common.Transfer Trans = new Common.Transfer();

                HttpRequest Request = context.Request;
                if (!Request.Params.AllKeys.Contains("Class"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Class").toJson());
                    return;
                }

                //获取要执行的类名称
                Trans.Class = Request["Class"].ToString();
                if (string.IsNullOrEmpty(Trans.Class))
                {
                    context.Response.Write(new ApiResult(false, "Class不能为空").toJson());
                    return;
                }
                if (!Request.Params.AllKeys.Contains("Command"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Command").toJson());
                    return;
                }

                //wlg 20191204 没有地方使用???
                if (Request["QYID"] != null)
                {
                    Trans.QYID = Request["QYID"].ToString();
                }

                //wlg 20191204 没有地方使用???
                if (Request["QYUnitType"] != null)
                {
                    Trans.QYUnitType = Request["QYUnitType"].ToString();
                }

                //获取命令类型
                Trans.Command = Request["Command"].ToString();

                if (string.IsNullOrEmpty(Trans.Command))
                {
                    context.Response.Write(new ApiResult(false, "Command不能为空").toJson());
                    return;
                }
                if (Request.Params.AllKeys.Contains("Agreement"))
                {
                    Trans.Agreement = HttpUtility.UrlDecode(Request["Agreement"].ToString());//碧桂园 获取协议html代码
                }

                //获取属性xml格式字符串
                if (!Request.Params.AllKeys.Contains("Attribute"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Attribute").toJson());
                    return;
                }
                Trans.Attribute = HttpUtility.UrlDecode(Request["Attribute"].ToString());
                if (string.IsNullOrEmpty(Trans.Attribute))
                {
                    context.Response.Write(new ApiResult(false, "Attribute不能为空").toJson());
                    return;
                }

                if (!Request.Params.AllKeys.Contains("Mac"))
                {
                    context.Response.Write(new ApiResult(false, "缺少参数Mac").toJson());
                    return;
                }
                Trans.Mac = Request["Mac"].ToString();
                if (string.IsNullOrEmpty(Trans.Mac))
                {
                    context.Response.Write(new ApiResult(false, "Mac不能为空").toJson());
                    return;
                }


                //如果是文件类型
                if (Trans.Class == "Files")
                {
                    new Files().ProcessRequest(context);
                }
                else
                {
                    //wlg 20200110 增加操作日志记录
                    Common.Transfer tranNew = new Transfer()
                    {
                        Result     = Trans.Result,
                        Attribute  = Trans.Attribute,
                        Command    = Trans.Command,
                        Class      = Trans.Class,
                        Mac        = Trans.Mac,
                        QYID       = Trans.QYID,
                        QYUnitType = Trans.QYUnitType
                    };
                    RecordOperationLog(tranNew);

                    PubContext.Operate(ref Trans);
                }

                Compress(context);
                context.Response.Write(Trans.Output());
            }
            catch (Exception ex)
            {
                context.Response.Write(new ApiResult(false, ex.Message + Environment.NewLine + ex.StackTrace).toJson());
            }
        }