Exemplo n.º 1
0
        private static void SentRowToRongBao(string batchCurrnum, string batchDate, string terminal, ref string errorItem)
        {
            string selectSqlFields = "select top 1 a.id,a.terminal,a.finallyMoney money,a.sum2Id,a.tradeMoney,a.createDate, b.faren,b.shanghuName,b.bankName ,b.bankName2,b.bankName3,b.province,b.bankAccount,b.city,b.tel,b.sourceAccount,isnull(b.dayMax,0) dayMax,isnull(b.dayMin,0) dayMin,isnull(eachMin,0) eachMin , isnull(eachMax,0) eachMax,isnull(b.daifufei,0) daifufei from transactionSum a join customers b on b.terminal = a.terminal";


            using (DBContext db = new DBContext(true))
            {
                string  sql      = selectSqlFields + "  where a.id=488";
                DataRow dr       = db.QueryTable(sql).Rows[0];
                decimal daifufei = Convert.ToDecimal(dr["daifufei"]);
                dr["money"] = Convert.ToDecimal(dr["money"]) - daifufei;
                string cerFile = @"F:\colys\QuickDisk\MyWork\yiletong\Web\Content\tomcat.cer";
                //LogStep("更新待上传标记");
                sql = @"update transactionSum set status= 1,results='正在结算',daifufei=" + daifufei + ",finallyMoney=" + dr["money"] + ", batchCurrnum='" + batchCurrnum + "'" +
                      ", uploadDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
                      ",faren='" + dr["faren"] + "' " +
                      ",shanghuName='" + dr["shanghuName"] + "' " +
                      ",bankName='" + dr["bankName"] + "' " +
                      ",bankName2='" + dr["bankName2"] + "' " +
                      ",bankName3='" + dr["bankName3"] + "' " +
                      ",province='" + dr["province"] + "' " +
                      ",city='" + dr["city"] + "' " +
                      ",bankAccount='" + dr["bankAccount"] + "' " +
                      ",sourceAccount='" + dr["sourceAccount"] + "' " +
                      ",tel='" + dr["tel"] + "' " +
                      " where id='" + dr["id"] + "'";

                db.ExecuteCommand(sql);//标记状态为待上传

                errorItem = "上传融宝处理";
                Common.RongBao.RSACryptionClass testClass = new Common.RongBao.RSACryptionClass(cerFile, "");
                string returnStr = testClass.Sent(dr.Table, batchCurrnum, batchDate);
                //LogStep("融宝执行成功,更新成功状态");
                sql = "update transactionSum set status= 2,results='银行处理中' where id='" + dr["id"] + "'";
                db.ExecuteCommand(sql);
                errorItem = null;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 发送到融宝,注意:上传融宝之前提交一样事务
 /// </summary>
 /// <param name="dr"></param>
 /// <param name="batchCurrnum"></param>
 /// <param name="batchDate"></param>
 /// <param name="terminal"></param>
 /// <param name="errorItem"></param>
 private void SentRowToRongBao(DataRow dr, string batchCurrnum, string batchDate, string terminal, ref string errorItem)
 {
     LogStep("添加代付手续费");
     decimal daifufei = Convert.ToDecimal(dr["daifufei"]);
     dr["money"] = Convert.ToDecimal(dr["money"]) - daifufei;
     string cerFile = getSetting("rongbao_public", true);
     LogStep("更新待上传标记");
     string sql = @"update transactionSum set status= 1,results='正在结算', batchCurrnum='" + batchCurrnum + "'" +
     ", uploadDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
     ",faren='" + dr["faren"] + "' " +
     ",shanghuName='" + dr["shanghuName"] + "' " +
     ",bankName='" + dr["bankName"] + "' " +
     ",bankName2='" + dr["bankName2"] + "' " +
     ",bankName3='" + dr["bankName3"] + "' " +
     ",province='" + dr["province"] + "' " +
     ",city='" + dr["city"] + "' " +
     ",bankAccount='" + dr["bankAccount"] + "' " +
     ",sourceAccount='" + dr["sourceAccount"] + "' " +
     ",tel='" + dr["tel"] + "' " +
     " where id='" + dr["id"] + "'";
     using (DBContext db = new DBContext())
     {
         db.ExecuteCommand(sql);//标记状态为待上传
         db.Close();
     }
     errorItem = "上传融宝处理";
     Common.RongBao.RSACryptionClass testClass = new Common.RongBao.RSACryptionClass(cerFile, "");
     string returnStr = testClass.Sent(dr.Table, batchCurrnum, batchDate);
     LogStep("融宝执行成功,更新成功状态");
     sql = "update transactionSum set status= 2,daifufei=" + daifufei + ",finallyMoney=" + dr["money"] + ",results='银行处理中' where id='" + dr["id"] + "'";
     using (DBContext db = new DBContext())
     {
         db.ExecuteCommand(sql);
         errorItem = null;
         string msgTitle = Convert.ToDateTime(dr["createDate"]).ToString("HH:mm:ss") + dr["faren"] + "消费额" + dr["tradeMoney"] + "元,准备出款" + dr["money"] + "元";
         string msgContent = "<p>终端" + dr["terminal"] + ",法人:" + dr["faren"] + ",商户:" + dr["shanghuName"] + "</p>";
         msgContent += "<p>" + dr["createDate"] + "发起结算:" + dr["tradeMoney"] + "元,需要给客户打款:" + dr["money"] + "元</p>";
         msgContent += "<p><a href='https://bgp.reapal.com/tbAgentpayInfo/agentpaylist'>点此前往融宝审核</a></p>";
         string emails = getSetting("emails");
         foreach (string mail in emails.Split(','))
         {
             SentEmail(mail, msgContent, msgTitle, db);
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 查询融宝执行情况
 /// </summary>
 /// <returns>The rong bao.</returns>
 /// <param name="batchCurrnum">Batch currnum.</param>
 /// <param name="batchDate">Batch date.</param>
 public JsonResult GetRongBao(string batchCurrnum,string batchDate )
 {
     JsonMessage resultData = new JsonMessage ();
     string responseXml = "";
     string publicCer = getSetting("rongbao_public", true);
     string cerFile = getSetting("rongbao_private", true);
     Common.RongBao.RSACryptionClass testClass = new Common.RongBao.RSACryptionClass(publicCer, cerFile);
     int tryCount = 5;
     while (true)
     {
         try
         {
             resultData.Result = testClass.TryGetResult(batchCurrnum, batchDate, out responseXml);
             break;
         }
         catch (System.Net.WebException webEx) {
             tryCount--;
             if (tryCount < 0)
             {
                 LogError("查询融宝执行结果发生网络错误,已重试10次没有成功!:", webEx);
                 break;
             }
             else
             {
                 LogError("查询融宝执行结果发生网络错误,重试" + tryCount + ":", webEx);
                 System.Threading.Thread.Sleep(5000);
             }
         }
         catch (Exception ex)
         {
             string errorMsg = "GetRongBao " + batchCurrnum + " " + batchDate + " rongbao res is :" + responseXml + "\r\n";
             LogError(errorMsg, ex);
             resultData.Message = ex.Message;
             break;
         }
     }
     return Json(resultData,JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 4
0
        private static void SentRowToRongBao( string batchCurrnum, string batchDate, string terminal, ref string errorItem)
        {
            string selectSqlFields = "select top 1 a.id,a.terminal,a.finallyMoney money,a.sum2Id,a.tradeMoney,a.createDate, b.faren,b.shanghuName,b.bankName ,b.bankName2,b.bankName3,b.province,b.bankAccount,b.city,b.tel,b.sourceAccount,isnull(b.dayMax,0) dayMax,isnull(b.dayMin,0) dayMin,isnull(eachMin,0) eachMin , isnull(eachMax,0) eachMax,isnull(b.daifufei,0) daifufei from transactionSum a join customers b on b.terminal = a.terminal";

            using (DBContext db = new DBContext(true))
            {
                string sql =  selectSqlFields+"  where a.id=488";
                DataRow dr = db.QueryTable(sql).Rows[0];
                decimal daifufei = Convert.ToDecimal(dr["daifufei"]);
                dr["money"] = Convert.ToDecimal(dr["money"]) - daifufei;
                string cerFile = @"F:\colys\QuickDisk\MyWork\yiletong\Web\Content\tomcat.cer";
                //LogStep("更新待上传标记");
                sql = @"update transactionSum set status= 1,results='正在结算',daifufei=" + daifufei + ",finallyMoney=" + dr["money"] + ", batchCurrnum='" + batchCurrnum + "'" +
                ", uploadDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
                ",faren='" + dr["faren"] + "' " +
                ",shanghuName='" + dr["shanghuName"] + "' " +
                ",bankName='" + dr["bankName"] + "' " +
                ",bankName2='" + dr["bankName2"] + "' " +
                ",bankName3='" + dr["bankName3"] + "' " +
                ",province='" + dr["province"] + "' " +
                ",city='" + dr["city"] + "' " +
                ",bankAccount='" + dr["bankAccount"] + "' " +
                ",sourceAccount='" + dr["sourceAccount"] + "' " +
                ",tel='" + dr["tel"] + "' " +
                " where id='" + dr["id"] + "'";

                db.ExecuteCommand(sql);//标记状态为待上传

                errorItem = "上传融宝处理";
                Common.RongBao.RSACryptionClass testClass = new Common.RongBao.RSACryptionClass(cerFile, "");
                string returnStr = testClass.Sent(dr.Table, batchCurrnum, batchDate);
                //LogStep("融宝执行成功,更新成功状态");
                sql = "update transactionSum set status= 2,results='银行处理中' where id='" + dr["id"] + "'";
                db.ExecuteCommand(sql);
                errorItem = null;
            }
        }