Example #1
0
 public JsonResult SaveUpdate(ParkCarType model)
 {
     try
     {
         UpdateParkCarTypeDefault(model);
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.CarTypeID))
         {
             result = ParkCarTypeServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else
         {
             result = ParkCarTypeServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改失败");
             }
             return(Json(MyResult.Success()));
         }
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存车类型信息失败");
         return(Json(MyResult.Error("保存车类型信息失败")));
     }
 }
Example #2
0
 public JsonResult SellerCharge(decimal chargeBalance, string SellerID)
 {
     try
     {
         if (chargeBalance <= 0)
         {
             throw new MyException("充值金额不正确");
         }
         bool result = ParkSellerServices.SellerCharge(SellerID, chargeBalance, GetLoginUser.RecordID);
         if (!result)
         {
             throw new MyException("充值失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "商家充值失败");
         return(Json(MyResult.Error("充值失败")));
     }
 }
Example #3
0
        public ActionResult Index(string companyId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(companyId))
                {
                    return(RedirectToAction("Index", "BrowseError", new { errorMsg = "请打开扫一扫" }));
                }
                WX_ApiConfig config    = WXApiConfigServices.QueryWXApiConfig(companyId);
                var          timeStamp = DateTimeHelper.TransferUnixDateTime(DateTime.Now).ToString();
                var          nonceStr  = StringHelper.GetRndString(16);
                var          url       = Request.Url.ToString();

                var    accessToken = AccessTokenContainer.TryGetToken(config.AppId, config.AppSecret, false);
                var    ticket      = WxAdvApi.GetTicket(accessToken);
                string signature   = WxService.GetJsApiSignature(nonceStr, ticket.ticket, timeStamp, url);
                ViewBag.Signature = signature;
                ViewBag.AppId     = config.AppId;
                ViewBag.Timestamp = timeStamp;
                ViewBag.NonceStr  = nonceStr;
                return(View());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "调用扫码方法异常", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "BrowseError", new { errorMsg = "调用扫码方法异常" }));
            }
        }
Example #4
0
        public ActionResult GetParkingData()
        {
            JsonResult result = new JsonResult();

            try
            {
                if (string.IsNullOrEmpty(Request.Params["sellerId"]))
                {
                    return(result);
                }
                string sellerId = Request.Params["sellerId"].ToString();

                ParkSeller seller = ParkSellerServices.QueryBySellerId(sellerId);
                if (seller == null)
                {
                    throw new MyException("获取商家信息失败");
                }

                List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageId(seller.VID);
                result.Data = parkings;
                return(result);
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "优免券发放车场信息失败");
                return(result);
            }
        }
Example #5
0
 private string GetCompanyId(string pid, string bid, string gid)
 {
     try
     {
         if (!string.IsNullOrWhiteSpace(gid))
         {
             ParkGate gate = ParkGateServices.QueryByRecordId(gid);
             if (gate != null)
             {
                 bid = gate.BoxID;
             }
         }
         if (!string.IsNullOrWhiteSpace(pid))
         {
             BaseCompany company = CompanyServices.QueryByParkingId(pid);
             if (company != null)
             {
                 return(company.CPID);
             }
         }
         if (!string.IsNullOrWhiteSpace(bid))
         {
             BaseCompany company = CompanyServices.QueryByBoxID(bid);
             if (company != null)
             {
                 return(company.CPID);
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("QRCodeParkPayment", "GetCompanyId方法处理异常", ex, LogFrom.WeiXin);
     }
     return(string.Empty);
 }
Example #6
0
 public JsonResult Edit(ParkArea model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.AreaID))
         {
             result = ParkAreaServices.Add(model);
         }
         else
         {
             result = ParkAreaServices.Update(model);
         }
         if (!result)
         {
             throw new MyException("保存区域失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存区域信息失败");
         return(Json(MyResult.Error("保存失败")));
     }
 }
Example #7
0
 public ActionResult AddMyCar(string licenseplate)
 {
     try
     {
         WX_CarInfo model = new WX_CarInfo();
         model.AccountID = UserAccount.AccountID;
         model.PlateNo   = licenseplate.ToPlateNo();
         model.Status    = 2;
         int result = CarService.AddWX_CarInfo(model);
         if (result == 1)
         {
             return(Json(MyResult.Success("添加成功")));
         }
         if (result == 0)
         {
             return(Json(MyResult.Error("车牌号重复")));
         }
         return(Json(MyResult.Error("添加失败")));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("H5CarManageError", "添加车牌信息失败", ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("添加失败")));
     }
 }
Example #8
0
        public string GetPassTypeTreeData()
        {
            List <EnumContext> options = EnumHelper.GetEnumContextList(typeof(PassRemarkType));
            StringBuilder      str     = new StringBuilder();

            try
            {
                str.Append("[");

                int index = 1;
                foreach (var item in options)
                {
                    str.Append("{\"id\":\"" + item.EnumValue + "\",");
                    str.Append("\"attributes\":{\"type\":1},");
                    str.AppendFormat("\"text\":\"{0}\"", item.Description);
                    str.Append("}");
                    if (index != options.Count())
                    {
                        str.Append(",");
                    }
                    index++;
                }
                str.Append("]");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建放行类型树结构失败");
            }
            return(str.ToString());
        }
Example #9
0
        public string GetParkingData()
        {
            try
            {
                StringBuilder str = new StringBuilder();
                if (string.IsNullOrWhiteSpace(Request.Params["villageId"]))
                {
                    return(str.ToString());
                }

                int pageIndex = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int pageSize  = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);

                int totalCount = 0;
                List <BaseParkinfo> parkData = ParkingServices.QueryPage(Request.Params["villageId"].ToString(), pageIndex, pageSize, out totalCount);

                str.Append("{");
                str.Append("\"total\":" + totalCount + ",");
                str.Append("\"rows\":" + JsonHelper.GetJsonString(parkData) + ",");
                str.Append("\"index\":" + pageIndex);
                str.Append("}");
                return(str.ToString());
            }
            catch (Exception ex) {
                ExceptionsServices.AddExceptions(ex, "获取车场信息失败");
                return(string.Empty);
            }
        }
Example #10
0
        public JsonResult GetPassRemarkData(string parkingId)
        {
            JsonResult json = new JsonResult();

            try
            {
                if (string.IsNullOrWhiteSpace(parkingId))
                {
                    return(json);
                }
                List <BasePassRemark> remarks = PassRemarkServices.QueryByParkingId(parkingId, null);
                var result = from p in remarks select new {
                    ID          = p.ID,
                    PKID        = p.PKID,
                    RecordID    = p.RecordID,
                    PassType    = (int)p.PassType,
                    PassTypeDes = p.PassType.GetDescription(),
                    Remark      = p.Remark,
                };
                json.Data = result;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取车场放行备注失败");
            }
            return(json);
        }
Example #11
0
        public JsonResult SavePassRemark()
        {
            try
            {
                BasePassRemark model = new BasePassRemark();
                model.PKID     = Request.Params["ParkingID"];
                model.Remark   = Request.Params["Remark"];
                model.PassType = (PassRemarkType)int.Parse(Request.Params["PassType"].ToString());

                bool result = PassRemarkServices.Add(model);
                if (!result)
                {
                    throw new MyException("保存放行备注失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex) {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存放行备注失败");
                return(Json(MyResult.Error("保存放行备注失败")));
            }
        }
Example #12
0
 /// <summary>
 /// 根据车牌号月卡续期
 /// </summary>
 /// <returns></returns>
 public ActionResult PlateNoRenewal(string plateNo)
 {
     try
     {
         List <ParkUserCarInfo> carInfos = RechargeService.GetMonthCarInfoByPlateNumber(plateNo);
         if (carInfos == null || carInfos.Count == 0)
         {
             return(PageAlert("Index", "CardRenewal", new { RemindUserContent = "找不到该车辆信息,请检查车牌输入是否正确" }));
         }
         if (carInfos.Count == 1)
         {
             if (!carInfos.First().IsAllowOnlIne)
             {
                 return(PageAlert("Index", "CardRenewal", new { RemindUserContent = "该车辆不支持线上缴费" }));
             }
             return(RedirectToAction("MonthCardRenewal", "CardRenewal", new { plateNo = plateNo, cardId = carInfos.First().CardID, source = 1 }));
         }
         return(View(carInfos));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", string.Format("获取车牌信息失败,车牌号:" + plateNo), ex, LogFrom.WeiXin);
         return(PageAlert("Index", "CardRenewal", new { RemindUserContent = "获取车牌信息失败" }));
     }
 }
Example #13
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult GetCarTypeSingle(string carTypeId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(carTypeId))
                {
                    throw new MyException("获取车类编号失败");
                }
                List <ParkCarTypeSingle> models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    ParkCarTypeSingleServices.AddDefault(carTypeId);
                }
                models = ParkCarTypeSingleServices.QueryParkCarTypeByCarTypeID(carTypeId);
                if (models.Count == 0)
                {
                    throw new MyException("获取单双车牌配置失败");
                }

                return(Json(MyResult.Success("获取成功", models)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取单双车牌配置失败");
                return(Json(MyResult.Error("获取单双车牌配置失败")));
            }
        }
Example #14
0
        //[CheckPurview(Roles = "PK01020103")]
        public JsonResult SaveCarTypeSingle(ParkCarTypeSingle model)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(model.CarTypeID))
                {
                    throw new MyException("获取车类编号失败");
                }
                if (string.IsNullOrWhiteSpace(model.SingleID))
                {
                    throw new MyException("获取编号失败");
                }

                bool result = ParkCarTypeSingleServices.Update(model);
                if (!result)
                {
                    throw new MyException("保存失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存单双车牌配置失败");
                return(Json(MyResult.Error("保存单双车牌配置失败")));
            }
        }
Example #15
0
 public ActionResult AddOrUpdate(ParkDerateQRcode model)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(model.RecordID))
         {
             model.OperatorId = SellerLoginUser.SellerID;
             model.DataSource = DerateQRCodeSource.Seller;
             bool result = ParkDerateQRcodeServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加二维码失败");
             }
         }
         else
         {
             bool result = ParkDerateQRcodeServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改二维码失败");
             }
         }
         return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "保存成功" }));
     }
     catch (MyException ex)
     {
         return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = ex.Message }));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存优免二维码失败", LogFrom.WeiXin);
         return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "保存优免二维码失败" }));
     }
 }
Example #16
0
 public JsonResult SaveRole(SysRoles role)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(role.RecordID))
         {
             role.CPID = GetCurrentUserCompanyId;
             result    = SysRolesServies.AddSysRole(role);
         }
         else
         {
             result = SysRolesServies.UpdateRole(role);
         }
         return(Json(new MyResult
         {
             result = result,
             msg = result ? "保存成功" : "保存失败"
         }));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存角色失败");
         return(Json(MyResult.Error("保存失败")));
     }
 }
Example #17
0
        public ActionResult AddIdenticalQRCode(string recordId)
        {
            try
            {
                ParkDerateQRcode derate = ParkDerateQRcodeServices.QueryByRecordId(recordId);
                if (derate == null)
                {
                    throw new MyException("获取优免二维码失败");
                }

                derate.AlreadyUseTimes = 0;
                derate.CreateTime      = DateTime.Now;
                derate.OperatorId      = SellerLoginUser.SellerID;
                derate.DataSource      = DerateQRCodeSource.Seller;
                bool result = ParkDerateQRcodeServices.Add(derate);
                if (!result)
                {
                    throw new MyException("复制二维码失败");
                }
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "复制二维码保存成功" }));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "复制优免二维码失败");
                return(RedirectToAction("Index", "XFJMDerateQRCode", new { RemindUserContent = "复制优免二维码失败" }));
            }
        }
Example #18
0
        public JsonResult DeleteRole(string recordId)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(recordId))
                {
                    throw new MyException("获取编号失败");
                }

                bool result = SysRolesServies.DeleteRoleByRecordId(recordId);
                return(Json(new MyResult
                {
                    result = result,
                    msg = result ? "删除成功" : "删除失败"
                }));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "删除角色失败");
                return(Json(MyResult.Error("删除失败")));
            }
        }
Example #19
0
        /// <summary>
        /// 商家充值
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult SellerRechargePayment(decimal orderId)
        {
            try
            {
                OnlineOrder order = CheckOrder(orderId);
                if (order.OrderType != OnlineOrderType.SellerRecharge)
                {
                    throw new MyException("支付方法不正确");
                }

                if (string.IsNullOrWhiteSpace(order.MWebUrl))
                {
                    UnifiedPayModel model = GetUnifiedPayModel(order, string.Format("商家充值-{0}", order.PKName));
                }
                ViewBag.MWeb_Url = order.MWebUrl;
                return(View(order));
            }
            catch (MyException ex)
            {
                TxtLogServices.WriteTxtLogEx("H5WeiXinPayment_Error", "支付失败 orderId:{0};", orderId, ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/H5Seller/Index" }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5WeiXinPayment_Error", string.Format("商家充值支付失败 orderId:{0};", orderId), ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付失败,请重新支付", returnUrl = "/H5Seller/Index" }));
            }
        }
Example #20
0
        private static bool SyncSellerRecharge(OnlineOrder order, OrderPayWay payWay)
        {
            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                IParkSeller factory = ParkSellerFactory.GetFactory();
                ParkSeller  model   = factory.QueryBySellerId(order.InOutID);
                if (model == null)
                {
                    throw new MyException("商家不存在");
                }

                dbOperator.BeginTransaction();
                try
                {
                    ParkOrder pkOrder = ParkOrderServices.MarkSellerChargeOrder(model, order.Amount, model.SellerID, OrderSource.WeiXin, payWay, dbOperator);
                    if (order == null)
                    {
                        throw new MyException("创建充值订单失败");
                    }

                    bool result = factory.SellerRecharge(model.SellerID, order.Amount, dbOperator);
                    if (!result)
                    {
                        throw new MyException("商家充值失败");
                    }
                    dbOperator.CommitTransaction();
                    return(result);
                }
                catch (Exception ex) {
                    dbOperator.RollbackTransaction();
                    ExceptionsServices.AddExceptions(ex, "商家微信充值通知失败,订单编号:" + order.OrderID);
                    return(false);
                }
            }
        }
Example #21
0
        public string CreateVillageTreeOnLineStatus()
        {
            try
            {
                StringBuilder str = new StringBuilder();

                if (GetLoginUserVillages.Count == 0)
                {
                    return(str.ToString());
                }

                List <BaseCompany> companys   = GetLoginUserRoleCompany;
                BaseCompany        topCompany = companys.FirstOrDefault(p => p.CPID == GetCurrentUserCompanyId);
                if (topCompany == null)
                {
                    return(str.ToString());
                }

                str.Append("[");
                str.Append("{\"id\":\"" + topCompany.CPID + "\",");
                str.Append("\"iconCls\":\"my-company-icon\",");
                str.Append("\"attributes\":{\"type\":0},");
                str.Append("\"text\":\"" + topCompany.CPName + "\"");
                CreateSubordinateVillageTreeDataOnlineStatus(companys, topCompany.CPID, str);
                str.Append("}");
                str.Append("]");
                return(str.ToString());
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "构建小区树结构失败");
                return(string.Empty);
            }
        }
Example #22
0
        /// <summary>
        /// 手动退款(退款失败是调用)
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="certpath"></param>
        /// <returns></returns>
        public static bool ManualRefund(decimal orderId, string certpath)
        {
            TxtLogServices.WriteTxtLogEx("OnlineOrderServices", "方法名:{0},操作类型:{1},订单编号:{2},备注:{3}", "ManualRefund", "订单退款处理", orderId, "开始订单退款处理");

            bool refundResult = false;

            lock (order_lock)
            {
                try
                {
                    IOnlineOrder factory = OnlineOrderFactory.GetFactory();
                    OnlineOrder  order   = factory.QueryByOrderId(orderId);
                    if (order.Status == OnlineOrderStatus.RefundFail)
                    {
                        refundResult = Refund(order, certpath);
                    }
                    if (refundResult)
                    {
                        OperateLogServices.AddOperateLog(OperateType.Other, string.Format("手动执行退款操作,退款订单号:{0}", orderId));
                    }
                }
                catch (Exception ex)
                {
                    ExceptionsServices.AddExceptionToDbAndTxt("OnlineOrderServices", "手动执行退款操作失败", ex, LogFrom.WeiXin);
                }
            }
            return(refundResult);
        }
Example #23
0
        public ActionResult SaveBindMobile(string phone, string code)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(phone) || !new Regex("^1[0-9]{10}$").Match(phone).Success)
                {
                    throw new MyException("手机号码格式错误");
                }
                CheckBindTradePasswordCode(code, phone);


                bool result = WeiXinAccountService.WXBindingMobilePhone(WeiXinUser.AccountID, phone);
                if (!result)
                {
                    throw new MyException("绑定失败");
                }

                RemoveTradePasswordCooike();
                WeiXinUser.MobilePhone         = phone;
                Session["SmartSystem_WX_Info"] = WeiXinUser;

                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "绑定手机号失败", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("绑定失败")));
            }
        }
Example #24
0
        /// <summary>
        /// 临停缴费
        /// </summary>
        /// <returns></returns>
        public ActionResult ParkCarPayment(decimal orderId, int source = 0)
        {
            if (string.IsNullOrWhiteSpace(AliPayUserId))
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取用户信息失败" }));
            }
            try
            {
                OnlineOrder order = CheckOrder(orderId);
                if (order.OrderType != OnlineOrderType.ParkFee)
                {
                    throw new MyException("支付方法不正确");
                }

                string tradeNo = MakeAlipayTradeOrder(order);

                OnlineOrderServices.UpdatePrepayIdById(tradeNo, order.OrderID);
                order.PrepayId      = tradeNo;
                ViewBag.MaxWaitTime = DateTime.Now.AddMinutes(WXOtherConfigServices.GetTempParkingWeiXinPayTimeOut(order.CompanyID)).ToString("yyyy-MM-dd HH:mm:ss");
                return(View(order));
            }
            catch (MyException ex)
            {
                return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/QRCodeParkPayment/Index" }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("AliPay_Error", string.Format("支付失败 orderId:{0};AliUserId:{1}", orderId, AliPayUserId), ex, LogFrom.AliPay);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "支付失败,请重新支付", returnUrl = "/QRCodeParkPayment/Index" }));
            }
        }
Example #25
0
 /// <summary>
 /// 充值记录
 /// </summary>
 /// <returns></returns>
 public ActionResult GetRechargeRecordData(int orderSource, DateTime?start, DateTime?end, int page)
 {
     try
     {
         int pageSize            = 10;
         int total               = 0;
         List <ParkOrder> orders = ParkOrderServices.GetSellerRechargeOrder(SellerLoginUser.SellerID, orderSource, start, end, page, pageSize, out total);
         var models              = from p in orders
                                   select new
         {
             OrderNo     = p.OrderNo,
             OrderType   = p.OrderType.GetDescription(),
             PayWay      = p.PayWay.GetDescription(),
             Amount      = p.Amount,
             OrderSource = p.OrderSource.GetDescription(),
             OrderTime   = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
             Balance     = p.NewMoney
         };
         return(Json(MyResult.Success("", models)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptionToDbAndTxt("WeiXin_XFJM", "获取商家充值记录失败", ex, LogFrom.WeiXin);
         return(Json(MyResult.Error("获取商家充值记录失败")));
     }
 }
Example #26
0
 public void Index()
 {
     try
     {
         PayDictionary queryArray = YinShengCommon.TransQueryString(Request.Form.ToString());
         queryArray.Sort(PaySortEnum.Asc);//异步验证签名需要配需
         if (queryArray["sign"] == null)
         {
             Response.Write("缺少签名参数");
             Response.End();
         }
         string sign = HttpUtility.UrlDecode(queryArray["sign"]);
         queryArray.Remove("sign");
         string parStr = queryArray.GetParmarStr();
         if (YinShengCommon.SignVerify(parStr, sign))
         {
             Response.Write("success");
             Response.End();
         }
         else
         {
             Response.Write("签证签名不一致");
             Response.End();
         }
     }
     catch (Exception ex) {
         ExceptionsServices.AddExceptionToDbAndTxt("YSAsyncNotify", "支付通知出错", ex, LogFrom.WeiXin);
         Response.Write("error");
         Response.End();
     }
 }
Example #27
0
        public string GetParkSellerData()
        {
            StringBuilder strData = new StringBuilder();

            try
            {
                if (string.IsNullOrWhiteSpace(Request["villageId"]))
                {
                    return(string.Empty);
                }

                string villageId  = Request["villageId"].ToString();
                string sellerName = string.Empty;
                if (!string.IsNullOrWhiteSpace(Request["sellerName"]))
                {
                    sellerName = Request["sellerName"].Trim();
                }
                int page  = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows  = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
                int total = 0;
                List <ParkSeller> models = ParkSellerServices.QueryPage(villageId, sellerName, rows, page, out total);

                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(models) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "获取商家信息失败");
            }

            return(strData.ToString());
        }
Example #28
0
        public ActionResult ComputeParkingFee(string licensePlate, string parkingId)
        {
            licensePlate = licensePlate.ToPlateNo();
            if (!string.IsNullOrWhiteSpace(licensePlate) && licensePlate.Length > 2)
            {
                string firstPlate = HttpUtility.UrlEncode(licensePlate.Substring(0, 2), Encoding.GetEncoding("UTF-8"));
                Response.Cookies.Add(new HttpCookie("SmartSystem_WeiXinUser_DefaultPlate", firstPlate));
            }
            try
            {
                OnlineOrder model = new OnlineOrder();
                model.OrderTime = DateTime.Now;

                TempParkingFeeResult result = RechargeService.WXTempParkingFee(licensePlate, parkingId, LoginAccountID, model.OrderTime);
                if (result.Result == APPResult.NoNeedPay || result.Result == APPResult.RepeatPay)
                {
                    int type = result.Result == APPResult.NoNeedPay ? 0 : 1;
                    return(RedirectToAction("NotNeedPayment", "ParkingPayment", new { licensePlate = licensePlate, type = type, surplusMinutes = result.OutTime, entranceTime = result.EntranceDate }));
                }
                RechargeService.CheckCalculatingTempCost(result.Result);
                if (result.OrderSource == PayOrderSource.Platform)
                {
                    bool testResult = CarService.WXTestClientProxyConnectionByPKID(result.ParkingID);
                    if (!testResult)
                    {
                        throw new MyException("车场网络异常,暂无法缴停车费!");
                    }
                    int interfaceOrderState = InterfaceOrderServices.OrderWhetherEffective(result.Pkorder.OrderNo);
                    if (interfaceOrderState != 1)
                    {
                        string msg = interfaceOrderState == 2 ? "重复支付" : "订单已失效";
                        return(PageAlert("Index", "H5ParkingPayment", new { RemindUserContent = msg }));
                    }
                }
                model.ParkCardNo     = result.CardNo;
                model.PKID           = result.ParkingID;
                model.PKName         = result.ParkName;
                model.InOutID        = result.Pkorder.TagID;
                model.PlateNo        = result.PlateNumber;
                model.EntranceTime   = result.EntranceDate;
                model.ExitTime       = model.OrderTime.AddMinutes(result.OutTime);
                model.Amount         = result.Pkorder.Amount;
                model.PayDetailID    = result.Pkorder.OrderNo;
                model.DiscountAmount = result.Pkorder.DiscountAmount;
                model.OrderSource    = result.OrderSource;
                model.ExternalPKID   = result.ExternalPKID;
                ViewBag.Result       = result.Result;
                ViewBag.PayAmount    = result.Pkorder.PayAmount;
                return(View(model));
            }
            catch (MyException ex)
            {
                return(PageAlert("Index", "H5ParkingPayment", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5ParkingPaymentError", "计算缴费金额失败", ex, LogFrom.WeiXin);
                return(PageAlert("Index", "H5ParkingPayment", new { RemindUserContent = "计算缴费金额失败" }));
            }
        }
Example #29
0
        public ActionResult QueryWaitPayRecord(string parkingId, string plateNumber, int pageIndex)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(parkingId))
                {
                    throw new MyException("请选择车场");
                }

                int pageSize = 16;
                int recordTotalCount;
                List <ParkIORecord> records = ParkIORecordServices.QueryPageNotExit(parkingId, plateNumber, pageSize, pageIndex, out recordTotalCount);
                var result = from p in records
                             select new
                {
                    RecordID     = p.RecordID,
                    ImageUrl     = GetImagePath(p.EntranceImage),
                    PlateNumber  = p.PlateNumber,
                    EntranceTime = p.EntranceTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    ParkingId    = p.ParkingID
                };
                int    totalPage = (recordTotalCount + pageSize - 1) / pageSize;
                string msg       = string.Format("{0},{1}", recordTotalCount, totalPage);
                return(Json(MyResult.Success(msg, result)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "中央缴费获取待支付记录失败");
                return(Json(MyResult.Error("取待支付记录失败")));
            }
        }
Example #30
0
        public ActionResult GetParkingSuggestion(string query, string city, string lat, string lng)
        {
            try
            {
                string location = !string.IsNullOrWhiteSpace(lat) && !string.IsNullOrWhiteSpace(lng) ? string.Format("{0},{1}", lat, lng) : string.Empty;
                query = HttpUtility.UrlEncode(query);
                city  = HttpUtility.UrlEncode(city);
                PlaceSuggestion model = BaiDuLocationService.GetPlaceSuggestion(query, city, location);
                List <PlaceSuggestionResult> result = model.result.Where(p => p.location != null).Take(8).ToList();
                if (!model.IsSuccess)
                {
                    throw new MyException("查询周边车场失败");
                }

                return(Json(MyResult.Success(model.message, result)));
            }
            catch (MyException ex) {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "根据关键字查询地理名称", ex, LogFrom.WeiXin);
                return(Json(MyResult.Error("查询周边车场失败")));
            }
        }