public bool AgainApply(ParkMonthlyCarApply model) { using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { model.ApplyDateTime = DateTime.Now; model.ApplyStatus = Entities.MonthlyCarApplyStatus.Applying; StringBuilder strSql = new StringBuilder(); strSql.Append("update ParkMonthlyCarApply set PKID=@PKID,CarTypeID=@CarTypeID,CarModelID=@CarModelID,ApplyName=@ApplyName,ApplyMoblie=@ApplyMoblie,PlateNo=@PlateNo,PKLot=@PKLot,FamilyAddress=@FamilyAddress,ApplyRemark=@ApplyRemark,ApplyStatus=@ApplyStatus,ApplyDateTime=@ApplyDateTime "); strSql.Append(" where RecordID=@RecordID"); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", model.RecordID); dbOperator.AddParameter("PKID", model.PKID); dbOperator.AddParameter("CarTypeID", model.CarTypeID); dbOperator.AddParameter("CarModelID", model.CarModelID); dbOperator.AddParameter("ApplyName", model.ApplyName); dbOperator.AddParameter("ApplyMoblie", model.ApplyMoblie); dbOperator.AddParameter("PlateNo", model.PlateNo); dbOperator.AddParameter("PKLot", model.PKLot); dbOperator.AddParameter("FamilyAddress", model.FamilyAddress); dbOperator.AddParameter("ApplyRemark", model.ApplyRemark); dbOperator.AddParameter("ApplyStatus", (int)model.ApplyStatus); dbOperator.AddParameter("ApplyDateTime", model.ApplyDateTime); return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0); } }
public bool Add(ParkMonthlyCarApply model) { using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { model.ApplyDateTime = DateTime.Now; model.ApplyStatus = Entities.MonthlyCarApplyStatus.Applying; model.RecordID = GuidGenerator.GetGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO ParkMonthlyCarApply(RecordID,AccountID,PKID,CarTypeID,CarModelID,ApplyName,ApplyMoblie,PlateNo,PKLot,FamilyAddress,ApplyRemark,ApplyStatus,ApplyDateTime)"); strSql.Append(" values(@RecordID,@AccountID,@PKID,@CarTypeID,@CarModelID,@ApplyName,@ApplyMoblie,@PlateNo,@PKLot,@FamilyAddress,@ApplyRemark,@ApplyStatus,@ApplyDateTime)"); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", model.RecordID); dbOperator.AddParameter("AccountID", model.AccountID); dbOperator.AddParameter("PKID", model.PKID); dbOperator.AddParameter("CarTypeID", model.CarTypeID); dbOperator.AddParameter("CarModelID", model.CarModelID); dbOperator.AddParameter("ApplyName", model.ApplyName); dbOperator.AddParameter("ApplyMoblie", model.ApplyMoblie); dbOperator.AddParameter("PlateNo", model.PlateNo); dbOperator.AddParameter("PKLot", model.PKLot); dbOperator.AddParameter("FamilyAddress", model.FamilyAddress); dbOperator.AddParameter("ApplyRemark", model.ApplyRemark); dbOperator.AddParameter("ApplyStatus", (int)model.ApplyStatus); dbOperator.AddParameter("ApplyDateTime", model.ApplyDateTime); return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0); } }
/// <summary> /// 提交申请 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Add(ParkMonthlyCarApply model) { if (model == null) { throw new ArgumentNullException("model"); } IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory(); return(factory.Add(model)); }
public bool Passed(ParkMonthlyCarApply monthlyCarApply, DbOperator dbOperator) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ParkMonthlyCarApply set ApplyStatus=@ApplyStatus,AuditRemark=@AuditRemark,CarTypeID=@CarTypeID,CarModelID=@CarModelID where RecordID=@RecordID "); dbOperator.ClearParameters(); dbOperator.AddParameter("RecordID", monthlyCarApply.RecordID); dbOperator.AddParameter("CarTypeID", monthlyCarApply.CarTypeID); dbOperator.AddParameter("CarModelID", monthlyCarApply.CarModelID); dbOperator.AddParameter("ApplyStatus", (int)MonthlyCarApplyStatus.Passed); dbOperator.AddParameter("AuditRemark", monthlyCarApply.AuditRemark); return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0); }
/// <summary> /// 重新提交申请 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool AgainApply(ParkMonthlyCarApply model) { if (model == null) { throw new ArgumentNullException("model"); } if (string.IsNullOrWhiteSpace(model.RecordID)) { throw new ArgumentNullException("RecordID"); } IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory(); return(factory.AgainApply(model)); }
public ActionResult Refused(string recordId) { try { ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId); if (monthlyCarApply == null) { throw new MyException("申请信息不存在"); } return(View(monthlyCarApply)); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin); return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "拒绝失败" })); } }
/// <summary> /// 拒绝 /// </summary> /// <param name="recordId"></param> /// <param name="remark">拒绝原因</param> /// <returns></returns> public static bool Refused(string recordId, string remark) { if (string.IsNullOrWhiteSpace(recordId)) { throw new ArgumentNullException("RecordID"); } IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory(); ParkMonthlyCarApply model = factory.QueryByRecordID(recordId); if (model == null) { throw new MyException("需要拒绝的申请不存在"); } if (model.ApplyStatus != MonthlyCarApplyStatus.Applying) { throw new MyException("只有申请中的状态才能拒绝"); } return(factory.Refused(recordId, remark)); }
public ActionResult Passed(string recordId) { try { List <BaseVillage> villages = VillageServices.QueryVillageByEmployeeMobilePhone(WeiXinUser.MobilePhone); List <EnumContext> parkContexts = new List <EnumContext>(); if (villages.Count > 0) { List <BaseParkinfo> parkings = ParkingServices.QueryParkingByVillageIds(villages.Select(p => p.VID).ToList()); foreach (var item in parkings) { EnumContext model = new EnumContext(); model.Description = item.PKName; model.EnumString = item.PKID; parkContexts.Add(model); } } ViewBag.ParkContexts = parkContexts; ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(recordId); if (monthlyCarApply == null) { throw new MyException("申请信息不存在"); } List <ParkArea> areas = ParkAreaServices.GetParkAreaByParkingId(monthlyCarApply.PKID); List <EnumContext> areaContexts = new List <EnumContext>(); foreach (var item in areas) { EnumContext model = new EnumContext(); model.Description = item.AreaName; model.EnumString = item.AreaID; areaContexts.Add(model); } ViewBag.AreaContexts = areaContexts; List <EnumContext> gateContexts = new List <EnumContext>(); foreach (var item in areaContexts) { List <ParkGate> gates = ParkGateServices.QueryByParkAreaRecordIds(new List <string>() { item.EnumString }); foreach (var gate in gates) { EnumContext model = new EnumContext(); model.Description = gate.GateName; model.EnumString = string.Format("{0}|{1}", gate.GateID, item.EnumString); gateContexts.Add(model); } } ViewBag.GateContexts = gateContexts; return(View(monthlyCarApply)); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("AdminAduitCarApply", "查看月租车申请详情失败", ex, LogFrom.WeiXin); return(RedirectToAction("Index", "AdminAduitCarApply", new { RemindUserContent = "审核失败" })); } }
/// <summary> /// 审核通过 /// </summary> /// <param name="recordId"></param> /// <returns></returns> public static bool Passed(string RecordID, string AuditRemark, string CarTypeID, string CarModelID, string AreaIDS, string GateID, string OperatorId) { if (string.IsNullOrWhiteSpace(CarTypeID)) { throw new MyException("获取车类失败"); } if (string.IsNullOrWhiteSpace(CarModelID)) { throw new MyException("获取车型失败"); } ParkMonthlyCarApply monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(RecordID); if (monthlyCarApply == null) { throw new MyException("该申请不存在"); } if (monthlyCarApply.ApplyStatus != MonthlyCarApplyStatus.Applying) { throw new MyException("该申请是申请中状态"); } monthlyCarApply.CarModelID = CarModelID; monthlyCarApply.CarTypeID = CarTypeID; monthlyCarApply.AuditRemark = AuditRemark; BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(monthlyCarApply.PKID); if (parking == null) { throw new MyException("车场信息不存在"); } BaseEmployee employee = GenerateBaseEmployeeModel(parking.VID, monthlyCarApply.ApplyName, monthlyCarApply.ApplyMoblie, monthlyCarApply.FamilyAddress); EmployeePlate plate = GenerateEmployeePlateModel(employee, parking.VID, monthlyCarApply.PlateNo); BaseCard card = GenerateCardModel(parking, employee, plate, OperatorId); ParkGrant parkGrant = GenerateParkGrantModel(parking, plate, card, monthlyCarApply.PKLot, monthlyCarApply.CarModelID, monthlyCarApply.CarTypeID, AreaIDS, GateID); using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { try { dbOperator.BeginTransaction(); bool result = ParkGrantServices.Add(employee, plate, card, parkGrant, dbOperator); if (!result) { throw new MyException("保存车辆信息失败"); } IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory(); result = factory.Passed(monthlyCarApply, dbOperator); if (!result) { throw new MyException("修改申请状态失败"); } dbOperator.CommitTransaction(); monthlyCarApply = ParkMonthlyCarApplyServices.QueryByRecordID(monthlyCarApply.RecordID); OperateLogServices.AddOperateLog <ParkMonthlyCarApply>(monthlyCarApply, OperateType.Update); return(result); } catch { dbOperator.RollbackTransaction(); throw; } } }