Esempio n. 1
0
        //[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("保存单双车牌配置失败")));
            }
        }
Esempio n. 2
0
 public bool Add(ParkCarTypeSingle model)
 {
     if (model == null)
     {
         return(false);
     }
     using (DbOperator dbOperator = ConnectionManager.CreateConnection())
     {
         return(Add(new List <ParkCarTypeSingle>()
         {
             model
         }, dbOperator));
     }
 }
Esempio n. 3
0
        public static bool Update(ParkCarTypeSingle model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            IParkCarTypeSingle factory = ParkCarTypeSingleFactory.GetFactory();
            bool result = factory.Update(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkCarTypeSingle>(model, OperateType.Update);
            }
            return(result);
        }
Esempio n. 4
0
        public static bool Add(ParkCarTypeSingle model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }


            IParkCarTypeSingle factory = ParkCarTypeSingleFactory.GetFactory();

            model.SingleID = GuidGenerator.GetGuidString();

            bool result = factory.Add(model);

            if (result)
            {
                OperateLogServices.AddOperateLog <ParkCarTypeSingle>(model, OperateType.Add);
            }
            return(result);
        }
Esempio n. 5
0
        public bool Update(ParkCarTypeSingle model)
        {
            model.LastUpdateTime = DateTime.Now;
            model.HaveUpdate     = SystemDefaultConfig.DataUpdateFlag;

            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ParkCarTypeSingle set CarTypeID=@CarTypeID,Week=@Week,SingleType=@SingleType,DataStatus=@DataStatus,LastUpdateTime=@LastUpdateTime,HaveUpdate=@HaveUpdate");
            strSql.Append(" where SingleID=@SingleID");
            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                dbOperator.ClearParameters();
                dbOperator.AddParameter("CarTypeID", model.CarTypeID);
                dbOperator.AddParameter("Week", (int)model.Week);
                dbOperator.AddParameter("SingleType", (int)model.SingleType);
                dbOperator.AddParameter("DataStatus", (int)model.DataStatus);
                dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime);
                dbOperator.AddParameter("HaveUpdate", (int)model.HaveUpdate);
                dbOperator.AddParameter("SingleID", model.SingleID);

                return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0);
            }
        }