Exemple #1
0
        public bool ModifyVisitorCar(ParkVisitor model, out string ErrorMessage)
        {
            ErrorMessage = "";
            try
            {
                using (DbOperator dbOperator = ConnectionManager.CreateConnection())
                {
                    model.DataStatus     = DataStatus.Normal;
                    model.LastUpdateTime = DateTime.Now;
                    model.HaveUpdate     = SystemDefaultConfig.DataUpdateFlag;

                    StringBuilder strSql = new StringBuilder();
                    strSql.Append(@"update ParkVisitor set AlreadyVisitorCount=@AlreadyVisitorCount,DataStatus=@DataStatus,HaveUpdate=@HaveUpdate,LastUpdateTime=@LastUpdateTime,PKID=@PKID,
                        VID=@VID,VisitorID=@VisitorID");
                    strSql.Append(" where RecordID=@RecordID");
                    dbOperator.ClearParameters();
                    dbOperator.AddParameter("AlreadyVisitorCount", model.AlreadyVisitorCount);
                    dbOperator.AddParameter("DataStatus", model.DataStatus);
                    dbOperator.AddParameter("HaveUpdate", model.HaveUpdate);
                    dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime);
                    dbOperator.AddParameter("PKID", model.PKID);
                    dbOperator.AddParameter("RecordID", model.RecordID);
                    dbOperator.AddParameter("VID", model.VID);
                    dbOperator.AddParameter("VisitorID", model.VisitorID);
                    return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0);
                }
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
            }
            return(false);
        }
Exemple #2
0
        public static bool ModifyVisitorCar(ParkVisitor mode, out string ErrorMessage)
        {
            if (mode == null)
            {
                throw new ArgumentNullException("mode");
            }

            IParkVisitor factory = ParkVisitorFactory.GetFactory();

            return(factory.ModifyVisitorCar(mode, out ErrorMessage));
        }
Exemple #3
0
        private bool AddVisitorCar(ParkVisitor model, DbOperator dbOperator)
        {
            model.DataStatus     = (int)DataStatus.Normal;
            model.LastUpdateTime = DateTime.Now;
            model.HaveUpdate     = SystemDefaultConfig.DataUpdateFlag;

            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ParkVisitor(RecordID,VisitorID,PKID,VID,LastUpdateTime,HaveUpdate,DataStatus,AlreadyVisitorCount)");
            strSql.Append(" values(@RecordID,@VisitorID,@PKID,@VID,@LastUpdateTime,@HaveUpdate,@DataStatus,@AlreadyVisitorCount)");

            dbOperator.ClearParameters();
            dbOperator.AddParameter("RecordID", model.RecordID);
            dbOperator.AddParameter("VisitorID", model.VisitorID);
            dbOperator.AddParameter("PKID", model.PKID);
            dbOperator.AddParameter("VID", model.VID);
            dbOperator.AddParameter("LastUpdateTime", model.LastUpdateTime);
            dbOperator.AddParameter("HaveUpdate", model.HaveUpdate);
            dbOperator.AddParameter("DataStatus", model.DataStatus);
            dbOperator.AddParameter("AlreadyVisitorCount", model.AlreadyVisitorCount);
            return(dbOperator.ExecuteNonQuery(strSql.ToString()) > 0);
        }
Exemple #4
0
        public ActionResult SaveCarVisitor()
        {
            try
            {
                VisitorInfo vistor = new VisitorInfo();
                vistor.RecordID = GuidGenerator.GetGuid().ToString();
                if (string.IsNullOrWhiteSpace(Request["villageId"]))
                {
                    throw new MyException("获取小区编号失败");
                }

                if (string.IsNullOrWhiteSpace(Request["plateNo"]))
                {
                    throw new MyException("获取车牌号失败");
                }

                if (string.IsNullOrWhiteSpace(Request["ParkingIds"]))
                {
                    throw new MyException("获取车场编号失败");
                }
                string villageId = Request["villageId"].ToString();

                DateTime start = DateTime.Now;
                if (string.IsNullOrWhiteSpace(Request["startTime"]) || !DateTime.TryParse(Request["startTime"], out start))
                {
                    throw new MyException("获取开始时间失败");
                }

                DateTime end = DateTime.Now;
                if (string.IsNullOrWhiteSpace(Request["endTime"]) || !DateTime.TryParse(Request["endTime"], out end))
                {
                    throw new MyException("获取结束时间失败");
                }

                vistor.PlateNumber        = Request["plateNo"].ToString();
                vistor.BeginDate          = start;
                vistor.EndDate            = end;
                vistor.VisitorCount       = int.Parse(Request["VisitorCount"].ToString());
                vistor.VisitorMobilePhone = Request["VisitorMobilePhone"].ToString();
                vistor.AccountID          = UserAccount.AccountID;
                vistor.CreateTime         = DateTime.Now;
                vistor.VisitorState       = 0;
                vistor.VID           = villageId;
                vistor.IsExamine     = 1;
                vistor.OperatorID    = UserAccount.AccountID;
                vistor.VisitorSource = 1;

                string[]           parkingIds  = Request["ParkingIds"].ToString().TrimEnd(',').Split(',');
                List <ParkVisitor> carVisitors = new List <ParkVisitor>();
                for (int i = 0; i < parkingIds.Length; i++)
                {
                    ParkVisitor car = new ParkVisitor();
                    car.RecordID            = GuidGenerator.GetGuid().ToString();
                    car.VisitorID           = vistor.RecordID;
                    car.PKID                = parkingIds[i];
                    car.VID                 = villageId;
                    car.AlreadyVisitorCount = 0;
                    carVisitors.Add(car);
                }
                vistor.ParkVisitors = carVisitors;
                bool result = ParkVisitorServices.Add(vistor);
                if (!result)
                {
                    throw new MyException("保存访客信息失败");
                }
                return(RedirectToAction("CarVisitorRecord", "H5CarVisitor"));
            }
            catch (MyException ex)
            {
                return(PageAlert("Index", "H5CarVisitor", new { RemindUserContent = ex.Message }));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptionToDbAndTxt("H5CarVisitorError", "获取访客车场失败", ex, LogFrom.WeiXin);
                return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取访客车场失败" }));
            }
        }