예제 #1
0
 private void Check()
 {
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     byte[] arrImgFront = null;
     byte[] arrImgBack = null;
     frontPic.EditValue = null;
     backPic.EditValue = null;
     ImageConverter converter = new ImageConverter();
     var pk = new Execute(pkdata).GetSinglePKIn(txtRFID.Text);
     if (pk != null)
     {
         new Execute(pkdata).getImage(pk.ID, ref arrImgFront, true);
         if (arrImgFront != null)
         {
             Image tmp = (Image)converter.ConvertFrom(arrImgFront);
             frontPic.Image = tmp;
             arrImgFront = null;
         }
         new Execute(pkdata).getImage(pk.ID, ref arrImgBack, false);
         if (arrImgBack != null)
         {
             Image tmp = (Image)converter.ConvertFrom(arrImgBack);
             backPic.Image = tmp;
             arrImgBack = null;
         }
         LoadDataToControl(pk);
         btnOK.Focus();
     }
 }
예제 #2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     var pkOut = new Execute(pkdata).GetSinglePKIn(txtRFID.Text);
     if (pkOut != null)
     {
         new Execute(pkdata).DeleteCard(txtRFID.Text);
         this.Close();
     }
 }
예제 #3
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     //pk_In_Out pkOut = new pk_In_Out();
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     var pkOut = new Execute(pkdata).GetSinglePKIn(txtRFID.Text);
     if (pkOut != null)
     {
         //LoadDataToControl(pkOut);
         new Execute(pkdata).SavePKOut(pkOut.ID, DateTime.Now);
         LoadDataToGrid();
     }
 }
예제 #4
0
        private void btnCheckIDCard_Click(object sender, EventArgs e)
        {
            try
            {
                PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
                //Kiem tra xem thẻ này là thế nào
                //pk_In_Out pkIn = new pk_In_Out();
                var pkIn = new Execute(pkdata).GetSinglePKIn(txtRFID.Text);

                //pk_In_Out pkOut = new pk_In_Out();
                var pkOut = new Execute(pkdata).GetSinglePKOut(txtRFID.Text);
                if (pkIn != null)
                {
                    if (pkIn.IsOut == false)
                    {
                        decimal price = new Execute(pkdata).GetPriceByID(pkIn.VehicleTypeID ?? 0);
                        txtPrice.Text = string.Format("{0}", price);
                        txtNumber.Text = pkIn.Number;
                        teTimeIn.EditValue = pkIn.TimeIn;
                        labelControl1.Enabled = true;
                        labelControl1.Text = "Xe này chưa ra khỏi bãi";
                        btnOK.Enabled = true;
                    }
                }
                if (pkOut != null)
                {
                    if (pkOut.IsOut == true)
                    {
                        //Lấy hết dữ liệu ra --- mới vào chưa ra
                        //Nếu tồn tại ID này đã ra -- có trong danh sách xe đã ra
                        pk_Price pkPice = new pk_Price();
                        decimal price = new Execute(pkdata).GetPriceByID(pkOut.VehicleTypeID ?? 0);
                        txtPrice.Text = string.Format("{0}", price);
                        txtNumber.Text = pkOut.Number;
                        teTimeIn.EditValue = pkOut.TimeIn;
                        teTimeOut.EditValue = pkOut.TimeOut; //xe nay da ra khỏi bãi
                        labelControl1.Enabled = true;
                        labelControl1.Text = "Xe này đã ra khỏi bãi";
                        btnOK.Enabled = false;
                    }
                }

            }

            catch
            {
                MessageBox.Show("Co loi ne");
            }
        }
예제 #5
0
        private void LoadDataToGrid()
        {
            PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
            IEnumerable<pk_Camera> cam_ = new Execute(pkdata).IECamera();
            DataTable dt = new DataTable();
            dt = clsDeclare.ObtainDataTableFromIEnumerable(cam_);
            if (dt.Rows.Count > 0)
            {
                DataView dv = new DataView(dt);
                if (dv != null)
                {
                    grcCameras.BeginUpdate();
                    grcCameras.DataSource = dv;
                    grcCameras.EndUpdate();
                }
                grvCameras.ExpandAllGroups();
            }
            else
            {
                grcCameras.BeginUpdate();
                grcCameras.DataSource = null;
                grcCameras.EndUpdate();

                cbbSize.SelectedIndex = 0;
                cbbArea.SelectedIndex = 0;
                cbbPosition.SelectedIndex = 0;
                cbbProvider.SelectedIndex = 0;
                cbbQuality.SelectedIndex = 0;
                cbbType.SelectedIndex = 0;
            }
        }
예제 #6
0
 private void LoadDataToGrid()
 {
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     pk_In_Out[] PakingIn = new Execute(pkdata).GetAllPKOut(0, 20);
     grcOut.BeginUpdate();
     grcOut.DataSource = PakingIn;
     grcOut.EndUpdate();
 }
예제 #7
0
 private void frmLineOut_Activated(object sender, EventArgs e)
 {
     clsDeclare.eventComPort1.LfDataReceived += new LfDataReceivedEventHandler(eventComPort1_LfDataReceived);
     LoadDataToGrid();
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     pk_Camera[] cams = new Execute(pkdata).GetAllCameras();
     foreach (pk_Camera cam in cams)
     {
         if (cam.areaId == 2)
         {
             string[] sourceIP = cam.source.Split(':');
             OpenCamera(cam.position, cam.login, cam.password, sourceIP[0], sourceIP[1]);
         }
     }
 }
예제 #8
0
        private void Finder(string RFID, string Number, DateTime fromDate, DateTime toDate)
        {
            PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
            var result = new Execute(pkdata).Search(RFID, Number, fromDate, toDate, isOut, isRFID, isNumber, isDate);
            grcOut.DataSource = null;
            frontPic.Image = null;
            backPic.Image = null;

            if (result != null)
            {
                LoadDataToGrid(result);
            }
        }
예제 #9
0
 private void LoadDataToGrid()
 {
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     IEnumerable<pk_Price> price = new Execute(pkdata).IEPrice();
     if (price != null)
     {
         DataTable dt = new DataTable();
         dt = clsDeclare.ObtainDataTableFromIEnumerable(price);
         if (dt.Rows.Count > 0)
         {
             DataView dv = new DataView(dt);
             if (dv != null)
             {
                 grcVehicles.BeginUpdate();
                 grcVehicles.DataSource = dv;
                 grcVehicles.EndUpdate();
             }
         }
     }
 }
예제 #10
0
        private void Save()
        {
            try
            {
                if (txtRFID.EditValue != null && cbbVehicleType.EditValue != null)
                {
                    PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
                    if (new Execute(pkdata).HasObject(txtRFID.Text))
                    {
                        MessageBox.Show("Thẻ này chưa ra ngoài", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Guid ID = new Execute(pkdata).SavePKIn(txtRFID.Text, txtNumber.Text, DateTime.Now, Convert.ToInt32(cbbVehicleType.EditValue));

                    if (imgIn != null)
                    {
                        new Execute(pkdata).setImage(ID, (byte[])imgIn, true);
                        frontPic.EditValue = ConvertToBitmap((byte[])imgIn);
                        imgIn = null;
                    }
                    if (imgOut != null)
                    {
                        new Execute(pkdata).setImage(ID, (byte[])imgOut, false);
                        backPic.EditValue = ConvertToBitmap((byte[])imgOut);
                        imgOut = null;
                    }
                    LoadDataToGrid();
                }
            }
            catch
            {
                MessageBox.Show("Lỗi kết nối", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #11
0
 private void LoadDataToGrid()
 {
     try
     {
         PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
         pk_In_Out[] PakingIn = new Execute(pkdata).GetAllPKIn(0, 20);
         grcIn.BeginUpdate();
         grcIn.DataSource = PakingIn;
         grcIn.EndUpdate();
     }
     catch
     {
         MessageBox.Show("Lỗi kết nối", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
예제 #12
0
 private void frmLineIn_Activated(object sender, EventArgs e)
 {
     try
     {
         PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
         clsDeclare.eventComPort1.LfDataReceived += new LfDataReceivedEventHandler(eventComPort1_LfDataReceived);
         LoadDataToGrid();
         LoadDataToCombo();
         pk_Camera[] cams = new Execute(pkdata).GetAllCameras();
         foreach (pk_Camera cam in cams)
         {
             if (cam.areaId == 1)
             {
                 string[] sourceIP = cam.source.Split(':');
                 OpenCamera(cam.position, cam.login, cam.password, sourceIP[0], sourceIP[1]);
             }
         }
     }
     catch
     {
         MessageBox.Show("Lỗi kết nối", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #13
0
        private void Save()
        {
            PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
            if (txtRFIDIn.EditValue != null && cbbVehicleType.EditValue != null)
            {

                if (new Execute(pkdata).HasObject(txtRFIDIn.Text))
                {
                    MessageBox.Show("Thẻ này chưa ra ngoài", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                Guid ID = new Execute(pkdata).SavePKIn(txtRFIDIn.Text, txtNumberIn.Text, DateTime.Now, Convert.ToInt32(cbbVehicleType.EditValue));
                if (imgIn != null)
                {
                    new Execute(pkdata).setImage(ID, (byte[])imgIn, false);

                    MemoryStream ms = new MemoryStream((byte[])imgIn);
                    Image returnImage = Image.FromStream(ms);
                    picIn.Image = returnImage;
                }
                LoadDataToGrid();
            }
        }
예제 #14
0
 private void Check()
 {
     PKDataContext pkdata = new PKDataContext(clsDeclare.gblConnectStringLinQ);
     byte[] arrImgFront = null;
     picOut.EditValue = null;
     ImageConverter con = new ImageConverter();
     var pk = new Execute(pkdata).GetSinglePKIn(txtRFIDOut.Text);
     if (pk != null)
     {
         new Execute(pkdata).getImage(pk.ID, ref arrImgFront, false);
         if (arrImgFront != null)
         {
             Image tmp = (Image)con.ConvertFrom(arrImgFront);
             picOut.Image = tmp;
             arrImgFront = null;
         }
         txtNumberOut.Text = pk.Number.ToString();
         txtPriceOut.Text = String.Format("{0:##,##00}", pk.Price);
         teTimeIn.EditValue = pk.TimeIn;
         teTimeOut.EditValue = DateTime.Now;
     }
 }