Esempio n. 1
0
        public string RefreshOrder(string CommunityId, string out_trade_no)
        {
            string            ConnStr    = GetConnection(CommunityId);
            string            BankResult = SearchBankOrder(CommunityId, out_trade_no);
            IDbConnection     conn       = new SqlConnection(GetConnection(CommunityId));
            string            query      = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@out_trade_no";
            Tb_OL_AlipayOrder T_Order    = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();

            if (BankResult == "TRADE_SUCCESS")
            {
                //更新订单状态
                UpdateProperyOrder(T_Order.CommunityId.ToString(), T_Order.out_trade_no.ToString(), BankResult, "TRADE_SUCCESS");
                if (T_Order.IsSucc.ToString() != "1")
                {
                    //下账
                    ReceProperyOrder(0, T_Order.CommunityId.ToString(), T_Order.out_trade_no.ToString(), null);
                    return(JSONHelper.FromString(true, "订单状态已更新并下账成功,请刷新订单"));
                }
                else
                {
                    return(JSONHelper.FromString(true, "订单状态已更新,请刷新订单"));
                }
            }
            else
            {
                //更新订单状态
                UpdateProperyOrder(T_Order.CommunityId.ToString(), T_Order.out_trade_no.ToString(), BankResult, "");
            }

            return("");
        }
Esempio n. 2
0
        /// <summary>
        /// 取消下帐
        /// </summary>
        /// <param name="CommunityId"></param>
        /// <param name="OrderId"></param>
        /// <returns></returns>
        public static string NoReceProperyOrder(string CommunityId, string OrderId)
        {
            try
            {
                string ConnStr = GetConnection(CommunityId);

                IDbConnection     conn    = new SqlConnection(GetConnection(CommunityId));
                string            query   = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@OrderId";
                Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { orderId = OrderId }).SingleOrDefault();
                if (T_Order.IsSucc.ToString() == "0")
                {
                    return("物业账单未下账");
                }
                conn.Dispose();
                conn = new SqlConnection(GetConnection(CommunityId));

                //更改状态
                T_Order.IsSucc = 0;
                conn.Update <Tb_OL_AlipayOrder>(T_Order);
                return("success");
            }
            catch (Exception E)
            {
                return(E.Message.ToString());
            }
        }
Esempio n. 3
0
        public static void ReceCost(string CommunityId, string out_trade_no)
        {
            string ConnStr = GetConnection(CommunityId);

            //公司数据库连接字符串
            Global_Var.CorpSQLConnstr = ConnStr;
            //查询账单信息
            IDbConnection     conn    = new SqlConnection(ConnStr);
            string            query   = "SELECT * FROM Tb_OL_AliPayOrder WHERE out_trade_no=@out_trade_no";
            Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();

            query = "SELECT * FROM Tb_OL_AliPayDetail_Prec WHERE PayOrderId=@PayOrderId";
            Tb_OL_AliPayDetail_Prec T_Prec = conn.Query <Tb_OL_AliPayDetail_Prec>(query, new { PayOrderId = T_Order.Id.ToString() }).SingleOrDefault();

            //预存收款
            string  strUserCode = "_Sys_";
            string  Result      = "";
            string  ErrorMsg    = "";
            long    iReceID     = 0;
            decimal PrecAmount  = Convert.ToDecimal(T_Prec.DueAmount);

            ReceFeesPrec.ReceivePrecFees(AppGlobal.StrToInt(T_Order.CommID.ToString()), T_Order.CustId, T_Prec.RoomID, T_Prec.CostId.ToString(), "自助缴费", PrecAmount, strUserCode, ref Result, ref ErrorMsg, ref iReceID);

            //更新账单信息
            T_Order.IsSucc = 1;
            conn.Update(T_Order);

            T_Prec.PaidAmount = T_Prec.DueAmount;
            conn.Update(T_Prec);
        }
Esempio n. 4
0
        /// <summary>
        /// 物业订单收款
        /// </summary>
        /// <param name="CommunityId"></param>
        /// <param name="OrderId"></param>
        /// <param name="respCode"></param>
        /// <param name="respmsg"></param>
        /// <returns></returns>
        public static string ReceProperyOrder(string CommunityId, string out_trade_no)
        {
            try
            {
                //构建链接字符串
                string strcon = PubConstant.GetConnectionString("APPConnection");

                IDbConnection     conn    = new SqlConnection(strcon);
                string            query   = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@out_trade_no";
                Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();
                if (T_Order.IsSucc.ToString() == "1")
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("{\"Result\":\"false\",");
                    sb.Append("\"data\":");
                    sb.Append("\"物业订单已下账\"");
                    sb.Append("}");
                    return(sb.ToString());
                }
                else
                {
                    ReceFees(CommunityId, out_trade_no);
                    StringBuilder sb = new StringBuilder();
                    sb.Append("{\"Result\":\"true\",");
                    sb.Append("\"data\":");
                    sb.Append("\"下账成功\"");
                    sb.Append("}");
                    return(sb.ToString());
                }
            }
            catch (Exception E)
            {
                return(E.Message.ToString());
            }
        }
Esempio n. 5
0
        public static void ReceCost(string CommunityId, string out_trade_no)
        {
            IDbConnection conn  = new SqlConnection(PubConstant.UnifiedContionString.ToString());
            string        query = "SELECT * FROM Tb_Community WHERE Id=@id";
            var           T     = conn.Query <Tb_Community>(query, new { id = CommunityId }).FirstOrDefault();

            if (T != null)
            {
                PubConstant.hmWyglConnectionString = GetConnectionStr(T);
                Global_Var.CorpSQLConnstr          = PubConstant.hmWyglConnectionString;
            }
            conn.Dispose();
            //公司数据库连接字符串

            //查询账单信息
            conn  = new SqlConnection(PubConstant.hmWyglConnectionString);
            query = "SELECT * FROM Tb_OL_AliPayOrder WHERE out_trade_no=@out_trade_no";
            Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();

            query = "SELECT * FROM Tb_OL_AliPayDetail_Prec WHERE PayOrderId=@PayOrderId";
            Tb_OL_AliPayDetail_Prec T_Prec = conn.Query <Tb_OL_AliPayDetail_Prec>(query, new { PayOrderId = T_Order.Id.ToString() }).SingleOrDefault();

            //预存收款
            string strUserCode = "_Sys_";
            string Result      = "";
            string ErrorMsg    = "";
            // 禅道BUG12730,把支付宝改为支付宝支付
            string chargeMode = "支付宝支付";

            if (T.CorpID == 1973)
            {
                chargeMode = "自助缴费-支付宝";
            }

            long    iReceID    = 0;
            decimal PrecAmount = Convert.ToDecimal(T_Prec.DueAmount);

            ReceFeesPrec.ReceivePrecFees(AppGlobal.StrToInt(T_Order.CommID.ToString()), T_Order.CustId, T_Prec.RoomID, T_Prec.CostId.ToString(), chargeMode, PrecAmount, strUserCode, ref Result, ref ErrorMsg, ref iReceID, GetHandID(PubConstant.hmWyglConnectionString, out_trade_no));

            //更新账单信息
            T_Order.IsSucc = 1;
            conn.Update(T_Order);

            T_Prec.PaidAmount = T_Prec.DueAmount;
            conn.Update(T_Prec);
        }
Esempio n. 6
0
        public string SearchBankOrder(string CommunityId, string out_trade_no)
        {
            string Result = "";

            bool IsConfig = GenerateConfig(CommunityId);

            IDbConnection     conn    = new SqlConnection(GetConnection(CommunityId));
            string            query   = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@out_trade_no";
            Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();

            if (T_Order == null)
            {
                Result = "未找到该物业订单";
                return(Result);
            }

            //查找支付宝是否存在该订单

            return(Result);
        }
Esempio n. 7
0
        /// <summary>
        /// 物业订单收款
        /// </summary>
        /// <param name="CommunityId"></param>
        /// <param name="OrderId"></param>
        /// <param name="respCode"></param>
        /// <param name="respmsg"></param>
        /// <returns></returns>
        public static string ReceProperyOrder(string CommunityId, string out_trade_no)
        {
            try
            {
                string ConnStr = GetConnection(CommunityId);

                IDbConnection     conn    = new SqlConnection(GetConnection(CommunityId));
                string            query   = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@out_trade_no";
                Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();
                if (T_Order.IsSucc.ToString() == "1")
                {
                    return("物业订单已下账");
                }
                ReceCost(CommunityId, out_trade_no);
                return("success");
            }
            catch (Exception E)
            {
                return(E.Message.ToString());
            }
        }
Esempio n. 8
0
        public string CancelOrder(string CommunityId, string out_trade_no)
        {
            try
            {
                //构建链接字符串
                string strcon = PubConstant.GetConnectionString("APPConnection");

                string BankResult = SearchBankOrder(CommunityId, out_trade_no);

                if (BankResult == "TRADE_SUCCESS")
                {
                    return(JSONHelper.FromString(false, "银行已交易成功,不能取消"));
                }

                IDbConnection     conn    = new SqlConnection(strcon);
                string            query   = "SELECT * FROM Tb_OL_AlipayOrder WHERE out_trade_no=@out_trade_no";
                Tb_OL_AlipayOrder T_Order = conn.Query <Tb_OL_AlipayOrder>(query, new { out_trade_no = out_trade_no }).SingleOrDefault();

                if (T_Order.trade_status.Trim().ToString() == "TRADE_SUCCESS")
                {
                    return(JSONHelper.FromString(false, "物业账单银行已付款"));
                }
                if (T_Order.IsSucc.ToString() == "1")
                {
                    return(JSONHelper.FromString(false, "物业账单已下账"));
                }
                SqlParameter[] parameters =
                {
                    new SqlParameter("@OrderId", SqlDbType.VarChar)
                };
                parameters[0].Value = out_trade_no;
                new DbHelperSQLP(strcon).RunProcedure("Proc_OL_AlipayCancelOrder", parameters);
                return(JSONHelper.FromString(true, "取消订单成功"));
            }
            catch (Exception E)
            {
                return(JSONHelper.FromString(false, E.Message.ToString()));
            }
        }