public JsonResult AddOrUpdate(ParkDerateQRcode model) { try { if (string.IsNullOrWhiteSpace(model.RecordID)) { model.OperatorId = GetLoginUser.RecordID; model.DerateQRcodeType = 0; model.DataSource = DerateQRCodeSource.Platefrom; bool result = ParkDerateQRcodeServices.Add(model); if (!result) { throw new MyException("添加二维码成功"); } } else { bool result = ParkDerateQRcodeServices.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("保存优免二维码失败"))); } }
public ActionResult GetNextSurplusTime(int seconds) { if (seconds != -1) { int surSeconds = --seconds; if (surSeconds < 1) { return(Json(MyResult.Success("能再次获取"))); } return(Json(MyResult.Error("不能获取", surSeconds))); } var code_time_cookie = Request.Cookies["SmartSystem_BindTradePassword_Code_GetTime"]; DateTime nowTime = DateTime.Now; if (code_time_cookie == null || DateTime.Parse(code_time_cookie.Value).AddMinutes(1) <= nowTime) { return(Json(MyResult.Success("能再次获取"))); } TimeSpan countdownSpan = DateTime.Parse(code_time_cookie.Value).AddMinutes(1) - nowTime; int surplusSeconds = (int)Math.Round(countdownSpan.TotalSeconds, 0); if (surplusSeconds > 0) { return(Json(MyResult.Error("不能获取", surplusSeconds))); } return(Json(MyResult.Success("能再次获取"))); }
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("充值失败"))); } }
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("保存失败"))); } }
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("添加失败"))); } }
//[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("获取单双车牌配置失败"))); } }
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("保存失败"))); } }
public JsonResult GetParkDeviceParam(string deviceId) { try { ParkDevice device = ParkDeviceServices.QueryParkDeviceByRecordId(deviceId); if (device == null) { throw new MyException("获取设备失败"); } if (device.DeviceType != DeviceType.NZ_CONTROL) { throw new MyException("设备类型不正确"); } ParkDeviceParam deviceParam = ParkDeviceServices.QueryParkDeviceParamByDID(deviceId); return(Json(MyResult.Success("获取成功", deviceParam))); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "删除设备信息失败"); return(Json(MyResult.Error("删除设备信息失败"))); } }
public JsonResult DownloadQRCode(string gateId, int size) { try { List <int> dics = new List <int>(); dics.Add(258); dics.Add(344); dics.Add(430); dics.Add(860); dics.Add(1280); List <string> imgs = new List <string>(); ParkGate gate = ParkGateServices.QueryByRecordId(gateId); if (gate == null) { throw new MyException("获取通道信息失败"); } BaseCompany company = CompanyServices.QueryByBoxID(gate.BoxID); if (company == null) { throw new MyException("获取单位信息失败"); } ParkBox box = ParkBoxServices.QueryByRecordId(gate.BoxID); if (box == null) { throw new MyException("获取岗亭信息失败"); } ParkArea area = ParkAreaServices.QueryByRecordId(box.AreaID); if (area == null) { throw new MyException("获取区域信息失败"); } BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(area.PKID); if (parking == null) { throw new MyException("获取车场信息失败"); } string content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}", SystemDefaultConfig.SystemDomain, parking.PKID, gate.GateID); foreach (var item in dics) { string parkingName = string.Format("{0}_{1}_{2}_{3}_{4}", parking.PKName, area.AreaName, box.BoxName, gate.GateName, item); string result = QRCodeServices.GenerateQRCode(company.CPID, content, item, parkingName); imgs.Add(item.ToString() + "|" + result); } return(Json(MyResult.Success("", imgs))); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "下载二维码失败"); return(Json(MyResult.Error("下载二维码失败"))); } }
public JsonResult SaveEdit(ParkCarModel model) { try { bool result = false; if (string.IsNullOrWhiteSpace(model.CarModelID))//增加 { result = ParkCarModelServices.Add(model); if (!result) { throw new MyException("添加失败"); } return(Json(MyResult.Success())); } else //修改 { result = ParkCarModelServices.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("保存车型信息失败"))); } }
public MyResult AddNewOrder([FromBody] OrderInfo data) { if (string.IsNullOrWhiteSpace(data.OrderNumber)) { return(MyResult.Error("快递单号不能为空!")); } if (string.IsNullOrWhiteSpace(data.SenderPhone)) { return(MyResult.Error("寄件人电话不能为空!")); } if (string.IsNullOrWhiteSpace(data.JBBWName)) { return(MyResult.Error("津巴布韦姓名不能为空!")); } if (string.IsNullOrWhiteSpace(data.JBBWPhone)) { return(MyResult.Error("津巴布韦电话不能为空!")); } if (string.IsNullOrWhiteSpace(data.JBBWAddress)) { return(MyResult.Error("津巴布韦地址不能为空!")); } bool re = OrderBLL.AddNewOrder(data); return(re ? MyResult.OK() : MyResult.Error()); }
public JsonResult Delete(string companyId) { try { List <BaseCompany> companys = CompanyServices.QueryCompanysByMasterID(companyId); if (companys.Count > 0) { throw new MyException("请先删除下属单位"); } bool result = CompanyServices.Delete(companyId); 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("删除失败"))); } }
public JsonResult EditCompany(BaseCompany model) { try { bool result = false; if (string.IsNullOrWhiteSpace(model.CPID)) { result = CompanyServices.Add(model); } else { BaseCompany company = CompanyServices.QueryCompanyByRecordId(model.CPID); if (string.IsNullOrWhiteSpace(company.MasterID) && !string.IsNullOrWhiteSpace(model.MasterID)) { throw new MyException("当前修改单位为顶级单位,不能属于任何单位"); } result = CompanyServices.Update(model); } if (!result) { throw new MyException("保存单位信息失败"); } UpdateCompanyCacheData(model); return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "单位管理保存单位信息失败"); return(Json(MyResult.Error("保存单位信息失败"))); } }
public JsonResult PostFeeRuleFile() { string info = string.Empty; try { HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; if (files.Count > 0) { int fileLen = files[0].ContentLength;//获取上传文件的大小 byte[] input = new byte[fileLen]; System.IO.Stream UpLoadStream = files[0].InputStream; UpLoadStream.Read(input, 0, fileLen); UpLoadStream.Position = 0; System.IO.StreamReader sr = new System.IO.StreamReader(UpLoadStream, System.Text.Encoding.UTF8); string content = sr.ReadToEnd(); sr.Close(); sr.Dispose(); UpLoadStream.Close(); UpLoadStream.Dispose(); return(Json(MyResult.Success("", content))); } else { return(Json(MyResult.Error("获取上传文件失败"))); } } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "上传收费规则文件失败"); return(Json(MyResult.Error("上传收费规则文件失败"))); } }
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("保存车类型信息失败"))); } }
public JsonResult SaveConfig(BaseParkinfo model) { try { if (string.IsNullOrWhiteSpace(model.PKID)) { throw new MyException("获取配置编号失败"); } bool result = ParkingServices.UpdateParkSettleConfig(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("保存失败"))); } }
//[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("保存单双车牌配置失败"))); } }
public JsonResult QueryRemotelyOpenGateData() { try { List <string> parkingIds = new List <string>(); if (!string.IsNullOrWhiteSpace(Request.Params["parkingId"])) { parkingIds.Add(Request.Params["parkingId"]); } else { List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(GetLoginUserVillages.Select(p => p.VID).ToList()); if (parkings.Count > 0) { parkingIds.AddRange(parkings.Select(p => p.PKID)); } } string areaId = Request.Params["areaId"]; string boxId = Request.Params["boxId"]; int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]); int rows = 15; int recordTotalCount = 0; List <RemotelyOpenGateView> models = ParkGateServices.QueryRemotelyOpenGate(parkingIds, areaId, boxId, page, rows, out recordTotalCount); return(Json(MyResult.Success("", models))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "微信获取远程开闸数据失败"); return(Json(MyResult.Error("获取失败"))); } }
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("保存放行备注失败"))); } }
public JsonResult OpenGate(string parkingId, string gateId, string remark) { try { int result = AdminOperateServices.RemoteGate(AdminLoginUser.RecordID, parkingId, gateId, remark); if (result == 0) { return(Json(MyResult.Success())); } if (result == 1) { throw new MyException("车场网络异常"); } if (result == 2) { throw new MyException("通道不支持远程开门"); } throw new MyException("开闸失败"); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "远程开闸失败"); return(Json(MyResult.Error("远程开闸失败"))); } }
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("删除失败"))); } }
public JsonResult SaveParkDerate(ParkDerate model) { try { model = CheckParkDerate(model); List <ParkDerateIntervar> derateintervars = CheckParkDerateIntervar(model.DerateType, model.DerateID); model.DerateIntervar = derateintervars; if (string.IsNullOrWhiteSpace(model.DerateID)) { bool result = ParkDerateServices.Add(model); if (!result) { throw new MyException("添加失败"); } } else { bool result = ParkDerateServices.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("保存失败"))); } }
public ActionResult CheckPayTimeOut(string eTime, decimal orderId) { DateTime endtime; if (!DateTime.TryParse(eTime, out endtime)) { return(Json(MyResult.Error("支付异常"))); } DateTime nowTime = DateTime.Now; if (endtime < nowTime) { return(Json(MyResult.Error(string.Format("{0}分{1}秒", "00", "00")))); } TimeSpan countdownSpan = endtime - nowTime; if (countdownSpan.TotalSeconds > 0) { string mm = countdownSpan.Minutes >= 10 ? countdownSpan.Minutes.ToString() : "0" + countdownSpan.Minutes.ToString(); string ss = countdownSpan.Seconds >= 10 ? countdownSpan.Seconds.ToString() : "0" + countdownSpan.Seconds.ToString(); string syTime = string.Format("{0}分{1}秒", mm, ss); return(Json(MyResult.Success(syTime))); } return(Json(MyResult.Error("支付超过时限"))); }
public JsonResult PublishMenu(string companyId) { try { WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(companyId); if (config == null || string.IsNullOrWhiteSpace(config.AppId) || string.IsNullOrWhiteSpace(config.AppSecret) || string.IsNullOrWhiteSpace(config.SystemName)) { throw new MyException("获取微信基础信息失败,请确认微信基础信息已配置"); } var accessToken = AccessTokenContainer.TryGetToken(config.AppId, config.AppSecret, false); var buttonGroup = ToButtonGroup(WXMenuServices.GetMenus(companyId)); TxtLogServices.WriteTxtLogEx("PublishMenu", JsonHelper.GetJsonString(buttonGroup)); var result = WxApi.CreateMenu(companyId, accessToken, buttonGroup); 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("发布菜单失败"))); } }
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("绑定失败"))); } }
public JsonResult SaveEdit(BWYGateMapping model) { try { bool result = false; if (string.IsNullOrWhiteSpace(model.RecordID)) { model.DataSource = 0; result = BWYGateMappingServices.Add(model); if (!result) { throw new MyException("添加失败"); } return(Json(MyResult.Success())); } else { result = BWYGateMappingServices.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("保存岗亭信息失败"))); } }
/// <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("获取商家充值记录失败"))); } }
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("查询周边车场失败"))); } }
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("取待支付记录失败"))); } }
public JsonResult SaveBlackList(ParkBlacklist model) { try { model.PlateNumber = model.PlateNumber.ToPlateNo(); if (string.IsNullOrWhiteSpace(model.RecordID)) { bool result = ParkBlacklistServices.Add(model); if (!result) { throw new MyException("保存失败"); } } else { bool result = ParkBlacklistServices.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("保存失败"))); } }