Exemple #1
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();

                SysSettingManager settingManager = new SysSettingManager();
                UserInfoManager   uim            = new UserInfoManager();
                Hashtable         user           = uim.GetUserInfoByUserID(uid);
                if (user == null || user.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "您不是有效会员"));
                }

                OrdersManager om        = new OrdersManager();
                Hashtable     unpaid_ht = om.GetUnPaidOrderByUser(uid);
                if (unpaid_ht != null && unpaid_ht.Keys.Count > 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "存在未支付订单,申请押金退款失败"));
                }
                Hashtable uservehicle_ht = om.GetUserCurrentOrderVehicle(uid);
                if (uservehicle_ht != null && uservehicle_ht.Keys.Count > 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "存在进行中的订单,申请押金退款失败"));
                }

                DepositReturnManager depositManager = new DepositReturnManager();
                bool result = depositManager.ApplyReturnDeposit(uid);
                if (result)
                {
                    string returnDepositMode = settingManager.GetValueByKey("ReturnDepositMode");
                    //押金退还模式,1即时退,0后台退
                    if (returnDepositMode == "1")
                    {
                        Hashtable apply_ht = depositManager.GetAppyInfoByUid(uid);
                        Refund(apply_ht["ID"].ToString());
                    }
                    return(SiteHelper.GetJsonFromHashTable(null, "success", "成功申请押金退款", "data"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "申请押金退款失败"));
                }
            }
        }