Esempio n. 1
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["VID"] == null || res["ReturnType"] == null || res["UID"].ToString().Trim().Length <= 0 || res["VID"].ToString().Trim().Length <= 0 || res["ReturnType"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();
                vid = res["VID"].ToString().Trim();
                //异常还车类型:1收费,2不收费
                returntype = res["ReturnType"].ToString().Trim();

                VehicleManager  vm         = new VehicleManager();
                UserInfoManager uim        = new UserInfoManager();
                OrdersManager   om         = new OrdersManager();
                Hashtable       vehicle_ht = vm.GetVehicleInfoByID(vid);
                if (vehicle_ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到相关车辆信息"));
                }
                Hashtable order_ht = om.GetLatestUserOrder(vehicle_ht["ID"].ToString());
                if (order_ht == null || order_ht.Keys.Count <= 0 || order_ht["ORDERSTATE"].ToString() != OrderState.Valid.GetHashCode().ToString())
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆当前未被任何用户占用"));
                }
                bool isSuccess = false;
                if (returntype == "1")
                {
                    isSuccess = uim.AbnormalReturnVehicle(order_ht["USERID"].ToString(), true);
                }
                else if (returntype == "2")
                {
                    isSuccess = uim.AbnormalReturnVehicle(order_ht["USERID"].ToString(), false);
                }
                if (!isSuccess)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "异常还车操作失败"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "success", "异常还车操作成功"));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 异常还车
        /// </summary>
        /// <param name="userID">用户id</param>
        /// <param name="type">费用支付,1收费,2免费</param>
        /// <returns></returns>
        private int AbnormalProcess(string ordernum, string type)
        {
            UserInfoManager userManager = new UserInfoManager();
            bool            result      = false;

            result = userManager.AbnormalReturnVehicle(ordernum, type == "1" ? true : false);
            return(result ? 1 : 0);
        }