示例#1
0
        //微信
        private string WxPay(string uid, decimal money)
        {
            UserFinancialManager ufm    = new UserFinancialManager();
            Hashtable            hashuf = new Hashtable();

            hashuf["ID"]            = CommonHelper.GetGuid;
            hashuf["UserID"]        = uid;
            hashuf["OrderNum"]      = SiteHelper.GenerateOrderNum();
            hashuf["OrderPayID"]    = SiteHelper.GeneratePayID();
            hashuf["ChangesAmount"] = money;
            hashuf["ChangesTime"]   = SiteHelper.GetWebServerCurrentTime();
            hashuf["ChangesType"]   = (int)UserFinancialChangesType.Recharge;
            hashuf["Remark"]        = "用户充值";
            hashuf["Operator"]      = uid;
            hashuf["OperatorType"]  = (int)UserFinancialOperatorType.User;
            hashuf["OperatorWay"]   = (int)UserFinancialOperatorWay.WeixinPubPay;
            hashuf["State"]         = (int)UserFinancialState.NewSubmit;
            bool isSuccess = ufm.AddOrEditUserFinancialInfo(hashuf, null);

            if (isSuccess)
            {
                Hashtable uf = ufm.GetUserFinancialPayInfoByPayID(hashuf["OrderPayID"].ToString());
                if (uf == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
                }
                else
                {
                    WxUtil wxUtil = new WxUtil();
                    string prepayid = "", sign = "";
                    prepayid = wxUtil.GetPrepayId(hashuf["OrderPayID"].ToString(), "余额充值", money, weixinNotifyUrl, ip, openID);
                    Hashtable result = new Hashtable();
                    result["PayWay"]    = payway;
                    result["appId"]     = WxConfig.AppId;
                    result["timeStamp"] = wxUtil.genTimeStamp();
                    result["nonceStr"]  = wxUtil.genNonceStr();
                    result["package"]   = "prepay_id=" + prepayid;
                    result["signType"]  = "MD5";

                    SortedDictionary <string, string> dic = new SortedDictionary <string, string>();
                    dic.Add("appId", result["appId"].ToString());
                    dic.Add("timeStamp", result["timeStamp"].ToString());
                    dic.Add("nonceStr", result["nonceStr"].ToString());
                    dic.Add("package", result["package"].ToString());
                    dic.Add("signType", result["signType"].ToString());
                    sign = wxUtil.getSign(dic);

                    result["sign"] = sign;
                    Logger.Info("RechargePay,WxPay prepayId:" + result["prepayId"]);
                    return(SiteHelper.GetJsonFromHashTable(result, "success", "生成支付订单成功", "RechargePay"));
                }
            }
            else
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
            }
        }
示例#2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["ChargingPointID"] == null || res["ChargingPointID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid             = res["UID"].ToString().Trim();
                chargingPointID = res["ChargingPointID"].ToString().Trim();
                ChargingPointsManager cpm = new ChargingPointsManager();
                ChargingOrdersManager com = new ChargingOrdersManager();
                Hashtable             ht  = cpm.GetChargingPointByID(chargingPointID);
                if (ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到充电桩数据"));
                }
                else
                {
                    string imei      = SiteHelper.GetHashTableValueByKey(ht, "IMEI");
                    bool   isSuccess = cpm.GPSRemoteControlLock(imei, false);
                    if (!isSuccess)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "充电桩启动失败,请稍后重试"));
                    }
                    else
                    {
                        Hashtable param = new Hashtable();
                        param["ID"]              = CommonHelper.GetGuid;
                        param["OrderNum"]        = SiteHelper.GenerateOrderNum();
                        param["ChargingPointID"] = chargingPointID;
                        param["UserID"]          = uid;
                        param["PayState"]        = OrderPayState.NotPay.GetHashCode();
                        param["BeginTime"]       = SiteHelper.GetWebServerCurrentTime();
                        param["CreateTime"]      = SiteHelper.GetWebServerCurrentTime();
                        bool result = com.NewOrder(param);
                        if (result)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "success", "充电桩启动成功"));
                        }
                        else
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "充电桩启动失败,请稍后重试"));
                        }
                    }
                }
            }
        }
示例#3
0
        //支付宝
        private string AliPay(string uid, decimal money)
        {
            UserFinancialManager ufm    = new UserFinancialManager();
            Hashtable            hashuf = new Hashtable();

            hashuf["ID"]            = CommonHelper.GetGuid;
            hashuf["UserID"]        = uid;
            hashuf["OrderNum"]      = SiteHelper.GenerateOrderNum();
            hashuf["OrderPayID"]    = SiteHelper.GeneratePayID();
            hashuf["ChangesAmount"] = money;
            hashuf["ChangesTime"]   = SiteHelper.GetWebServerCurrentTime();
            hashuf["ChangesType"]   = (int)UserFinancialChangesType.Recharge;
            hashuf["Remark"]        = "用户充值";
            hashuf["Operator"]      = uid;
            hashuf["OperatorType"]  = (int)UserFinancialOperatorType.User;
            hashuf["OperatorWay"]   = (int)UserFinancialOperatorWay.Alipay;
            hashuf["State"]         = (int)UserFinancialState.NewSubmit;
            bool isSuccess = ufm.AddOrEditUserFinancialInfo(hashuf, null);

            if (isSuccess)
            {
                Hashtable uf = ufm.GetUserFinancialPayInfoByPayID(hashuf["OrderPayID"].ToString());
                if (uf == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
                }
                else
                {
                    Hashtable result = new Hashtable();
                    result["PayWay"]    = payway;
                    result["orderInfo"] = YR.Web.api.app.pay.alipay.Core.GetOrderInfo(hashuf["OrderPayID"].ToString(), "余额充值", string.Format("用户充值{0:N2}元", money), alipayNotifyUrl, money);
                    Logger.Info("RechargePay,AliPay orderInfo:" + result["orderInfo"]);

                    ICache   cache = CacheFactory.GetCache();
                    DateTime dt    = DateTime.Now.AddSeconds(5);
                    cache.Set(cacheKey, uid, dt - DateTime.Now);
                    cache.Dispose();

                    return(SiteHelper.GetJsonFromHashTable(result, "success", "生成支付订单成功", "RechargePay"));
                }
            }
            else
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
            }
        }
示例#4
0
        //微信
        private string WxPay(string uid, decimal money)
        {
            UserFinancialManager ufm    = new UserFinancialManager();
            Hashtable            hashuf = new Hashtable();

            hashuf["ID"]            = CommonHelper.GetGuid;
            hashuf["UserID"]        = uid;
            hashuf["OrderNum"]      = SiteHelper.GenerateOrderNum();
            hashuf["OrderPayID"]    = SiteHelper.GeneratePayID();
            hashuf["ChangesAmount"] = money;
            hashuf["ChangesTime"]   = SiteHelper.GetWebServerCurrentTime();
            hashuf["ChangesType"]   = (int)UserFinancialChangesType.Recharge;
            hashuf["Remark"]        = "用户充值";
            hashuf["Operator"]      = uid;
            hashuf["OperatorType"]  = (int)UserFinancialOperatorType.User;
            hashuf["OperatorWay"]   = (int)UserFinancialOperatorWay.WeixinPay;
            hashuf["State"]         = (int)UserFinancialState.NewSubmit;
            bool isSuccess = ufm.AddOrEditUserFinancialInfo(hashuf, null);

            if (isSuccess)
            {
                Hashtable uf = ufm.GetUserFinancialPayInfoByPayID(hashuf["OrderPayID"].ToString());
                if (uf == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
                }
                else
                {
                    WxUtil wxUtil = new WxUtil();
                    string prepayid = "", sign = "";
                    prepayid = wxUtil.GetPrepayId(hashuf["OrderPayID"].ToString(), "余额充值", money, weixinNotifyUrl, HttpContext.Current.Request.UserHostAddress);
                    Hashtable result = new Hashtable();
                    result["PayWay"]       = payway;
                    result["appId"]        = pay.wxpay.WxConfig.AppId;
                    result["partnerId"]    = pay.wxpay.WxConfig.MchId;
                    result["prepayId"]     = prepayid;
                    result["packageValue"] = "Sign=WXPay";
                    result["nonceStr"]     = wxUtil.genNonceStr();
                    result["timeStamp"]    = wxUtil.genTimeStamp();

                    SortedDictionary <string, string> dic = new SortedDictionary <string, string>();
                    dic.Add("appid", result["appId"].ToString());
                    dic.Add("noncestr", result["nonceStr"].ToString());
                    dic.Add("package", result["packageValue"].ToString());
                    dic.Add("partnerid", result["partnerId"].ToString());
                    dic.Add("prepayid", result["prepayId"].ToString());
                    dic.Add("timestamp", result["timeStamp"].ToString());
                    sign = wxUtil.getSign(dic);

                    result["sign"] = sign;
                    Logger.Info("RechargePay,WxPay prepayId:" + result["prepayId"]);

                    ICache   cache = CacheFactory.GetCache();
                    DateTime dt    = DateTime.Now.AddSeconds(5);
                    cache.Set(cacheKey, uid, dt - DateTime.Now);
                    cache.Dispose();

                    return(SiteHelper.GetJsonFromHashTable(result, "success", "生成支付订单成功", "RechargePay"));
                }
            }
            else
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "生成支付订单失败"));
            }
        }
示例#5
0
        private bool OrderVehicle(Hashtable res, Hashtable vehicle, Hashtable user, out string orderID, out string orderNum)
        {
            orderID  = CommonHelper.GetGuid;
            orderNum = SiteHelper.GenerateOrderNum();
            bool result = false;

            try
            {
                string km_price = "", minute_price = "";
                VehiclePriceManager vp       = new VehiclePriceManager();
                Hashtable           price_ht = vp.GetVehiclePrice(vehicleid);
                if (price_ht != null && price_ht.Keys.Count > 0)
                {
                    km_price     = price_ht["KmPrice"].ToString();
                    minute_price = price_ht["MinutePrice"].ToString();
                }

                int       renttime        = 0;
                decimal   TotalMoney      = 0;
                decimal   SettlementMoney = TotalMoney;
                Hashtable param           = new Hashtable();
                param["VID"]             = vehicleid;
                param["OID"]             = orderID;
                param["OrderNum"]        = orderNum;
                param["UserID"]          = uid;
                param["VehicleID"]       = vehicleid;
                param["KMPrice"]         = km_price;
                param["MinutePrice"]     = minute_price;
                param["Mileage"]         = 0;
                param["Minutes"]         = 0;
                param["PayState"]        = OrderPayState.NotPay.GetHashCode();
                param["PayState"]        = OrderPayState.NotPay.GetHashCode();
                param["OrderState"]      = OrderState.Valid.GetHashCode();
                param["CreateTime"]      = SiteHelper.GetWebServerCurrentTime();
                param["OrderRemark"]     = "";
                param["RentDuration"]    = renttime;
                param["TotalMoney"]      = TotalMoney;
                param["SettlementMoney"] = SettlementMoney;
                param["PayMoney"]        = SettlementMoney;
                param["PayTime"]         = SiteHelper.GetWebServerCurrentTime().ToString();
                param["FinishedTime"]    = SiteHelper.GetWebServerCurrentTime().ToString();
                param["ChangesAmount"]   = -Math.Abs(SettlementMoney);
                param["UserFinancialID"] = CommonHelper.GetGuid;
                param["UserID"]          = uid;
                param["ChangesTime"]     = SiteHelper.GetWebServerCurrentTime().ToString();
                param["ChangesType"]     = UserFinancialChangesType.Consumption.GetHashCode().ToString();
                param["Remark"]          = "";
                param["Operator"]        = "";
                param["OperatorType"]    = UserFinancialOperatorType.Admin.GetHashCode().ToString();
                param["OperatorWay"]     = UserFinancialOperatorWay.Plat.GetHashCode().ToString();
                param["State"]           = UserFinancialState.Effect.GetHashCode().ToString();
                param["MessageID"]       = CommonHelper.GetGuid;
                param["CityID"]          = SiteHelper.GetHashTableValueByKey(vehicle, "CityID").ToString();
                param["OrderSource"]     = "01";
                param["FromParking"]     = SiteHelper.GetHashTableValueByKey(vehicle, "ParkingID").ToString();

                UserOrderVehicleManager uovm = new UserOrderVehicleManager();
                result = uovm.OrderVehicle(param);
                return(result);
            }
            catch
            {
                return(result);
            }
        }