public ActionResult SaveBooking(string plateNo, string parkingId, string areaId, DateTime startTime, DateTime endTime) { try { WXReserveBitResult result = PkBitBookingServices.WXReservePKBit(WeiXinUser.AccountID, string.Empty, parkingId, areaId, plateNo, startTime, endTime); if (result.code == 0) { if (parkingId != result.Order.PKID) { throw new MyException("车场编号不一致"); } BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(parkingId); if (parking == null) { throw new MyException("获取车场信息失败"); } ViewBag.ParkingName = parking.PKName; ParkArea area = ParkAreaServices.QueryByRecordId(areaId); if (area == null) { throw new MyException("获取区域信息失败"); } ViewBag.AreaName = area.AreaName; ViewBag.PlateNo = plateNo; ViewBag.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss"); ViewBag.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss"); ViewBag.AreaId = areaId; return(View(result)); } if (result.code == 1) { throw new MyException("您已经预约过了,请勿重复预约"); } throw new MyException("预约失败[" + result.message + "]"); } catch (MyException ex) { return(PageAlert("Index", "ParkBitBooking", new { RemindUserContent = ex.Message })); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinWeb", "预约失败", ex, LogFrom.WeiXin); return(PageAlert("Index", "ParkBitBooking", new { RemindUserContent = "预约失败!" })); } }
public string ReservePKBitZH(string ProxyNo, string AccountID, string BitNo, string parking_id, string AreaID, string license_plate, DateTime start_time, DateTime end_time) { WXReserveBitResult result = new WXReserveBitResult(); result.code = -1; result.message = "预定车位失败"; result.BitNo = BitNo; try { WXServiceCallback callback = new WXServiceCallback(); return(callback.ReservePKBit(ProxyNo, AccountID, BitNo, parking_id, AreaID, license_plate, start_time, end_time)); } catch (Exception ex) { logger.Fatal("车位预定异常:WXReservePKBitZH()" + ex.Message + "\r\n"); } return(JsonHelper.GetJsonString(result)); }