Exemplo n.º 1
0
        public override void OnException(ExceptionContext filterContext)
        {
            //1.0 获取最底层的异常
            Exception innerExp = filterContext.Exception.InnerException != null ? filterContext.Exception.InnerException : filterContext.Exception;

            while (innerExp.InnerException != null)
            {
                innerExp = innerExp.InnerException;
            }

            //2.0 将详细的堆栈信息存入到文本日志(数据表) ,Log4Net.dll
            //千万不要用  System.IO.File.AppendAllText(); 因为会产生多线程并发问题
            LogHelp.WriteLog(typeof(Exception), innerExp);
            //3.0 区分是否为ajax请求
            if (filterContext.HttpContext.Request.IsAjaxRequest()) //表示是一个ajax请求
            {
                //返回:{status:1,msg:}
                JsonResult json = new JsonResult();
                json.Data = new { status = 1, msg = innerExp.Message };
                json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                filterContext.Result     = json;
                //告诉MVC框架我已经处理完毕,你不需要再跳转到统一出错页面
                filterContext.ExceptionHandled = true;
            }
            else
            {
                filterContext.ExceptionHandled = false;//web.config配置错误页面
            }
        }
Exemplo n.º 2
0
        private void btnSync_Click(object sender, EventArgs e)
        {
            try
            {
                OperDicDal.DelOperDic(DateTime.Now);
                DB2help db2 = new DB2help();
                var     dt  = db2.GetHisOperNameAll("");
                foreach (DataRow dr in dt.Rows)
                {
                    //LogHelp.WriteLog(dr["ITEMNAME"].ToString(),
                    //   dr["ITEMID"].ToString(),
                    //   dr["SSDJ"].ToString(),
                    //   dr["SSQK"].ToString(),
                    //   dr["INPUTSTR"].ToString());
                    //ITEMID 编码, ITEMNAME 手术名称,SSDJ 手术等级,SSQK 手术切口,INPUTSTR
                    var res = OperDicDal.InsertOperDic(
                        dr["ITEMNAME"].ToString(),
                        dr["ITEMID"].ToString(),
                        dr["SSDJ"].ToString(),
                        dr["SSQK"].ToString(),
                        dr["INPUTSTR"].ToString()
                        );
                }

                BindDatasource();
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog(ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 用户提交意见
        /// </summary>
        /// <param name="apiSuggestionModel"></param>
        /// <returns></returns>
        public object AddSuggestion([FromBody] ApiSuggestionModel apiSuggestionModel)
        {
            var            userInfo       = GetCurrentUserInfo();
            UserSuggestion userSuggestion = new UserSuggestion()
            {
                Id         = Guid.NewGuid(),
                Msg        = apiSuggestionModel.Msg,
                UserId     = userInfo.Id,
                CreateTime = DateTime.Now
            };

            try
            {
                SuggestionBusiness.AddItem(userSuggestion);

                return(ApiReturnModel.ReturnOk("提交成功"));
            }

            catch (Exception e)
            {
                //记录日志
                LogHelp.WriteLog(e.Message, ApiFileDirectoryPara.ApiErrorDir);

                return(ApiReturnModel.ReturnError("提交错误"));
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 获取短信验证码
 /// </summary>
 /// <param name="strTel"></param>
 /// <returns></returns>
 public ActionResult getValidSMS(string strTel)
 {
     try
     {
         //List<WxUserEntity> list = null;
         //校验次手机号是否已注册
         var list = new WxUserBC().GetWxUserListByCondition(null, strTel, null, null).ToList();
         if (list.Count > 0)
         {
             return(Json("该手机号已注册", JsonRequestBehavior.AllowGet));
         }
         else
         {
             string yzmCode = CommonHelper.CreateNumber(4, true);
             //Session["RegisterCode"] = new SMSCodes { Code = yzmCode, CreteTime = DateTime.Now, IsUsered = false };
             Session["RegisterCode"] = "1234";
             //SendMessageHelper.SmsSend(strTel, SendMessageHelper.YZMMBContent(yzmCode));
             return(Json("Success", JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         LogHelp.WriteLog("getValidSMS:" + ex.Message);
     }
     return(Json("Error", JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 5
0
        /// <summary>
        /// 课程详情
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="code"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public ActionResult ClassDetail(string code, string state, string classId)
        {
            string openid = "";

            if (new AppSetting().IsDebug != null &&
                new AppSetting().IsDebug.ToLower() == "true")
            {
                openid = "123";
            }
            else
            {
                if (Request.Cookies[SystemConfig.WXOpenIDCookieKey] != null)
                {
                    openid = Request.Cookies[SystemConfig.WXOpenIDCookieKey].Value;
                }

                if (string.IsNullOrWhiteSpace(openid) && code == null)
                {
                    Response.Redirect(CommonHelper.GetRedirect("WxClass%2fClassDetail?classId=" + classId));
                }
                try
                {
                    if (string.IsNullOrWhiteSpace(openid))
                    {
                        LogHelp.WriteLog("code:::" + code);
                        openid = GetOpenId(code).openid;
                        LogHelp.WriteLog("openid:::" + openid);

                        // 合法用户,允许访问
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Value   = openid;
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Path    = "/";
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Expires = DateTime.Now.AddDays(1);
                    }
                }
                catch (Exception ex)
                {
                    LogHelp.WriteLog(DateTime.Now + "ClassDetailError:" + ex.Message);
                }
            }


            var result = new OrderBC().GetOrderByOpenIdandClassId(openid, classId);

            if (result != null)
            {
                ViewBag.OrderStatus = result.Status;
            }
            else
            {
                ViewBag.OrderStatus = 1;
            }

            ViewBag.Openid  = openid;
            ViewBag.ClassId = classId;
            return(View());
        }
Exemplo n.º 6
0
        /// <summary>
        /// 个人中心页面
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(string code, string state)
        {
            string openid = "";

            if (new AppSetting().IsDebug != null &&
                new AppSetting().IsDebug.ToLower() == "true")
            {
                openid = "123";
            }
            else
            {
                if (Request.Cookies[SystemConfig.WXOpenIDCookieKey] != null)
                {
                    openid = Request.Cookies[SystemConfig.WXOpenIDCookieKey].Value;
                }

                if (string.IsNullOrWhiteSpace(openid) && code == null)
                {
                    Response.Redirect(CommonHelper.GetRedirect("WxMy%2fRegistered"));
                }
                try
                {
                    if (string.IsNullOrWhiteSpace(openid))
                    {
                        openid = GetOpenId(code).openid;


                        // 合法用户,允许访问
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Value   = openid;
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Path    = "/";
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Expires = DateTime.Now.AddDays(1);
                    }
                }
                catch (Exception ex)
                {
                    LogHelp.WriteLog(DateTime.Now + "WxMy-Index Error:" + ex.Message);
                }
            }


            //判断是否注册
            var userInfo = new WxUserBC().GetWxUserByOpenid(openid);

            if (string.IsNullOrEmpty(userInfo.Phone))
            {
                Response.Redirect(CommonHelper.GetRedirect("WxMy%2fRegistered"));
            }


            ViewBag.Openid = openid;

            return(View());
        }
Exemplo n.º 7
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);



            LogHelp.WriteLog();
        }
Exemplo n.º 8
0
 /*
  *  调用实例
  *   object[] args = new object[1];
  *    args[0] = planid;
  *    object result = WebservicesHelper.InvokeWebService("http://c-wuxts01:8888/PRM_API/PRM_API.asmx", "Return_PlanData", args);
  *   return (DataSet)result;
  */
 /// < summary>
 /// 动态调用web服务
 /// < /summary>
 /// < param name="url">WSDL服务地址< /param>
 /// < param name="methodname">方法名< /param>
 /// < param name="args">参数< /param>
 /// < returns>< /returns>
 public static object InvokeWebService(string url, string methodname, object[] args)
 {
     try
     {
         return(WebservicesHelper.InvokeWebService(url, null, methodname, args));
     }
     catch (Exception ex)
     {
         LogHelp.WriteLog("InvokeWebService异常,url:" + url + "methodname" + methodname, ex);
         return(null);
     }
 }
Exemplo n.º 9
0
        public WxPayData Refund(WxPayData inputObj, int timeOut = 6)
        {
            string url = "https://api.mch.weixin.qq.com/secapi/pay/refund";

            //检测必填参数
            if (!inputObj.IsSet("out_trade_no") && !inputObj.IsSet("transaction_id"))
            {
                throw new WxPayException("退款申请接口中,out_trade_no、transaction_id至少填一个!");
            }
            else if (!inputObj.IsSet("out_refund_no"))
            {
                throw new WxPayException("退款申请接口中,缺少必填参数out_refund_no!");
            }
            else if (!inputObj.IsSet("total_fee"))
            {
                throw new WxPayException("退款申请接口中,缺少必填参数total_fee!");
            }
            else if (!inputObj.IsSet("refund_fee"))
            {
                throw new WxPayException("退款申请接口中,缺少必填参数refund_fee!");
            }

            inputObj.SetValue("op_user_id", WxPayConfig.MCHID);
            inputObj.SetValue("appid", WxPayConfig.APPID);                              //公众账号ID
            inputObj.SetValue("mch_id", WxPayConfig.MCHID);                             //商户号
            inputObj.SetValue("nonce_str", Guid.NewGuid().ToString().Replace("-", "")); //随机字符串

            inputObj.SetValue("sign", inputObj.MakeSign());                             //签名

            string xml   = inputObj.ToXml();
            var    start = DateTime.Now;

            LogHelp.WriteLog(DateTime.Now + "Refund request:" + xml);
            string response = HttpService.Post(xml, url, true, timeOut);//调用HTTP通信接口提交数据到API

            LogHelp.WriteLog(DateTime.Now + "Refund response:" + response);

            var end      = DateTime.Now;
            int timeCost = (int)((end - start).TotalMilliseconds);//获得接口耗时

            //将xml格式的结果转换为对象以返回
            WxPayData result = new WxPayData();

            result.FromXml(response);



            return(result);
        }
Exemplo n.º 10
0
        private void DataFind()
        {
            try
            {
                int i = 0;
                UpdateStatusFuction(false);

                foreach (DataRow dr in queryTable.Rows)
                {
                    if (dr["keyId1"].ToString() == "")
                    {
                        Guid useId = new Guid();
                        useId = new Guid(dr["UseID"].ToString());


                        SysLog sysLog = new SysLog();
                        sysLog.IsManualAdd = 1;
                        sysLog.Barcode     = dr["Barcode"].ToString();
                        sysLog.LogID       = Guid.NewGuid();
                        sysLog.Operator    = new Guid(dr["OPID"].ToString());
                        sysLog.LogLevel    = 1;
                        sysLog.LogType     = 8;
                        sysLog.LogTime     = Convert.ToDateTime(dr["UseDate"]);
                        sysLog.KeyID1      = new Guid(dr["StorageID"].ToString());
                        sysLog.KeyID2      = new Guid(dr["StorageID"].ToString());
                        sysLog.Content     = dr["ContentMerge"].ToString();
                        sysLog.FlowOrgID   = new Guid(dr["OrgID"].ToString());

                        // OperDicDal.InsertSyslog(sysLog);
                        LogHelp.WriteLog(string.Format("插入包条码为 {0},包ID为 {1} 的使用日志记录", sysLog.Barcode, sysLog.KeyID1));
                        UpDateText(string.Format("插入包条码为 {0},包ID为 {1} 的使用日志记录", sysLog.Barcode, sysLog.KeyID1));
                        //break;
                        i++;
                    }
                }
                LogHelp.WriteLog(string.Format("本次插入{0}条记录", i));

                MessageBox.Show(string.Format("插入使用日志:{0}条记录", i));


                UpdateStatusFuction(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                UpdateStatusFuction(true);
            }
        }
Exemplo n.º 11
0
 public DataSet GetDataSet(string sql)
 {
     try
     {
         SqlConnection  con = new SqlConnection(connStr);
         SqlDataAdapter adp = new SqlDataAdapter(sql, con);
         DataSet        ds  = new DataSet();
         adp.Fill(ds);
         return(ds);
     }
     catch (Exception ex)
     {
         LogHelp.WriteLog(ex.ToString());
         return(null);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 获取砍价页面数据
 /// </summary>
 /// <param name="classId"></param>
 /// <returns></returns>
 public ActionResult GetBargainClass(string bargainId)
 {
     try
     {
         var result = new OrderBC().GetBargainClass(bargainId);
         if (result == null)
         {
             return(Json(new VMBargainClass(), JsonRequestBehavior.AllowGet));
         }
         LogHelp.WriteLog("ClassPrice:::" + result.ClassPrice.ToString());
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new VMBargainClass(), JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 法规资讯页面
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="code"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public ActionResult Laws(string code, string state)
        {
            string openid = "";

            if (new AppSetting().IsDebug != null &&
                new AppSetting().IsDebug.ToLower() == "true")
            {
                openid = "123";
            }
            else
            {
                if (Request.Cookies[SystemConfig.WXOpenIDCookieKey] != null)
                {
                    openid = Request.Cookies[SystemConfig.WXOpenIDCookieKey].Value;
                }

                if (string.IsNullOrWhiteSpace(openid) && code == null)
                {
                    Response.Redirect(CommonHelper.GetRedirect("WxArticle%2fLaws"));
                }
                try
                {
                    if (string.IsNullOrWhiteSpace(openid))
                    {
                        openid = GetOpenId(code).openid;


                        // 合法用户,允许访问
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Value   = openid;
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Path    = "/";
                        Response.Cookies[SystemConfig.WXOpenIDCookieKey].Expires = DateTime.Now.AddDays(1);
                    }
                }
                catch (Exception ex)
                {
                    LogHelp.WriteLog(DateTime.Now + "LawsError:" + ex.Message);
                }
            }



            ViewBag.Openid = openid;

            return(View());
        }
Exemplo n.º 14
0
        //通过code换取网页授权access_token
        public OpenId GetOpenId(string code)
        {
            try
            {
                var client = new RestClient("https://api.weixin.qq.com/sns/oauth2");

                var request = new RestRequest("access_token?appid={appid}&secret={appsecret}&code={code}&grant_type=authorization_code", Method.GET);
                request.AddUrlSegment("appid", _setting.WeiXinAppId);
                request.AddUrlSegment("appsecret", _setting.WeiXinAppSecret);
                request.AddUrlSegment("code", code);
                var response = client.Execute(request);
                var data     = JsonConvert.DeserializeObject <OpenId>(response.Content);

                LogHelp.WriteLog("GetOpenId:::" + data);

                if (data != null)
                {
                    var userInfo = GetUserInfo(data.openid, data.access_token);

                    if (userInfo != null)
                    {
                        WxUserEntity Entry = new WxUserEntity();
                        Entry.Openid       = userInfo.openid;
                        Entry.Nickname     = userInfo.nickname;
                        Entry.Sex          = userInfo.sex;
                        Entry.City         = userInfo.city;
                        Entry.Country      = userInfo.country;
                        Entry.Province     = userInfo.province;
                        Entry.UserLanguage = userInfo.language;
                        Entry.Headimgurl   = userInfo.headimgurl;
                        new WxUserBC().SaveWxUser(Entry, userInfo.openid);
                    }
                }
                return(data ?? new OpenId());
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog(ex.Message);
                return(new OpenId());
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 帮他砍一刀
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="classid"></param>
        /// <returns></returns>
        public ActionResult BargainClass(string ownOpenid, string openid, string classid)
        {
            try
            {
                OrderBC bc     = new OrderBC();
                var     result = "success";
                LogHelp.WriteLog("ownOpenid:::" + ownOpenid + "openid::: " + openid + "classid::: " + classid);
                //获取砍价上下限
                var     config     = bc.GetBargainConfigByClassId(classid);
                var     top        = config.BargainTop;
                var     floor      = config.BargainFloor;
                decimal cutPrce    = Convert.ToDecimal(CommonHelper.GetRandNum(floor * 100, top * 100) * 0.01);
                var     floorPrice = config.FloorPrice;
                //更新最新价格,插入砍价记录表
                var bargainEntity = bc.GetBargainByOpenIdAndClassId(classid, ownOpenid);
                var nowPrice      = bargainEntity.NowPrice;
                if (nowPrice - floorPrice < cutPrce)
                {
                    cutPrce = nowPrice - floorPrice;
                }
                nowPrice = nowPrice - cutPrce;
                bc.UpdateBargainNowPrice(bargainEntity.BargainId, nowPrice);
                BargainLogEntity log = new BargainLogEntity()
                {
                    BargainId    = bargainEntity.BargainId,
                    OpenId       = openid,
                    BargainPrice = cutPrce,
                };
                bc.AddBargainLog(log, openid);

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog(ex.Message);
                return(Json("false", JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 消息达到后交个Biz处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SocketHelper_MessageReviced(object sender, MessageRevicedEventArgs e)
        {
            string sendingApp = AppSettingString.SendingApp;
            string recvApp    = AppSettingString.RecvApp; //System.Configuration.ConfigurationManager.AppSettings["recvApp"];

            try
            {
                DBConn     dbcon  = new DBConn();
                PipeParser parser = new PipeParser();
                //解析出消息类型,创建对应的Biz进行处理
                string message = System.Text.Encoding.UTF8.GetString(e.Contents);
                message = MediII.Common.MLLPHelper.TrimMLLP(message, true, false);
                LogHelp.WriteLog(message);

                ////手术字典
                //if (message.Contains(_AcceptTitleOperDic))
                //{
                //    OperDicModel dic = HL7ToXmlConverter.ToOperDic(message);
                //    dbcon.InsertOperDic(dic);
                //}


                if (message.Contains(_NewOperApply))
                {
                    OTypesetting paiban = null;
                    paiban = HL7ToXmlConverter.toDataBae(message, paiban);
                    if (dbcon.GetPaiban(paiban.PatZhuYuanID) == null)
                    {
                        dbcon.InsertPaiban(paiban);
                    }
                }

                //修改
                else if (message.Contains(_UpdateOperApply))
                {
                    string       zhuyuanid = HL7ToXmlConverter.GetZhuyuanId(message);
                    OTypesetting paiban    = dbcon.GetPaiban(zhuyuanid);
                    paiban = HL7ToXmlConverter.toDataBae(message, paiban);

                    if (paiban != null)
                    {
                        if (paiban.Ostate == 0)
                        {
                            dbcon.UpdatePaiban(paiban);
                        }
                    }
                }

                else if (message.Contains(_CancelOperApply))
                {
                    string zhuyuanid = "";
                    message = message.Replace("ARQ", "\nARQ");
                    string[] sList = message.Split('\n');
                    foreach (string str in sList)
                    {
                        if (str.Contains("ARQ|"))
                        {
                            zhuyuanid = str.Split('|')[1].Replace("^", "");
                        }
                    }
                    dbcon.UpdatePaibanOstate(zhuyuanid, -1);
                }

                //string mesStruct = parser.GetMessageStructure(message).Substring(0, 3);
                string ackMsg = MediII.Common.MessageHelper.SetACK("ACK", "", "", recvApp, recvApp, sendingApp, sendingApp,
                                                                   Guid.NewGuid().ToString("N"));
                LogHelp.WriteLog(ackMsg);
                SocketHelper.SendAck(MediII.Common.MLLPHelper.AddMLLP(ackMsg), e.SocketHandler);
            }
            catch (Exception ex)
            {
                //出现异常需要返回,避免队列堵塞
                string ackMsg = MediII.Common.MessageHelper.SetACK("ACK", "", "", recvApp, recvApp, sendingApp, sendingApp,
                                                                   Guid.NewGuid().ToString("N"), ex.Message);
                LogHelp.WriteErrorLog(ackMsg);
                SocketHelper.SendAck(MediII.Common.MLLPHelper.AddMLLP(ackMsg), e.SocketHandler);
                MediII.Common.LogHelper.LogError(ex, Common.LogCatagories.AdapterBiz);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 动态调用web服务
        /// </summary>
        /// <param name="url">WSDL服务地址</param>
        /// <param name="classname">服务接口类名</param>
        /// <param name="methodname">方法名</param>
        /// <param name="args">参数值</param>
        /// <returns></returns>
        public static object InvokeWebService(string url, string classname, string methodname, object[] args)
        {
            string @namespace = "EnterpriseServerBase.WebService.DynamicWebCalling";

            if ((classname == null) || (classname == ""))
            {
                classname = WebservicesHelper.GetWsClassName(url);
            }
            try
            {
                //获取WSDL
                WebClient          wc     = new WebClient();
                Stream             stream = wc.OpenRead(url + "?WSDL");
                ServiceDescription sd     = ServiceDescription.Read(stream);
                //注意classname一定要赋值获取
                classname = sd.Services[0].Name;

                ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
                sdi.AddServiceDescription(sd, "", "");
                CodeNamespace cn = new CodeNamespace(@namespace);

                //生成客户端代理类代码
                CodeCompileUnit ccu = new CodeCompileUnit();
                ccu.Namespaces.Add(cn);
                sdi.Import(cn, ccu);
                CSharpCodeProvider icc = new CSharpCodeProvider();


                //设定编译参数
                CompilerParameters cplist = new CompilerParameters();
                cplist.GenerateExecutable = false;
                cplist.GenerateInMemory   = true;
                cplist.ReferencedAssemblies.Add("System.dll");
                cplist.ReferencedAssemblies.Add("System.XML.dll");
                cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
                cplist.ReferencedAssemblies.Add("System.Data.dll");
                //编译代理类
                CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu);
                if (true == cr.Errors.HasErrors)
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    foreach (System.CodeDom.Compiler.CompilerError ce in cr.Errors)
                    {
                        sb.Append(ce.ToString());
                        sb.Append(System.Environment.NewLine);
                    }
                    throw new Exception(sb.ToString());
                }
                //生成代理实例,并调用方法
                System.Reflection.Assembly assembly = cr.CompiledAssembly;
                Type   t   = assembly.GetType(@namespace + "." + classname, true, true);
                object obj = Activator.CreateInstance(t);
                System.Reflection.MethodInfo mi = t.GetMethod(methodname);
                return(mi.Invoke(obj, args));
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog("InvokeWebService异常", ex);
                return(null);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 传入待查询城市、查询时间返回一个字符串数组分别为:AQI 等级 PM2.5 PM10 SO2 NO2 CO
        /// O3(不区分站点)
        /// </summary>
        /// <param name="name">城市名称</param>
        /// <param name="date">时间(一般为整点,否则返回为空)</param>
        /// <returns></returns>
        public static string[] getHoursData(string name, DateTime date)
        {
            try
            {
                string[]      airDataHours = new string[8]; //AQI 等级 PM2.5 PM10 SO2 NO2 CO O3
                StringBuilder sb           = new StringBuilder();
                byte[]        time         = System.Text.Encoding.UTF8.GetBytes(string.Format("{0:g}", date));
                string        formWeb      = "cityName=" + System.Web.HttpUtility.UrlEncode(name) + "&searchTime=" + System.Web.HttpUtility.UrlEncode(time);
                string        url          = "http://datacenter.mep.gov.cn/index!environmentAirHourDetail.action";
                //string.Format("http://datacenter.mep.gov.cn/index!environmentAirHourDetail.action?{0}", formWeb);
                HttpWebRequest httprequest = (HttpWebRequest)WebRequest.Create(url);
                httprequest.KeepAlive   = true;
                httprequest.Accept      = " gzip, deflate";
                httprequest.Method      = "POST";
                httprequest.ContentType = "application/x-www-form-urlencoded";
                StreamWriter sw = new StreamWriter(httprequest.GetRequestStream());
                sw.WriteLine(formWeb);
                sw.Close();
                try
                {
                    HttpWebResponse httpresponse = (HttpWebResponse)httprequest.GetResponse();
                    Stream          s            = httpresponse.GetResponseStream();
                    StreamReader    sr           = new StreamReader(s);
                    while (!sr.EndOfStream)
                    {
                        string tempstr = sr.ReadLine();
                        if (tempstr != " " & tempstr != "\r\n" & tempstr != "\r\n\r\n" & tempstr != "\r\n\r\n")
                        {
                            sb.AppendLine(tempstr);
                        }
                    }
                    sr.Close();
                }
                catch (Exception)
                {
                    return(null);
                }

                var doc = new HtmlDocument();
                doc.LoadHtml(sb.ToString());
                HtmlNode docNode = doc.DocumentNode;
                var      res     = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]");//逐小时数据所在的部位
                if (res != null)
                {
                    var qai = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[1]/div[1]/div[1]");
                    foreach (var item in qai.ChildNodes)
                    {
                        airDataHours[0] = (item.OuterHtml.Trim());
                    }

                    var level = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[1]/div[1]/p[3]");
                    airDataHours[1] = level.InnerHtml.Trim();
                    var pm2d5 = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[4]/p[2]");
                    foreach (var item in pm2d5.ChildNodes)
                    {
                        airDataHours[2] = (item.OuterHtml.Trim());
                    }

                    var pm10 = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[5]/p[2]");
                    foreach (var item in pm10.ChildNodes)
                    {
                        airDataHours[3] = (item.OuterHtml.Trim());
                    }

                    var SO2 = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[6]/p[2]");
                    foreach (var item in SO2.ChildNodes)
                    {
                        airDataHours[4] = (item.OuterHtml.Trim());
                    }

                    var NO2 = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[7]/p[2]");
                    foreach (var item in NO2.ChildNodes)
                    {
                        airDataHours[5] = (item.OuterHtml.Trim());
                    }

                    var CO = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[8]/p[2]");
                    foreach (var item in CO.ChildNodes)
                    {
                        airDataHours[6] = (item.OuterHtml.Trim());
                    }

                    var O3 = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[2]/div[3]/table[1]/tr[1]/td[1]/table[1]/tr[2]/td[1]/div[1]/div[9]/p[2]");
                    foreach (var item in O3.ChildNodes)
                    {
                        airDataHours[7] = (item.OuterHtml.Trim());
                    }
                }
                return(airDataHours);
            }
            catch (Exception err)
            {
                LogHelp.WriteLog(err, "EnvironmentalData");
                return(null);
            }
        }
Exemplo n.º 19
0
 /// <summary>
 /// 获取城市列表(空气质量逐小时历史数据)(缺少一部分城市)
 /// </summary>
 /// <returns></returns>
 public static List <string> getCity()
 {
     try
     {
         List <string>  result      = new List <string>();
         HttpWebRequest httprequest = (HttpWebRequest)WebRequest.Create("http://datacenter.mep.gov.cn/index!environmentAirHourDetailCity.action");
         httprequest.KeepAlive = true;
         httprequest.UserAgent = " Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
         httprequest.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
         httprequest.Method    = "GET";
         HttpWebResponse response = (HttpWebResponse)httprequest.GetResponse();
         StreamReader    sr       = new StreamReader(response.GetResponseStream());
         string          sb       = sr.ReadToEnd();
         sr.Close();
         var doc = new HtmlDocument();
         doc.LoadHtml(sb.ToString());
         var root = doc.DocumentNode;
         if (root != null)
         {
             var citynodes = root.SelectSingleNode("/html[1]/body[1]");
             for (int i = 1; i < 62; i++)
             {
                 var cityRow = citynodes.ChildNodes[i];//省份所在的表格
                 if (cityRow.ChildNodes.Count > 0)
                 {
                     List <string> tempProviece = new List <string>();
                     for (int j = 0; j < cityRow.ChildNodes.Count; j++)
                     {
                         string temp = cityRow.ChildNodes[j].InnerText.Trim();
                         temp.Replace("\r\n", "");
                         temp.Replace("\n", "");
                         temp.Replace("\r", "");
                         temp.Replace("\t", "");
                         temp.Replace(" ", "");
                         if (!string.IsNullOrWhiteSpace(temp))
                         {
                             tempProviece.Add(cityRow.ChildNodes[j].InnerText.Trim());
                             if (temp.Contains("津"))
                             {
                             }
                         }
                     }
                     if (tempProviece.Count > 1)//去掉省份
                     {
                         tempProviece.RemoveAt(0);
                     }
                     result.AddRange(tempProviece);
                 }
                 else if (!string.IsNullOrWhiteSpace(cityRow.InnerText.Trim().Replace("\r\n", "").Replace("\r", "").Replace("\n", "")))
                 {
                     result.Add(cityRow.InnerText.Trim());
                 }
             }
         }
         return(result);
     }
     catch (Exception err)
     {
         LogHelp.WriteLog(err, "EnvironmentalData");
         return(null);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// 1.根据classid找到课程助力配置
        /// 2.根据openid判断是否助力过
        /// 3.生成该openid该课程助力数据
        /// 4.更新助力人的助力人数
        /// 5.插入助力人员表
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="classid"></param>
        /// <returns></returns>
        public ActionResult HelpClass(string code, string state, string classid, string ownOpenid, string helpId)
        {
            string msg      = string.Empty;
            string link     = string.Empty;
            string fileName = string.Empty;
            string openid   = "";

            try
            {
                if (new AppSetting().IsDebug != null &&
                    new AppSetting().IsDebug.ToLower() == "true")
                {
                    openid = "123";
                }
                else
                {
                    if (Request.Cookies[SystemConfig.WXOpenIDCookieKey] != null)
                    {
                        openid = Request.Cookies[SystemConfig.WXOpenIDCookieKey].Value;
                    }
                    if (string.IsNullOrEmpty(openid) && string.IsNullOrEmpty(code))
                    {
                        Response.Redirect(CommonHelper.GetRedirect("WxOrder%2fHelpClass?helpId=" + helpId));
                    }
                    try
                    {
                        if (string.IsNullOrWhiteSpace(openid))
                        {
                            openid = GetOpenId(code).openid;


                            // 合法用户,允许访问
                            Response.Cookies[SystemConfig.WXOpenIDCookieKey].Value   = openid;
                            Response.Cookies[SystemConfig.WXOpenIDCookieKey].Path    = "/";
                            Response.Cookies[SystemConfig.WXOpenIDCookieKey].Expires = DateTime.Now.AddDays(1);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }



                OrderBC bc = new OrderBC();

                HelpInfoEntity entity = new HelpInfoEntity();
                if (!string.IsNullOrEmpty(helpId))
                {
                    entity    = bc.GetHelpByHelpInfoId(helpId);
                    ownOpenid = entity.OpenId;
                    classid   = entity.ClassId;
                }
                var config = bc.GetHelpConfigByClassId(classid);
                if (!string.IsNullOrEmpty(ownOpenid) && !string.IsNullOrEmpty(classid))
                {
                    entity = bc.GetHelpByOpenIdAndClassId(classid, ownOpenid);
                }


                if (ownOpenid != openid)//非发起用户进入
                {
                    var helpinfo = bc.GetHelpMemberByOpenid(openid);
                    if (helpinfo != null)
                    {
                        msg = "该用户已助力";
                        return(Json(msg, JsonRequestBehavior.AllowGet));
                    }

                    helpId = Guid.NewGuid().ToString();

                    //生成二维码
                    SaveIamge QR = CreateQR(helpId);
                    //添加文字水印
                    string WxName = new WxUserBC().GetWxUserByOpenid(openid).Nickname;

                    string path = HttpContext.Server.MapPath("/Images/upload/");

                    string[] sArray = Regex.Split(config.ImageUrl, "Images/upload/", RegexOptions.IgnoreCase);

                    string    filename = sArray[1].ToString();
                    SaveIamge WordsPic = new WaterImageManager().DrawWordsForSaveIamge(filename, path, WxName, 1, FontFamilys.宋体, FontStyle.Bold, ImagePosition.TopMiddle);
                    //添加二维码水印
                    string QrPic = new WaterImageManager().DrawImage(WordsPic.filename, WordsPic.showImg, QR.filename, QR.showImg, 1, ImagePosition.BottomMiddle);
                    LogHelp.WriteLog("QrPic:::" + QrPic);
                    fileName = QrPic;
                    link     = CommonHelper.LinkImageUrl("/Images/upload/" + QrPic);

                    HelpInfoEntity help = new HelpInfoEntity()
                    {
                        HelpInfoId = helpId,
                        ClassId    = classid,
                        OpenId     = openid,
                        NowCount   = 0,
                        imgUrl     = link
                    };

                    var addResult = bc.AddHelpInfo(help, openid);
                    //增加助力记录
                    HelpMemberEntity member = new HelpMemberEntity()
                    {
                        HelpInfoId = entity.HelpInfoId,
                        OpenId     = openid,
                    };
                    var addMember = bc.AddHelpMember(member, openid);
                    //更新助力信息人数
                    var updateInfo = bc.UpdateHelpNowCount(entity.HelpInfoId, entity.NowCount + 1);

                    entity = bc.GetHelpByHelpInfoId(entity.HelpInfoId);

                    int diff   = config.HelpCount - entity.NowCount;
                    var wxUser = new WxUserBC().GetWxUserByOpenid(entity.OpenId);
                    if (diff <= 0)
                    {
                        string      OrderNo = CommonHelper.CreateOrderNo();
                        OrderEntity order   = new OrderEntity()
                        {
                            OrderNo     = OrderNo,
                            Openid      = entity.OpenId,
                            PayPrice    = 0,
                            OrderSource = "4",
                            Nickname    = wxUser.Nickname
                        };
                        List <OrderGoodsEntity> goods = new List <OrderGoodsEntity>();

                        var classEntity       = new ClassBC().GetClassByKey(classid);
                        OrderGoodsEntity good = new OrderGoodsEntity()
                        {
                            ClassId   = classEntity.ClassId,
                            ClassName = classEntity.ClassName,
                            Price     = 0
                        };
                        goods.Add(good);

                        var result = new OrderBC().SaveOrder(order, goods, entity.OpenId);


                        msg = "助力成功";
                    }
                }
                else//发起用户进入
                {
                    LogHelp.WriteLog("HelpClass:::22222");
                    if (entity != null)//如果主力已存在,展示助力情况
                    {
                        link = entity.imgUrl;
                        int diff = config.HelpCount - entity.NowCount;
                        if (diff > 0)
                        {
                            msg = string.Format("还差 {0} 人助力成功", diff);
                            //return Json(msg, JsonRequestBehavior.AllowGet);
                        }
                        else
                        {
                            msg = string.Format("已助力成功");
                            //return Json(msg, JsonRequestBehavior.AllowGet);
                        }
                    }
                    else //如果助力不存在,新增助力
                    {
                        helpId = Guid.NewGuid().ToString();
                        //生成二维码
                        SaveIamge QR = CreateQR(helpId);
                        //添加文字水印
                        string WxName = new WxUserBC().GetWxUserByOpenid(ownOpenid).Nickname;
                        string path   = HttpContext.Server.MapPath("/Images/upload/");

                        string[]  sArray   = Regex.Split(config.ImageUrl, "Images/upload/", RegexOptions.IgnoreCase);
                        string    filename = sArray[1].ToString();
                        SaveIamge WordsPic = new WaterImageManager().DrawWordsForSaveIamge(filename, path, WxName, 1, FontFamilys.宋体, FontStyle.Bold, ImagePosition.TopMiddle);
                        //添加二维码水印
                        string QrPic = new WaterImageManager().DrawImage(WordsPic.filename, WordsPic.showImg, QR.filename, QR.showImg, 1, ImagePosition.BottomMiddle);
                        fileName = QrPic;
                        link     = CommonHelper.LinkImageUrl("/Images/upload/" + QrPic);

                        HelpInfoEntity help = new HelpInfoEntity()
                        {
                            HelpInfoId = helpId,
                            ClassId    = classid,
                            OpenId     = ownOpenid,
                            NowCount   = 0,
                            imgUrl     = link
                        };
                        var addResult = bc.AddHelpInfo(help, ownOpenid);

                        msg = "分享图片,请好友帮忙助力吧";
                    }
                }

                //string media_id = Util.uploadMedia(HttpContext.Server.MapPath("/Images/upload/") + fileName, fileName);
                //Util.SendCustomMessage(openid, media_id);
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog("HelpClass:::" + ex.Message);
            }


            ViewBag.Message = msg;
            ViewBag.Link    = link;

            return(View());
        }
Exemplo n.º 21
0
        public ActionResult Register(RegisterModel model)
        {
            string ErrMsg;

            try
            {
                //数据校验
                if (string.IsNullOrEmpty(model.openid))
                {
                    ErrMsg = "OpenId不能为空";
                    return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                }

                if (string.IsNullOrEmpty(model.phone))
                {
                    ErrMsg = "手机号不能为空";
                    return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                }

                if (string.IsNullOrEmpty(model.code))
                {
                    ErrMsg = "验证码不能为空";
                    return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    //SMSCodes smsCode = Session["RegisterCode"] as SMSCodes;
                    if (Session["RegisterCode"] == null)
                    {
                        ErrMsg = "未获取验证码";
                        return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        //if (!smsCode.IsExpired && smsCode.IsUsered == false)
                        //{

                        if (model.code != "1234")
                        {
                            ErrMsg = "验证码不正确";
                            return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            //string access_token = "";

                            //access_token = Util.GetAccessTokenOpen();
                            //LogHelp.WriteLog(DateTime.Now + "GetAccessTokenOpen:" +model.openid+ access_token);
                            //var userInfo = GetUserInfo(model.openid, access_token);

                            var userInfo = new WxUserBC().GetWxUserByOpenid(model.openid);
                            LogHelp.WriteLog(DateTime.Now + "GetWxUserByOpenid:" + model.openid);
                            //实体赋值
                            WxUserEntity Entry = new WxUserEntity();

                            //List<WxUserEntity> list = null;
                            //校验次手机号是否已注册
                            var list = new WxUserBC().GetWxUserListByCondition(null, model.phone, null, null).ToList();
                            if (list.Count > 0)
                            {
                                ErrMsg = "手机号已被注册";
                                return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                Entry.WxUserId     = userInfo.WxUserId;
                                Entry.Openid       = userInfo.Openid;
                                Entry.Nickname     = userInfo.Nickname;
                                Entry.Sex          = userInfo.Sex;
                                Entry.City         = userInfo.City;
                                Entry.Country      = userInfo.Country;
                                Entry.Province     = userInfo.Province;
                                Entry.UserLanguage = userInfo.UserLanguage;
                                Entry.Headimgurl   = userInfo.Headimgurl;
                                Entry.Phone        = model.phone;
                                int d = new WxUserBC().SaveWxUser(Entry, userInfo.Openid);

                                if (d == 0)
                                {
                                    ErrMsg = "插入数据库失败";
                                    return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                                }
                                else
                                {
                                    //Session["DELIVERYMANCODE"] = new SMSCodes { Code = smsCode.Code, CreteTime = smsCode.CreteTime, IsUsered = true };
                                    ErrMsg = "Success";
                                    return(Json(ErrMsg, JsonRequestBehavior.AllowGet));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message.ToString();
                return(Json("Error"));
            }
        }
Exemplo n.º 22
0
        public ActionResult AddOrder(OrderParam param)
        {
            try
            {
                if (param == null)
                {
                    return(Json(string.Empty));
                }

                //判断是否注册
                var userInfo = new WxUserBC().GetWxUserByOpenid(param.openid);

                if (string.IsNullOrEmpty(userInfo.Phone))
                {
                    string url = CommonHelper.GetRedirect("WxMy%2fRegistered");
                    //Response.Redirect(url);
                    return(Json(url, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    string      OrderNo = CommonHelper.CreateOrderNo();
                    OrderEntity order   = new OrderEntity()
                    {
                        OrderNo     = OrderNo,
                        Openid      = param.openid,
                        PayPrice    = param.price,
                        OrderSource = param.source,
                        Nickname    = new WxUserBC().GetWxUserByOpenid(param.openid).Nickname
                    };

                    List <OrderGoodsEntity> goods = new List <OrderGoodsEntity>();

                    var paramList = param.classids.ToString().Split('|').ToList();
                    if (paramList != null && paramList.Count > 0)
                    {
                        foreach (var item in paramList)
                        {
                            if (!string.IsNullOrEmpty(item))
                            {
                                var entity            = new ClassBC().GetClassByKey(item);
                                OrderGoodsEntity good = new OrderGoodsEntity()
                                {
                                    ClassId   = entity.ClassId,
                                    ClassName = entity.ClassName,
                                    Price     = param.source != "1" ? param.price : entity.ClassPrice
                                };
                                goods.Add(good);
                            }
                        }
                    }

                    var result = new OrderBC().SaveOrder(order, goods, param.openid);
                    if (result == "true")
                    {
                        string okUrl = "/WxOrder/Index?orderNo=" + OrderNo;
                        return(Json(okUrl, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(string.Empty, JsonRequestBehavior.AllowGet));
                    }
                }

                //var orderResult = new OrderBC().GetOrderByOpenIdandClassId(param.openid,);
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog(DateTime.Now + ":::AddOrderError:::" + ex.Message);
                return(Json(string.Empty, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 23
0
        //private ILogger _logger;
        public UnifiedOrderResponse UnifiedOrder(UnifiedOrderRequest request)
        {
            //_logger = new LoggerFactory().SetCurrent(new Log4NetLoggerFactory("Wechat_Verify")).CreateLogger();
            UnifiedOrderResponse resp = new UnifiedOrderResponse();

            //统一下单
            try
            {
                //_logger.Debug("exPay:in");
                WxPayData data = new WxPayData();
                data.SetValue("body", request.Body);
                data.SetValue("attach", request.Attach);
                data.SetValue("out_trade_no", request.OutTradeNo);
                data.SetValue("total_fee", request.TotalFee);
                data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
                data.SetValue("goods_tag", request.GoodTag);
                data.SetValue("trade_type", request.TradeType);
                data.SetValue("openid", request.OpenId);


                data.SetValue("notify_url", request.NotifyUrl);          //异步通知url
                data.SetValue("appid", WxPayConfig.APPID);               //公众账号ID
                data.SetValue("mch_id", WxPayConfig.MCHID);              //商户号
                data.SetValue("spbill_create_ip", WxPayConfig.IP);       //终端ip
                data.SetValue("nonce_str", WxPayApi.GenerateNonceStr()); //随机字符串

                //签名
                data.SetValue("sign", data.MakeSign());

                string xml = data.ToXml();
                LogHelp.WriteLog(DateTime.Now + "payInxml:" + xml);
                RestClient  client = new RestClient("https://api.mch.weixin.qq.com/pay/unifiedorder");
                RestRequest req    = new RestRequest(Method.POST);
                req.RequestFormat = DataFormat.Xml;
                req.AddParameter("text/xml", xml, ParameterType.RequestBody);

                var content = client.Execute(req).Content;
                LogHelp.WriteLog(DateTime.Now + "payIn:" + content);
                WxPayData result = new WxPayData();
                result.FromXml(content);


                if (!result.IsSet("appid") || !result.IsSet("prepay_id") || result.GetValue("prepay_id").ToString() == "")
                {
                    resp.Success = false;

                    if (result.IsSet("return_msg"))
                    {
                        resp.ErrMsg = (string)result.GetValue("return_msg");
                    }

                    return(resp);
                }

                resp.Success = (string)result.GetValue("return_code") == "SUCCESS";
                if (!resp.Success)
                {
                    resp.ErrMsg = (string)result.GetValue("return_msg");
                    return(resp);
                }
                else
                {
                    resp.ErrMsg = string.Empty;
                }

                resp.AppId     = (string)result.GetValue("appid");
                resp.MchId     = (string)result.GetValue("mch_id");
                resp.NonceStr  = (string)result.GetValue("nonce_str");
                resp.Sign      = (string)result.GetValue("sign");
                resp.PrepayId  = (string)result.GetValue("prepay_id");
                resp.TradeType = (string)result.GetValue("trade_type");
            }
            catch (Exception ex)
            {
                LogHelp.WriteLog(DateTime.Now + "UnifiedOrderError:" + ex.Message);
            }

            return(resp);
        }