Esempio n. 1
0
        private void Main_Load(object sender, EventArgs e)
        {
            ControlExpansion.ButtonExpansion.ClearFocus(this.Controls);

            try
            {
                //加载自定义字体
                Fonts.FontFactory.InitiailseFont();
                //实例化字体
                Font ledFont = new Font(Fonts.FontFactory.LedFont.Families[0], lParkingVehicleCount.Font.Size, lParkingVehicleCount.Font.Style);
                //场内车辆数
                lParkingVehicleCount.Font = ledFont;
                //出场车辆数
                lExitVehicleCount.Font = ledFont;


                //获取停车场信息
                IParkingLotInfoService parkingLotInfoService = BLL.Container.Container.Resolve <IParkingLotInfoService>();
                m_ParkingLotInfo = parkingLotInfoService.GetModels().FirstOrDefault();

                EnterDoor = new Enter(m_ParkingLotInfo, EnterInfoShow);
                ExitDoor  = new Exit(m_ParkingLotInfo, ExitInfoShow);

                //初始化摄像机控制器
                m_CameraController = new Camera.Controller(Application.StartupPath + @"\Imgs");
                m_CameraController.FindCameraChange    += FindCamera;
                m_CameraController.PlateReceivedChange += PlateReceived;
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public static ParkingLotInfo ModifyConfiguration(ParkingLotService service)
        {
            ParkingLotInfo parkingLot = new ParkingLotInfo();

            Console.WriteLine("Which record you wants to modify");
            Console.Write("Name of the parking lot : ");
            var id = service.HasParkingLot(Console.ReadLine());

            if (id != 0)
            {
                parkingLot.ParkingLotId = id;
                Console.Write("Enter vehical type : ");
                var parkingLotInfoId = service.GetParkingLotId(Console.ReadLine());
                if (parkingLotInfoId != 0)
                {
                    parkingLot.Id = parkingLotInfoId;
                    Console.Write("Rate : ");
                    Int32.TryParse(Console.ReadLine(), out int rate);
                    parkingLot.Rate = rate;
                    Console.Write("Space : ");
                    Int32.TryParse(Console.ReadLine(), out int space);
                    parkingLot.Space = space;
                    return(parkingLot);
                }
            }

            return(null);
        }
Esempio n. 3
0
        public void Update(ParkingLotInfo t)
        {
            string sql = @"UPDATE CBParkingLotInfo SET ParkingName = @ParkingName
            , Description = @Description
            , RentChargeAmount = @RentChargeAmount
            , ChargeMode = @ChargeMode
            , OpenMode = @OpenMode
            , FreeMinutes = @FreeMinutes
            , DailyLimit = @DailyLimit
            , FirstCharge = @FirstCharge
            , FirstMoney = @FirstMoney
            , TwoCharge = @TwoCharge
            , TwoMoney = @TwoMoney
            , ThreeCharge = @ThreeCharge
            , ThreeMoney = @ThreeMoney
            , FourCharge = @FourCharge
            , FourMoney = @FourMoney
            , FiveCharge = @FiveCharge
            , FiveMoney = @FiveMoney
            , SixCharge = @SixCharge
            , SixMoney = @SixMoney
            , SevenCharge = @SevenCharge
            , SevenMoney = @SevenMoney
            , EightCharge = @EightCharge
            , EightMoney = @EightMoney
            , NineCharge = @NineCharge
            , NineMoney = @NineMoney
            , TenCharge = @TenCharge
            , TenMoney = @TenMoney WHERE ID = @ID;";

            using (IDbConnection connection = DbConnectionFactory.Create())
            {
                connection.Execute(sql, t);
            }
        }
Esempio n. 4
0
        public void Delete(ParkingLotInfo t)
        {
            string sql = "DELETE FROM CBParkingLotInfo WHERE ID =@ID";

            using (IDbConnection connection = DbConnectionFactory.Create())
            {
                connection.Execute(sql, t);
            }
        }
        public bool ModifyParkingLotCongiguration(ParkingLotInfo info)
        {
            List oList     = this.ClientContext.Web.Lists.GetByTitle("ParkingLotInfo");
            var  oListItem = oList.GetItemById(info.Id);

            oListItem["Rate"]  = info.Rate;
            oListItem["Space"] = info.Space;
            oListItem.Update();
            this.ClientContext.ExecuteQuery();
            return(true);
        }
        public static ParkingLotInfo SetupParkingConfiguration(ParkingLotService service)
        {
            ParkingLotInfo parkingLot = new ParkingLotInfo();

            Console.WriteLine("Enter new details in parking");
            Console.Write("Parking Name : ");
            var id = service.HasParkingLot(Console.ReadLine());

            if (id != 0)
            {
                parkingLot.ParkingLotId = id;
                Console.Write("Vehical type : ");
                parkingLot.VehicalType = Console.ReadLine();
                while (true)
                {
                    Console.Write("Space : ");
                    Int32.TryParse(Console.ReadLine(), out int space);
                    if (space > 0)
                    {
                        parkingLot.Space = space;
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter correct space");
                    }
                }
                while (true)
                {
                    Console.Write("Rate/Hr. : ");
                    Int32.TryParse(Console.ReadLine(), out int rate);
                    if (rate > 0)
                    {
                        parkingLot.Rate = rate;
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter correct rate");
                    }
                }
                return(parkingLot);
            }
            else
            {
                Console.WriteLine("This parking lot is not available");
                return(null);
            }
        }
        public bool SetupParkingLot(ParkingLotInfo info)
        {
            List list = this.ClientContext.Web.Lists.GetByTitle("ParkingLotInfo");
            ListItemCreationInformation listItemCreation = new ListItemCreationInformation();
            ListItem listItem = list.AddItem(listItemCreation);

            listItem["Rate"]         = info.Rate;
            listItem["Space"]        = info.Space;
            listItem["VehicalType"]  = info.VehicalType;
            listItem["ParkingLotId"] = info.ParkingLotId;
            listItem.Update();
            this.ClientContext.ExecuteQuery();

            return(true);
        }
Esempio n. 8
0
        public static async Task <bool> AddParkingInfo(ParkingLotInfo parkInfo)
        {
            try
            {
                await firebase
                .Child("ParkingLotInfo")
                .PostAsync(new ParkingLotInfo()
                {
                    ParkingLotName = parkInfo.ParkingLotName, currentCount = parkInfo.currentCount, totalCapacity = parkInfo.totalCapacity
                });

                return(true);
            }
            catch { return(false); }
        }
Esempio n. 9
0
        public Exit(ParkingLotInfo parkingLotInfo, Action callback)
        {
            switch (parkingLotInfo.OpenMode)
            {
            case 0:     //识别即开闸
                ExitDoor = new ExitIdentificationOpening(callback);
                break;

            case 1:     //收费开闸
                ExitDoor = new ExitChargesOpenTheDoor(parkingLotInfo, callback);
                break;

            case 2:     //固定用户开闸
                ExitDoor = new ExitFixedUserOpenTheDoor(callback);
                break;
            }
        }
Esempio n. 10
0
        public Enter(ParkingLotInfo parkingLotInfo, Action <EnterVehicleInfo> callback)
        {
            switch (parkingLotInfo.OpenMode)
            {
            case 0:     //识别即开闸
                EnterDoor = new EnterIdentificationOpening(callback);
                break;

            case 1:     //收费开闸
                EnterDoor = new EnterChargesOpenTheDoor(callback);
                break;

            case 2:     //固定用户开闸
                EnterDoor = new EnterFixedUserOpenTheDoor(callback);
                break;
            }
        }
        public ExitChargesOpenTheDoor(ParkingLotInfo parkingLotInfo, Action callback)
        {
            this.m_ParkingLotInfo  = parkingLotInfo;
            this.PlateInfoCallBack = callback;

            switch (m_ParkingLotInfo.ChargeMode)
            {
            case 0:

                break;

            case 1:

                break;

            case 2:

                break;
            }
        }
Esempio n. 12
0
        public static async Task <bool> UpdateParkingLotInfo(ParkingLotInfo parkInfo)
        {
            try
            {
                var toUpdateUser = (await firebase
                                    .Child("ParkingLotInfo")
                                    .OnceAsync <ParkingLotInfo>()).Where(a => a.Object.ParkingLotName == parkInfo.ParkingLotName).FirstOrDefault();
                await firebase
                .Child("ParkingLotInfo")
                .Child(toUpdateUser.Key)
                .PutAsync(parkInfo);

                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error:{e}");
                return(false);
            }
        }
Esempio n. 13
0
        public int Add(ParkingLotInfo t)
        {
            string sql = @"INSERT INTO CBParkingLotInfo(ParkingName
            , Description
            , RentChargeAmount
            , ChargeMode
            , OpenMode
            , FreeMinutes
            , DailyLimit
            , FirstCharge
            , FirstMoney
            , TwoCharge
            , TwoMoney
            , ThreeCharge
            , ThreeMoney
            , FourCharge
            , FourMoney
            , FiveCharge
            , FiveMoney
            , SixCharge
            , SixMoney
            , SevenCharge
            , SevenMoney
            , EightCharge
            , EightMoney
            , NineCharge
            , NineMoney
            , TenCharge
            , TenMoney) VALUES (@ParkingName
            , @Description
            , @RentChargeAmount
            , @ChargeMode
            , @OpenMode
            , @FreeMinutes
            , @DailyLimit
            , @FirstCharge
            , @FirstMoney
            , @TwoCharge
            , @TwoMoney
            , @ThreeCharge
            , @ThreeMoney
            , @FourCharge
            , @FourMoney
            , @FiveCharge
            , @FiveMoney
            , @SixCharge
            , @SixMoney
            , @SevenCharge
            , @SevenMoney
            , @EightCharge
            , @EightMoney
            , @NineCharge
            , @NineMoney
            , @TenCharge
            , @TenMoney); select LAST_INSERT_ROWID(); ";

            using (IDbConnection connection = DbConnectionFactory.Create())
            {
                return(connection.Query <int>(sql, t).First());
            }
        }