Ejemplo n.º 1
0
 public static IParkMonthlyCarApply GetFactory()
 {
     if (factory == null)
     {
         Type type = Type.GetType("Common." + SystemDefaultConfig.DatabaseProvider + "Repository.ParkMonthlyCarApplyDAL,Common." + SystemDefaultConfig.DatabaseProvider + "Repository", true);
         factory = (IParkMonthlyCarApply)Activator.CreateInstance(type);
     }
     return(factory);
 }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        public static List <ParkMonthlyCarApply> QueryPage(List <string> parkingIds, string applyInfo, MonthlyCarApplyStatus?Status, DateTime start, DateTime end, int pagesize, int pageindex, out int total)
        {
            if (parkingIds == null || parkingIds.Count == 0)
            {
                throw new ArgumentNullException("parkingIds");
            }

            IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory();

            return(factory.QueryPage(parkingIds, applyInfo, Status, start, end, pagesize, pageindex, out total));
        }
Ejemplo n.º 4
0
        public static List <ParkMonthlyCarApply> QueryByAccountID(string accountId)
        {
            if (string.IsNullOrWhiteSpace(accountId))
            {
                throw new ArgumentNullException("accountId");
            }

            IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory();

            return(factory.QueryByAccountID(accountId));
        }
Ejemplo n.º 5
0
        public static ParkMonthlyCarApply QueryByRecordID(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            IParkMonthlyCarApply factory = ParkMonthlyCarApplyFactory.GetFactory();

            return(factory.QueryByRecordID(recordId));
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
        /// <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));
        }
Ejemplo n.º 8
0
        /// <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;
                }
            }
        }