Пример #1
0
        public static bool Add(ParkCarModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            model.CarModelName = model.CarModelName.Trim();
            model.CarModelID   = GuidGenerator.GetGuidString();
            IParkCarModel       factory   = ParkCarModelFactory.GetFactory();
            List <ParkCarModel> carModels = factory.QueryByParkingId(model.PKID);

            if (carModels.Count(p => p.CarModelName == model.CarModelName) != 0)
            {
                throw new MyException("车型名称已存在,请更改名称");
            }
            bool result = factory.Add(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkCarModel>(model, OperateType.Add);
            }
            return(result);
        }
Пример #2
0
        public static bool AddDefault(string parkingId, DbOperator dbOperator)
        {
            IParkCarModel factory = ParkCarModelFactory.GetFactory();

            return(factory.Add(GetDefaultParkCarModel(parkingId), dbOperator));
        }