async Task ExecuteLoadItemsCommand()
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                await Task.Delay(1000);

                Items.Clear();
                var items = await GateService.Trucks();

                foreach (var item in items)
                {
                    Items.Add(item);
                }

                if (Items.Count <= 0)
                {
                    NotFound = true;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                await Task.Delay(100);

                IsBusy = false;
            }
        }
        async void OnItemSelected(Truck truck)
        {
            try
            {
                if (truck == null)
                {
                    return;
                }


                if (truck.KIM == null)
                {
                    throw new SystemException("Truck Belum memilik KIM.");
                }

                var lastItem = await GateService.TruckLastChencUp(truck.Id);

                if (lastItem == null)
                {
                    throw new SystemException("Truck Belum Diajukan Untuk Dibuatkan KIM.");
                }

                var page = new DetailTruckPage();
                page.BindingContext = new DetailTruckPageViewModel(lastItem);
                await Shell.Current.Navigation.PushAsync(page);
            }
            catch (Exception ex)
            {
                MessagingCenter.Send <MessagingCenterAlert>(new MessagingCenterAlert {
                    Message = ex.Message, Title = "Error", Cancel = "Keluar"
                }, "message");
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 初始化总通道数
 /// </summary>
 public void init()
 {
     try
     {
         gateTotal = GateService.getInstance().getGateTotal();
         for (int i = 1; i <= gateTotal; i++)
         {
             zhuhai.monitorinfo.Monitor monitor = new zhuhai.monitorinfo.Monitor();
             monitor.gateNo = i;
             this.monitorList.Add(monitor);
         }
     }
     catch (Exception ex)
     {
         /*********************************上线时去掉 start****************************************************/
         for (int i = 1; i <= gateTotal; i++)
         {
             zhuhai.monitorinfo.Monitor monitor = new zhuhai.monitorinfo.Monitor();
             monitor.gateNo = i;
             this.monitorList.Add(monitor);
         }
         /*********************************上线时去掉 end****************************************************/
         if (MessageBox.Show(ex.Message + "\n是否退出系统?", "错误", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             System.Environment.Exit(0);
         }
     }
 }
Esempio n. 4
0
 void Awake()
 {
     DontDestroyOnLoad(this);
     Instance     = this;
     _GateService = new GateService();
     _GateService.Init();
     _GateService.AddCallback <LoginRes>(LoginCallback);
     _GateService.AddCallback <MatchRes>(MatchCallback);
 }
Esempio n. 5
0
        private async void ApproveAction()
        {
            var page     = new DetailTruckPage();
            var lastItem = await GateService.TruckLastChencUp(Model.TruckId);

            page.BindingContext = new DetailTruckPageViewModel(lastItem);
            await Shell.Current.Navigation.PushAsync(page);

            await Shell.Current.Navigation.PopModalAsync();
        }
Esempio n. 6
0
        public void TestAddFlight()
        {
            var gateRepository = new Mock <IGateRepository>();

            gateRepository.SetupGet(x => x.GatesStore).Returns(InitData);
            gateRepository.Setup(x => x.Get(1)).Returns(gateRepository.Object.GatesStore[0]);
            var service = new GateService(gateRepository.Object);
            var fight   = new Flight
            {
                ArrivalTime   = DateTime.Now.AddMinutes(10 * 31),
                DepartureTime = DateTime.Now.AddMinutes(11 * 31),
                FlightNumber  = "GNFlight11"
            };

            Assert.AreEqual(0, service.AddFlight(fight, 1));
        }
Esempio n. 7
0
        public void TestAddFlightOverlap()
        {
            var gateRepository = new Mock <IGateRepository>();

            gateRepository.SetupGet(x => x.GatesStore).Returns(InitData);
            gateRepository.Setup(x => x.Get(1)).Returns(gateRepository.Object.GatesStore[0]);
            var service = new GateService(gateRepository.Object);
            var fight   = new Flight
            {
                ArrivalTime   = gateRepository.Object.GatesStore[0].Flights[0].ArrivalTime.AddMinutes(20),
                DepartureTime = DateTime.Now,
                FlightNumber  = "GNFlight11"
            };

            Assert.AreEqual((int)ErrorCode.Overlap, service.AddFlight(fight, 1));
        }
Esempio n. 8
0
        public void TestAddFlightGateNotExist()
        {
            var gateRepository = new Mock <IGateRepository>();

            gateRepository.SetupGet(x => x.GatesStore).Returns(InitData);

            var service = new GateService(gateRepository.Object);
            var fight   = new Flight
            {
                ArrivalTime   = DateTime.Now,
                DepartureTime = DateTime.Now,
                FlightNumber  = "GNFlight11"
            };

            Assert.AreEqual((int)ErrorCode.InvalidGateNumber, service.AddFlight(fight, 3));
        }
        private async void OnInfoSelected(Truck truck)
        {
            try
            {
                if (truck == null)
                {
                    return;
                }

                if (truck.KIM == null)
                {
                    throw new SystemException("Truck Belum Memiliki KIM.");
                }



                var lastHistories = await GateService.TruckHistories(truck.Id);

                var lastIncoming = lastHistories.LastIncomming;

                if (lastIncoming != null && lastIncoming.Notes != null &&
                    lastIncoming.Notes.Count > 0)
                {
                    lastIncoming.TruckId = truck.Id;
                    var pageInfo = new GateTruckLastCheckUp(lastIncoming);
                    await Shell.Current.Navigation.PushModalAsync(pageInfo);
                }
                else
                {
                    MessagingCenter.Send <MessagingCenterAlert>(new MessagingCenterAlert
                    {
                        Message = "Tidak Ada Info Terakhir",
                        Title   = "Error",
                        Cancel  = "Keluar"
                    }, "message");
                }
            }
            catch (Exception ex)
            {
                MessagingCenter.Send <MessagingCenterAlert>(new MessagingCenterAlert
                {
                    Message = ex.Message,
                    Title   = "Error",
                    Cancel  = "Keluar"
                }, "message");
            }
        }
Esempio n. 10
0
 private async void RejectAction(PengajuanItem obj)
 {
     if (IsBusy)
     {
         return;
     }
     try
     {
         object result = null;
         if (await Account.UserInRole(UserType.Gate))
         {
             result = await GateService.Reject(Model.Id, Items.SelectMany(x => x.Items).ToList());
         }
         else
         {
             result = await ApprovalService.Reject(Model.Id, Items.SelectMany(x => x.Items).ToList());
         }
         if (result != null)
         {
             MessagingCenter.Send(new MessagingCenterAlert
             {
                 Title   = "Info",
                 Message = "Berhasil !",
                 Cancel  = "OK"
             }, "message");
             IsBusy = false;
             MessagingCenter.Send(Model, "approve");
             await Shell.Current.GoToAsync($"//Home");
         }
         else
         {
             throw new SystemException("Gagal... !, Periksa Kembali Data Anda");
         }
     }
     catch (Exception ex)
     {
         MessagingCenter.Send(new MessagingCenterAlert
         {
             Title   = "Error",
             Message = ex.Message,
             Cancel  = "OK"
         }, "message");
         IsBusy = false;
     }
 }
Esempio n. 11
0
        public HxswqhThresholdUpdateForm()
        {
            InitializeComponent();

            HxswqhThresholdValue hxswqhThresholdValue = GateService.getInstance().getHxswqhThreshold();

            if (hxswqhThresholdValue != null)
            {
                double biology = hxswqhThresholdValue.biology;
                double chem    = hxswqhThresholdValue.chem;
                textEdit_biology.Text = biology.ToString();
                textEdit_chem.Text    = chem.ToString();
            }
            else//为空时显示默认值
            {
                textEdit_biology.Text = biology_default.ToString();
                textEdit_chem.Text    = chem_default.ToString();
            }
        }
Esempio n. 12
0
        public SingleGateThresholdUpdateForm(int gateNo)
        {
            InitializeComponent();
            label_gateNo.Text = gateNo.ToString();
            this.gateNo       = gateNo;

            GateThresholdValue gateThresholdValue = GateService.getInstance().getGateThreshold(gateNo);

            //为空就是默认值
            if (gateThresholdValue == null)
            {
                textEdit_nuclear.Text     = nuclear_default.ToString();
                textEdit_temperature.Text = temperature_default.ToString();
            }
            else
            {
                textEdit_nuclear.Text     = gateThresholdValue.nuclear.ToString();
                textEdit_temperature.Text = gateThresholdValue.temperature.ToString();
            }
        }
        /// <summary>
        /// 手动选中每个值后,查找对应的闸机的阈值并显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void checkedListBoxControl_gate_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
        {
            int        index      = e.Index;
            CheckState checkState = e.State;

            //如果是当前项被选中,则获取该闸机的阈值显示出来
            if (selectedAllButton == false && checkState == CheckState.Checked)
            {
                GateThresholdValue gateThresholdValue = GateService.getInstance().getGateThreshold(index + 1);
                //为空就是默认值
                if (gateThresholdValue == null)
                {
                    textEdit_nuclear.Text     = nuclear_default.ToString();
                    textEdit_temperature.Text = temperature_default.ToString();
                }
                else
                {
                    textEdit_nuclear.Text     = gateThresholdValue.nuclear.ToString();
                    textEdit_temperature.Text = gateThresholdValue.temperature.ToString();
                }
            }
        }
Esempio n. 14
0
        private void btnOpenPort_Click(object sender, EventArgs e)
        {
            if (cmbPorts.Items.Count == 0)
            {
                Log("未找到计算机串口!");
                return;
            }

            string port = cmbPorts.Text;

            gateService = new GateService();
            bool flag = gateService.Open(port);

            if (flag)
            {
                Log("串口打开成功:" + port);
                btnOpenPort.Enabled = false;
                btnOpenGate.Enabled = true;
            }
            else
            {
                Log("串口打开失败:" + port);
            }
        }
        private void simpleButton_query_Click(object sender, EventArgs e)
        {
            IDictionary <string, object> strWhere = new Dictionary <string, object>();
            string name = textEdit_name.Text.Trim();

            string country = textEdit_country.Text;

            if (country != "" && country.Trim() != "")
            {
                strWhere.Add(ClearanceRecord.NATIONALITY_COLUMN_QUERY, country.Trim());
            }

            if (comboBox_sex.Text != "" && comboBox_sex.Text != "全部" && comboBox_sex.Text.Trim() != "")
            {
                if (comboBox_sex.Text.Trim().Equals("男"))
                {
                    strWhere.Add(ClearanceRecord.IS_MALE_COLUMN, true);
                }
                else
                {
                    strWhere.Add(ClearanceRecord.IS_MALE_COLUMN, false);
                }
            }

            DateTime dt = DateTime.Parse(dateTimePicker_startTime.Text + " " + dateTimePicker_startTime_time.Text);

            strWhere.Add(ClearanceRecord.NVR_STARTTIME_COLUMN_QUERY, dt);
            DateTime dt1 = DateTime.Parse(dateTimePicker_endTime.Text + " " + dateTimePicker_endTime_time.Text);

            strWhere.Add(ClearanceRecord.NVR_ENDTIME_COLUMN_QUERY, dt1);

            string abnormal     = comboBox_abnormal.Text;
            int    abnormalType = -1;

            if (abnormal != "全部")
            {
                abnormalType = zhuhai.util.AbnormalType.getIndexByName(abnormal);
                strWhere.Add(ClearanceRecord.ABNORMAL_TYPE_COLUMN, abnormalType);
            }

            string channel = comboBox__channel.Text;
            int    gateNo  = 0;

            if (channel == "全部")
            {
                gateNo = 0;
            }
            else
            {
                gateNo = int.Parse(channel);
                strWhere.Add(ClearanceRecord.GATE_ID_COLUMN, gateNo);
            }


            try
            {
                MessageBox.Show(GateService.getInstance().getGateRecordsNum(name, strWhere), "提示");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误");
            }
        }
Esempio n. 16
0
        public ShowClearanceInfoForm(DataRow row)
        {
            InitializeComponent();
            this.row               = row;
            nameLabel.Text         = row[ClearanceRecord.NAME_COLUMN].ToString();
            nationalityLabel.Text  = row[ClearanceRecord.NATIONALITY_COLUMN].ToString();
            idnoLabel.Text         = row[ClearanceRecord.ID_CODE_COLUMN].ToString();
            passTime.Text          = ((DateTime)row[ClearanceRecord.NVR_STARTTIME_COLUMN]).ToString("yyyy-MM-dd HH:mm:ss");
            exchannellabel.Text    = row[ClearanceRecord.GATE_ID_COLUMN].ToString();
            extempraturelabel.Text = row[ClearanceRecord.TEMPERATURE_COLUMN].ToString() + "℃";
            exceptionLabel.Text    = row[ClearanceRecord.NUCLEAR_COLUMN].ToString();
            string nuclear_detail = row[ClearanceRecord.NULCLEAR_DETAIL_COLUMN].ToString();

            if (nuclear_detail.Contains("铱"))
            {
                this.nuclearyilabel.Image = global::zhuhai.Properties.Resources.yired;
            }
            else
            {
                this.nuclearyilabel.Image = global::zhuhai.Properties.Resources.yiwhite;
            }
            if (nuclear_detail.Contains("钴"))
            {
                this.nucleargulabel.Image = global::zhuhai.Properties.Resources.gured;
            }
            else
            {
                this.nucleargulabel.Image = global::zhuhai.Properties.Resources.guwhite;
            }
            if (nuclear_detail.Contains("钍"))
            {
                this.nucleartulabel.Image = global::zhuhai.Properties.Resources.tured;
            }
            else
            {
                this.nucleartulabel.Image = global::zhuhai.Properties.Resources.tuwhite;
            }
            if (nuclear_detail.Contains("铯"))
            {
                this.nuclearselabel.Image = global::zhuhai.Properties.Resources.sered;
            }
            else
            {
                this.nuclearselabel.Image = global::zhuhai.Properties.Resources.sewhite;
            }
            if (nuclear_detail.Contains("钾"))
            {
                this.nuclearjialabel.Image = global::zhuhai.Properties.Resources.jiared;
            }
            else
            {
                this.nuclearjialabel.Image = global::zhuhai.Properties.Resources.jiawhite;
            }

            //if ((bool)row[ClearanceRecord.IS_HEALTHY_COLUMN])
            //{
            //    this.label_statuName.Text = "正常";
            //}
            //else
            //{
            //    this.label_statuName.Text = "异常";
            //}

            this.label_statuName.Text = row[ClearanceRecord.Unnormal_type_name_COLUMN].ToString();

            try
            {
                byte[]       bytes = GateService.getInstance().getPassengerPhoto(int.Parse(row[ClearanceRecord.ID_PHOTO_ID_COLUMN].ToString()));
                MemoryStream ms    = new MemoryStream(bytes, 0, bytes.Length);
                this.photoPictureBox.BackgroundImage = Image.FromStream(ms);
                ms.Close();
            }
            catch (Exception ex)
            {
                this.photoPictureBox.Image = global::zhuhai.Properties.Resources.people;
            }
        }