コード例 #1
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);

                //quet tem cuon
                if (dangQuet == 0)
                {
                    temCuon = new TemCuon(dcdData);

                    if (temCuon.IdCuon == null)
                    {
                        MessageBox.Show("Hay quet vao tem cuon", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //load thong tin tem cuon
                        lblVnptPN.Text       = temCuon.VnptPn;
                        lblPhieuNhapKho.Text = temCuon.SoPhieuNhapKho;
                        lblSoDonHang.Text    = temCuon.SoDonHang;
                        lblNgayNhapKho.Text  = temCuon.NgayNhapKho;
                        lblSoLuong.Text      = temCuon.SoLuong;
                        lblIdCuon.Text       = temCuon.IdCuon;
                        dangQuet             = 1;
                    }
                }


                //Quet tem vitri
                else if (dangQuet == 1)
                {
                    temViTri = new TemVitri(dcdData);

                    if (temViTri.ID == 0 || temViTri.ID == null)
                    {
                        MessageBox.Show("Hay quet vao tem vi tri", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //load thong tin tem cuon
                        lblViTri.Text    = temViTri.ID + "-" + temViTri.Ten;
                        dangQuet         = 2;
                        btnSave.Enabled  = true;
                        btnReset.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                MessageBox.Show("Co loi xay ra, hay quet lai tu dau", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                ResetForm();
            }
        }
コード例 #2
0
        private void dgListCuon_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                var hti = dgListCuon.HitTest(e.X, e.Y);

                switch (hti.Type)
                {
                case System.Windows.Forms.DataGrid.HitTestType.Cell:
                {
                    if (hti.Column == 8)
                    {
                        DialogResult confirmResult = MessageBox.Show("Ban co chac chan muon xoa linh kien?", "Ban co chac chan khong?", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);

                        if (confirmResult == DialogResult.Yes)
                        {
                            DataRow r = dtCuon.Rows[hti.Row];

                            TemCuon t = listTemCuon.Find(x => x.IdCuon == r["IdCuon"].ToString());
                            listTemCuon.Remove(t);

                            updateGridLayout();
                            SoKien--;

                            if (t.IdCuon != null && dtCuon.Rows.Count == 0)
                            {
                                lblStartMsgLinhKien.Visible = true;
                                btnSave.Enabled             = false;
                                btnReset.Enabled            = false;
                                dgListCuon.Visible          = false;
                            }
                        }
                    }
                } break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #3
0
        private void ScanCode(string dcdData)
        {
            if (dcdData.StartsWith("["))
            {
                #region Scan Package/Unit ID new
                try
                {
                    LabelPackage labelPackage = new LabelPackage(dcdData.Trim());
                    DataRow[]    rs_package   = null;

                    bool _exists_package = false;

                    if (labelPackage.PackageId != null && labelPackage.PackageId != "")
                    {
                        rs_package = dtList.Select(COL_ID + " = '" + labelPackage.PackageId + "'");
                        if (rs_package.Length > 0)
                        {
                            _exists_package = true;
                        }

                        //DialogResult mgb = new DialogResult();
                        if (_exists_package)
                        {
                            //mgb = MessageBox.Show("Package not exists in list !", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            //if (mgb == DialogResult.Yes)
                            //{
                            //    dr = dtList.Select("internalReference = '" + labelPackage.ProductName + "' AND " + COL_ID + " = '" + labelPackage.PackageId + "'").FirstOrDefault();
                            //    if(dr == null)
                            //        addPackageNotInList(labelPackage.ProductName, labelPackage.PackageId);
                            //}
                            MessageBox.Show("Package already exists in the list !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                        else
                        {
                            addPackageToList(labelPackage.ProductName, labelPackage.PackageId);

                            if (BarcodeLocation != null && BarcodeLocation.Trim().Length > 0 && !btnSave.Enabled)
                            {
                                //enable button save
                                btnSave.Enabled  = true;
                                btnClear.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Wrong Package/Unit ID QRCode format !");
                    //MessageBox.Show(ex.InnerException.ToString());
                    //MessageBox.Show("Error during loading information !", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                #endregion
            }
            else if (dcdData.Trim().StartsWith("PN:"))
            {
                #region Scan Package/Unit ID old
                try
                {
                    TemCuon   temCuon    = new TemCuon(dcdData.Trim());
                    DataRow[] rs_package = null;

                    bool _exists_package = false;

                    if (temCuon.IdCuon != null && temCuon.IdCuon != "")
                    {
                        rs_package = dtList.Select(COL_ID + " = '" + temCuon.IdCuon + "'");
                        if (rs_package.Length > 0)
                        {
                            _exists_package = true;
                        }

                        //DialogResult mgb = new DialogResult();
                        if (_exists_package)
                        {
                            //mgb = MessageBox.Show("Package not exists in list !", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            //if (mgb == DialogResult.Yes)
                            //{
                            //    dr = dtList.Select("internalReference = '" + labelPackage.ProductName + "' AND " + COL_ID + " = '" + labelPackage.PackageId + "'").FirstOrDefault();
                            //    if(dr == null)
                            //        addPackageNotInList(labelPackage.ProductName, labelPackage.PackageId);
                            //}
                            MessageBox.Show("Package already exists in the list !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                        else
                        {
                            addPackageToList(temCuon.VnptPn, temCuon.IdCuon, Convert.ToInt32(temCuon.Type));

                            if (BarcodeLocation != null && BarcodeLocation.Trim().Length > 0 && !btnSave.Enabled)
                            {
                                //enable button save
                                btnSave.Enabled  = true;
                                btnClear.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Wrong Package/Unit ID QRCode format !");
                }
                #endregion
            }
            else if (Util.OnlyHexInString(dcdData.Trim()))
            {
                #region Scan Serial number
                try
                {
                    string    SerialNumber    = dcdData.Trim();
                    DataRow[] rs_package      = null;
                    bool      _exists_package = false;

                    if (SerialNumber != null && SerialNumber != "")
                    {
                        rs_package = dtList.Select(COL_ID + " = '" + SerialNumber + "'");
                        if (rs_package.Length > 0)
                        {
                            _exists_package = true;
                        }

                        //DialogResult mgb = new DialogResult();
                        if (_exists_package)
                        {
                            //mgb = MessageBox.Show("Package not exists in list !", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            //if (mgb == DialogResult.Yes)
                            //{
                            //    dr = dtList.Select("internalReference = '" + labelPackage.ProductName + "' AND " + COL_ID + " = '" + labelPackage.PackageId + "'").FirstOrDefault();
                            //    if(dr == null)
                            //        addPackageNotInList(labelPackage.ProductName, labelPackage.PackageId);
                            //}
                            MessageBox.Show("Package/Serial number already exists in the list !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                        else
                        {
                            addPackageToList(null, SerialNumber);

                            if (BarcodeLocation != null && BarcodeLocation.Trim().Length > 0 && !btnSave.Enabled)
                            {
                                //enable button save
                                btnSave.Enabled  = true;
                                btnClear.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Wrong Package/Unit ID QRCode format !");
                    //MessageBox.Show(ex.InnerException.ToString());
                    //MessageBox.Show("Error during loading information !", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                #endregion
            }
            else
            {
                #region Scan location

                ApiResponse res = new ApiResponse();
                res.Status = false;
                try
                {
                    string url = "locations/search?query=barcode==\"" + dcdData.Trim() + "\"";
                    res = HTTP.GetJson(url);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error during load location information !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }

                if (res.Status && Util.IsJson(res.RawText))
                {
                    try
                    {
                        List <LocationInfo> RootObject = JsonConvert.DeserializeObject <List <LocationInfo> >(res.RawText, new JsonSerializerSettings
                        {
                            NullValueHandling = NullValueHandling.Ignore
                        });

                        List <LocationInfo> ListLocations = RootObject as List <LocationInfo>;
                        this.lblLocationBarcode.Text = ListLocations[0].name;
                        BarcodeLocation = dcdData;

                        if (this.dtList.Rows.Count > 0 && !btnSave.Enabled)
                        {
                            //enable button save
                            btnSave.Enabled  = true;
                            btnClear.Enabled = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error during load location information !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                }
                #endregion
            }
        }
コード例 #4
0
        private void ScanCode(string dcdData)
        {
            if (dcdData.StartsWith("["))
            {
                #region Scan Package/Unit ID new
                if (this._LocationInfo == null)
                {
                    MessageBox.Show("Request scan location before scan the package!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    return;
                }

                try
                {
                    string       scanValue    = dcdData.Replace(System.Environment.NewLine, "").Trim();
                    LabelPackage labelPackage = new LabelPackage(scanValue);

                    //Util.Logs(labelPackage.PackageId);

                    if (labelPackage.PackageId != null && labelPackage.PackageId != "")
                    {
                        //Check package exists in inventory
                        ApiResponse res = new ApiResponse();
                        res.Status = false;
                        string url = "";
                        int    _id = 0; bool isPackage = true;
                        if (Util.getTypePackage(labelPackage.PackageId, null) % 2 == 0)
                        {
                            isPackage = false;
                            Lots lot     = new Lots();
                            Lots lotInfo = lot.getInfo(labelPackage.PackageId);
                            if (lotInfo == null)
                            {
                                MessageBox.Show("Unit ID is not exists in inventory !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }
                            else
                            {
                                url = "adjustment-details/search?query=adjustmentId==" + _Adjustment.id.ToString() + ";lotId==" + lotInfo.id.ToString();
                                _id = lotInfo.id;
                            }
                        }
                        else if (Util.getTypePackage(labelPackage.PackageId, null) % 2 != 0)
                        {
                            isPackage = true;
                            Packages package     = new Packages();
                            Packages packageInfo = package.getInfo(labelPackage.PackageId);
                            if (packageInfo == null)
                            {
                                MessageBox.Show("Package is not exists in inventory !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }
                            else
                            {
                                url = "adjustment-details/search?query=adjustmentId==" + _Adjustment.id.ToString() + ";packageId==" + packageInfo.id.ToString();
                                _id = packageInfo.id;
                            }
                        }
                        if (url.Length == 0)
                        {
                            MessageBox.Show("Wrong Package/Unit ID QRCode format !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }

                        try
                        {
                            res = HTTP.GetJson(url);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Server error !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }
                        List <AdjustmentDetail> ListDetail;
                        if (res.Status && Util.IsJson(res.RawText))
                        {
                            List <AdjustmentDetail> RootObject = JsonConvert.DeserializeObject <List <AdjustmentDetail> >(res.RawText, new JsonSerializerSettings
                            {
                                NullValueHandling = NullValueHandling.Ignore
                            });

                            ListDetail = RootObject as List <AdjustmentDetail>;

                            if (checkExistsInTable(labelPackage.PackageId))
                            {
                                return;
                            }
                            else
                            {
                                if (ListDetail.Count == 0)
                                {
                                    DialogResult mgb = new DialogResult();
                                    mgb = MessageBox.Show("Package/Unit ID is not exists in inventory adjustment! Do you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                    if (mgb != DialogResult.Yes)
                                    {
                                        return;
                                    }

                                    addPackageFromStock(_id, labelPackage.PackageId, isPackage, labelPackage.ProductName, _LocationInfo.barcode, null, 0);
                                    //addPackageToList(labelPackage.PackageId, 0, labelPackage.ProductName, _LocationInfo.barcode);

                                    //enable button save
                                    if (_LocationInfo != null && !btnSave.Enabled)
                                    {
                                        btnSave.Enabled = true;
                                    }
                                }
                                else
                                {
                                    if (labelPackage.PackageId.StartsWith(PREFIX_LOT) || ListDetail.Count == 1)
                                    {
                                        addPackageToList(ListDetail[0]);
                                    }
                                    else if (labelPackage.PackageId.StartsWith(PREFIX_PACK))
                                    {
                                        foreach (AdjustmentDetail item in ListDetail)
                                        {
                                            addPackageToList(item);
                                        }
                                    }

                                    //enable button save
                                    if (_LocationInfo != null && !btnSave.Enabled)
                                    {
                                        btnSave.Enabled = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Server error !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong Package/Unit ID QRCode format !");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                #endregion
            }
            else if (dcdData.Trim().StartsWith("PN:"))
            {
                #region Scan Package/Unit ID old
                if (_LocationInfo == null)
                {
                    MessageBox.Show("Request scan location before scan the package!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    return;
                }

                try
                {
                    string  scanValue = dcdData.Replace(System.Environment.NewLine, "").Trim();
                    TemCuon temCuon   = new TemCuon(scanValue);

                    if (temCuon.IdCuon != null && temCuon.IdCuon != "")
                    {
                        //Check package exists in inventory
                        ApiResponse res = new ApiResponse();
                        res.Status = false;
                        string url = "";
                        int    _id = 0; bool isPackage = true;

                        if (Convert.ToInt32(temCuon.Type) == 0)
                        {
                            isPackage = false;
                            Lots lot     = new Lots();
                            Lots lotInfo = lot.getInfo(temCuon.IdCuon);
                            if (lotInfo == null)
                            {
                                DialogResult mgb = new DialogResult();
                                mgb = MessageBox.Show("Uid is not exists in inventory! Do you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                if (mgb != DialogResult.Yes)
                                {
                                    return;
                                }
                                if (checkExistsInTable(temCuon.IdCuon, Convert.ToInt32(temCuon.Type)))
                                {
                                    return;
                                }
                                addPackageToList(null, temCuon.IdCuon, Convert.ToDouble(temCuon.SoLuong), temCuon.VnptPn, _LocationInfo.barcode, temCuon.Type);
                            }
                            url = "adjustment-details/search?query=adjustmentId==" + _Adjustment.id.ToString() + ";lotId==" + lotInfo.id.ToString();
                            _id = lotInfo.id;
                        }
                        else if (Convert.ToInt32(temCuon.Type) == 1)
                        {
                            isPackage = true;
                            Packages package     = new Packages();
                            Packages packageInfo = package.getInfo(temCuon.IdCuon);
                            if (packageInfo == null)
                            {
                                DialogResult mgb = new DialogResult();
                                mgb = MessageBox.Show("Package is not exists in inventory! Do you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                if (mgb != DialogResult.Yes)
                                {
                                    return;
                                }
                                if (checkExistsInTable(temCuon.IdCuon, Convert.ToInt32(temCuon.Type)))
                                {
                                    return;
                                }
                                addPackageToList(temCuon.IdCuon, null, Convert.ToDouble(temCuon.SoLuong), temCuon.VnptPn, _LocationInfo.barcode, temCuon.Type);
                            }
                            url = "adjustment-details/search?query=adjustmentId==" + _Adjustment.id.ToString() + ";packageId==" + packageInfo.id.ToString();
                            _id = packageInfo.id;
                        }
                        if (url.Length == 0)
                        {
                            MessageBox.Show("Wrong Package/Unit ID QRCode format !"); return;
                        }

                        try
                        {
                            res = HTTP.GetJson(url);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Server error !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }
                        List <AdjustmentDetail> ListDetail;
                        if (res.Status && Util.IsJson(res.RawText))
                        {
                            List <AdjustmentDetail> RootObject = JsonConvert.DeserializeObject <List <AdjustmentDetail> >(res.RawText, new JsonSerializerSettings
                            {
                                NullValueHandling = NullValueHandling.Ignore
                            });

                            ListDetail = RootObject as List <AdjustmentDetail>;

                            if (checkExistsInTable(temCuon.IdCuon, Convert.ToInt32(temCuon.Type)))
                            {
                                return;
                            }
                            else
                            {
                                if (ListDetail.Count == 0)
                                {
                                    DialogResult mgb = new DialogResult();
                                    mgb = MessageBox.Show("Package/Unit ID is not exists in inventory adjustment! Do you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                    if (mgb != DialogResult.Yes)
                                    {
                                        return;
                                    }

                                    addPackageFromStock(_id, temCuon.IdCuon, isPackage, temCuon.VnptPn, _LocationInfo.barcode, temCuon.Type, Convert.ToDouble(temCuon.SoLuong));
                                    //addPackageToList(temCuon.IdCuon, 0, temCuon.VnptPn, _LocationInfo.barcode, Convert.ToInt32(temCuon.Type));

                                    //enable button save
                                    if (_LocationInfo != null && !btnSave.Enabled)
                                    {
                                        btnSave.Enabled = true;
                                    }
                                }
                                else
                                {
                                    if (Convert.ToInt32(temCuon.Type) == 0 || ListDetail.Count == 1)
                                    {
                                        addPackageToList(ListDetail[0]);
                                    }
                                    else if (Convert.ToInt32(temCuon.Type) == 1)
                                    {
                                        foreach (AdjustmentDetail item in ListDetail)
                                        {
                                            addPackageToList(item);
                                        }
                                    }

                                    //enable button save
                                    if (_LocationInfo != null && !btnSave.Enabled)
                                    {
                                        btnSave.Enabled = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Server error !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong Package/Unit ID QRCode format !");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                #endregion
            }
            else if (Util.OnlyHexInString(dcdData.Trim()))
            {
                #region scan serial number

                string SerialNumber = dcdData.Trim();
                checkScan(null, SerialNumber, null);

                #endregion
            }
            else
            {
                #region Scan location
                locationBarcode = dcdData.Replace(System.Environment.NewLine, "").Trim();
                try
                {
                    ApiResponse res = new ApiResponse();
                    res.Status = false;

                    string url   = "locations/check-child";
                    var    param = new
                    {
                        locationId = this._Adjustment.locationId,
                        barcode    = locationBarcode
                    };
                    res = HTTP.Post(url, param);
                    if (res.Status)
                    {
                        if (Convert.ToBoolean(res.RawText))
                        {
                            if (_LocationInfo != null)
                            {
                                DialogResult mgb = new DialogResult();
                                mgb = MessageBox.Show("Are you sure you want to update new scan location?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                if (mgb != DialogResult.Yes)
                                {
                                    return;
                                }
                            }

                            _LocationInfo = getLocationInfo(locationBarcode);
                            if (_LocationInfo == null)
                            {
                                return;
                            }

                            this.lblLocationBarcode.Text = _LocationInfo.name;

                            //enable button save
                            if (this.dtList.Rows.Count > 0 && !btnSave.Enabled)
                            {
                                btnSave.Enabled = true;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Location is not exists in adjustment name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            //btnSave.Enabled = false;
                            //this.dtList.Rows.Clear();
                            //this.dgCuonList.Refresh();
                            this.locationBarcode = null;
                            //this.lblLocationBarcode.Text = null;
                        }
                    }
                    else
                    {
                        //btnSave.Enabled = false;
                        //this.dtList.Rows.Clear();
                        //this.dgCuonList.Refresh();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error during load location information !");
                }
                #endregion
            }
        }
コード例 #5
0
        private void ScanCode(string dcdData)
        {
            //Data test
            //dcdData = "PN:8NQMH3LM000001QJ*SPNK:PART-IMP-29*SDH:VNPT/TECH-BO-05/2017-112*NNK:2017-05-30*ID:0000211398*SL:50*TYPE:1*";
            //dcdData = "PN:K5BXDN4M000001K3*SPNK:IMP-RE-PART-DIF-55*SDH:*NNK:15/09/2017 9:53:22 AM*ID:0000306360*SL:2000.000000*TYPE:1*";

            //Obtain the string and code id.
            //MessageBox.Show(dcdData);
            try
            {
                TemCuon   temCuon = new TemCuon(dcdData.Trim());
                DataRow[] rs      = null;

                if (temCuon.IdCuon != null && temCuon.IdCuon != "")
                {
                    string _vnpt_pn_ok = temCuon.VnptPn;
                    if (this._checkOther != 1 && temCuon.VnptPn.Length > 14)
                    {
                        _vnpt_pn_ok = _vnpt_pn_ok.Substring(0, 14);
                    }

                    rs = dtList.Select("vnpt_pn = '" + _vnpt_pn_ok + "'");
                    DataRow dr = null;

                    if (rs.Length > 0)
                    {
                        dr = rs.FirstOrDefault();
                    }
                    else
                    {
                        MessageBox.Show("Linh kien nay khong co trong danh sach xuat kho", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        return;
                    }

                    //check duplicate scan
                    PackageInfo packDuplicate = this.listScanned.SingleOrDefault(entry => entry.id_cuon == temCuon.IdCuon);
                    if (packDuplicate != null)
                    {
                        MessageBox.Show("Thung/cuon da duoc quet truoc do!");
                        return;
                    }

                    if (dr != null)
                    {
                        double _quantity_scan = Convert.ToDouble(dr[COL_SCANNED]);
                        double _total_export  = Convert.ToDouble(dr["total_export"]);
                        double _total_request = Convert.ToDouble(dr["total_request"]);

                        //update table
                        _quantity_scan += Convert.ToDouble(temCuon.SoLuong);
                        dr[COL_SCANNED] = _quantity_scan;

                        //add code da quet vao list
                        PackageInfo package = new PackageInfo();
                        package.id_cuon  = temCuon.IdCuon;
                        package.quantity = Convert.ToDouble(temCuon.SoLuong);
                        package.status   = "DaQuet";
                        package.vnpt_pn  = _vnpt_pn_ok;
                        package.type     = Convert.ToInt32(temCuon.Type);

                        listScanned.Add(package);

                        //update quantity scanned
                        //check thung or cuon
                        int type = Util.ConvertInt(temCuon.Type);
                        if (type == 1)
                        {
                            _sl_thung_quet++;
                        }
                        else
                        {
                            _sl_cuon_quet++;
                        }
                        lblDaQuet.Text = _sl_thung_quet.ToString() + " thùng/" + _sl_cuon_quet.ToString() + " cuon";

                        //enable button save
                        btnSave.Enabled = true;

                        if (_quantity_scan + _total_export > _total_request)
                        {
                            MessageBox.Show("So luong LK da quet vuot qua so luong yeu cau xuat cua linh kien");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Ma thung/cuon khong dung", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException.ToString());
                //MessageBox.Show("Co loi xay ra", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #6
0
        private void ScanCode(string dcdData)
        {
            // Obtain the string and code id.
            try
            {
                TemCuon temCuon = new TemCuon(dcdData);

                DataRow[] rs = null;

                if (temCuon.IdCuon != null && temCuon.IdCuon != "")
                {
                    //check thung or cuon
                    int type = Util.ConvertInt(temCuon.Type);

                    if (type == 0)
                    { //cuon
                        rs = dtListCuon.Select("Code = " + temCuon.IdCuon);

                        DataRow dr = null;

                        if (rs.Length > 0)
                        {
                            dr = rs.FirstOrDefault();
                        }
                        else
                        {
                            MessageBox.Show("Cuon nay khong co trong danh sach xuat kho", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            return;
                        }


                        if (dr != null && dr[COL_STATUS] == "")
                        {
                            listScanned.Add(temCuon.IdCuon); //add code da quet vao list
                            dr[COL_STATUS] = "DQ";
                            dr[COL_ACTION] = "huy";
                            currentScanned++;
                        }
                        else
                        {
                            MessageBox.Show("Cuon nay da quet", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                    }
                    else
                    {   //thung
                        rs = dtListCuon.Select("Code = " + temCuon.IdCuon);

                        //var text = string.Join(",", dtListCuon.AsEnumerable()
                        //         .Select(x => x["Code"].ToString())
                        //         .ToArray());

                        if (rs.Length > 0)
                        {
                            string listIdCuon = "";
                            int    ThungType  = Util.ConvertInt(rs[0]["ThungType"].ToString());
                            if (ThungType == 1)
                            {
                                //Thong bao cac cuon trong thung
                                foreach (DataRow r in rs)
                                {
                                    if (r[COL_STATUS] == "")
                                    {
                                        if (listIdCuon == "")
                                        {
                                            listIdCuon += r["Code"].ToString();
                                        }
                                        else
                                        {
                                            listIdCuon += "-" + r["Code"].ToString();
                                        }
                                    }
                                }
                                MessageBox.Show("Co " + rs.Length + " cuon trong thung. " + listIdCuon, "Thong Bao", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            }
                            else if (ThungType == 2)
                            {
                                foreach (DataRow r in rs)
                                {
                                    if (r[COL_STATUS] == "")
                                    {
                                        r[COL_STATUS] = "DQ";
                                        r[COL_ACTION] = "huy";
                                        currentScanned++;
                                        listScanned.Add(r["Code"].ToString());

                                        if (listIdCuon == "")
                                        {
                                            listIdCuon += r["Code"].ToString();
                                        }
                                        else
                                        {
                                            listIdCuon += "-" + r["Code"].ToString();
                                        }
                                    }
                                }
                                MessageBox.Show("Co " + rs.Length + " cuon trong thung. " + listIdCuon, "Thong Bao", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                            }
                            else
                            {
                                DataRow dr = rs.FirstOrDefault();
                                if (dr[COL_STATUS] == "")
                                {
                                    listScanned.Add(temCuon.IdCuon); //add code da quet vao list
                                    dr[COL_STATUS] = "DQ";
                                    dr[COL_ACTION] = "huy";
                                    currentScanned++;
                                }
                                else
                                {
                                    MessageBox.Show("Thung nay da quet", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Thung khong nam trong danh sach xuat kho.", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                    }
                    ScanInfo();
                }
                else
                {
                    MessageBox.Show("Ma thung/cuon khong dung", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Co loi xay ra", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #7
0
        private void ScanCode(string dcdData)
        {
            //Obtain the string and code id.
            //MessageBox.Show(dcdData);
            if (dcdData.StartsWith("["))
            {
                #region New label
                LabelPackage labelPackage = null;
                try
                {
                    labelPackage = new LabelPackage(dcdData.Trim());
                }
                catch
                {
                    MessageBox.Show("Wrong Package/UnitID QRCode format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    return;
                }

                if (labelPackage.PackageId.StartsWith(PREFIX_LOT))
                {
                    #region Scan uid
                    try
                    {
                        if (labelPackage.PackageId != null && labelPackage.PackageId != "")
                        {
                            if (checkReservedInOtherList(labelPackage.PackageId, false))
                            {
                                MessageBox.Show("Package/Uid already exists in another reserved list!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }

                            DataRow[] rs_package = dtList.Select(COL_LOT_ID + " = '" + labelPackage.PackageId + "'");
                            if (rs_package.Length > 0)
                            {
                                //DialogResult mgb = new DialogResult();
                                //mgb = MessageBox.Show("Package not exists in list !", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                //if (mgb == DialogResult.Yes)
                                //{
                                //    dr = dtList.Select("internalReference = '" + labelPackage.ProductName + "' AND " + COL_ID + " = '" + labelPackage.PackageId + "'").FirstOrDefault();
                                //    if(dr == null)
                                //        addPackageNotInList(labelPackage.ProductName, labelPackage.PackageId);
                                //}

                                MessageBox.Show("Unit ID " + labelPackage.PackageId + " already exists in the list !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }
                            else
                            {
                                //Validate Unit ID
                                Lots lot     = new Lots();
                                Lots lotInfo = lot.getInfo(labelPackage.PackageId);
                                if (lotInfo == null)
                                {
                                    MessageBox.Show("Unit ID " + labelPackage.PackageId + " is not exists in inventory !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                    return;
                                }

                                Packages PackageInfo = validateLot(lotInfo.id);
                                if (PackageInfo == null)
                                {
                                    return;
                                }

                                if (PackageInfo.packageNumber == null)
                                {
                                    if (this.dtList.Rows.Count == 0)
                                    {
                                        addPackageToList("", labelPackage.PackageId);
                                    }
                                    else
                                    {
                                        DataRow[] rs = dtList.Select(COL_PACK_ID + " = ''");
                                        if (rs.Length > 0)
                                        {
                                            addPackageToList("", labelPackage.PackageId);
                                        }
                                        else
                                        {
                                            if (Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]).Length > 0)
                                            {
                                                MessageBox.Show("Request scan unit ID in package " + Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]));
                                            }
                                            else
                                            {
                                                MessageBox.Show("Request scan free unit ID !");
                                            }
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.dtList.Rows.Count == 0)
                                    {
                                        addPackageToList(PackageInfo.packageNumber, labelPackage.PackageId);
                                    }
                                    else
                                    {
                                        DataRow[] rs = dtList.Select(COL_PACK_ID + " = '" + PackageInfo.packageNumber + "'");
                                        if (rs.Length > 0)
                                        {
                                            addPackageToList(PackageInfo.packageNumber, labelPackage.PackageId);
                                        }
                                        else
                                        {
                                            if (Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]).Length > 0)
                                            {
                                                MessageBox.Show("Request scan unit ID in package " + Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]));
                                            }
                                            else
                                            {
                                                MessageBox.Show("Request scan free unit ID !");
                                            }
                                            return;
                                        }
                                    }
                                }

                                if (DestPackageNumber != null && DestPackageNumber.Trim().Length > 0 && !btnSave.Enabled)
                                {
                                    //enable button save
                                    btnSave.Enabled  = true;
                                    btnClear.Enabled = true;
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.InnerException.ToString());
                        //MessageBox.Show("Error during loading information !", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    #endregion
                }
                else if (labelPackage.PackageId.StartsWith(PREFIX_PACK))
                {
                    #region Scan package
                    if (DestPackageNumber != null && DestPackageNumber.Length > 0)
                    {
                        DialogResult mgb = new DialogResult();
                        mgb = MessageBox.Show("Are you sure you want to update the package number?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        if (mgb != DialogResult.Yes)
                        {
                            return;
                        }
                    }

                    if (!checkExistsPackage(labelPackage.PackageId))
                    {
                        return;
                    }

                    if (checkReservedInOtherList(labelPackage.PackageId, true))
                    {
                        MessageBox.Show("Package/Uid already exists in another reserved list!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        return;
                    }

                    DestPackageNumber         = labelPackage.PackageId;
                    txtDestPackageNumber.Text = DestPackageNumber;

                    if (this.dtList.Rows.Count > 0 && !btnSave.Enabled)
                    {
                        //enable button save
                        btnSave.Enabled  = true;
                        btnClear.Enabled = true;
                    }
                    #endregion
                }
                else
                {
                    MessageBox.Show("Wrong Package/UnitID QRCode format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    return;
                }
                #endregion
            }
            else if (dcdData.Trim().StartsWith("PN:"))
            {
                #region Old label
                TemCuon labelPackage = null;
                try
                {
                    labelPackage = new TemCuon(dcdData.Trim());
                }
                catch { MessageBox.Show("Wrong Package/UnitID QRCode format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; }

                if (Convert.ToInt32(labelPackage.Type) == 0)
                {
                    #region Scan Unit ID
                    try
                    {
                        if (labelPackage.IdCuon != null && labelPackage.IdCuon != "")
                        {
                            if (checkReservedInOtherList(labelPackage.IdCuon, false))
                            {
                                MessageBox.Show("Package/Uid already exists in another reserved list!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }

                            DataRow[] rs_package = dtList.Select(COL_LOT_ID + " = '" + labelPackage.IdCuon + "'");
                            if (rs_package.Length > 0)
                            {
                                MessageBox.Show("Unit ID " + labelPackage.IdCuon + " already exists in the list !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                return;
                            }
                            else
                            {
                                //Validate Unit ID
                                Lots lot     = new Lots();
                                Lots lotInfo = lot.getInfo(labelPackage.IdCuon);
                                if (lotInfo == null)
                                {
                                    MessageBox.Show("Unit ID " + labelPackage.IdCuon + " is not exists in inventory !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                    return;
                                }

                                Packages PackageInfo = validateLot(lotInfo.id);
                                if (PackageInfo == null)
                                {
                                    return;
                                }

                                if (PackageInfo.packageNumber == null)
                                {
                                    if (this.dtList.Rows.Count == 0)
                                    {
                                        addPackageToList("", labelPackage.IdCuon);
                                    }
                                    else
                                    {
                                        DataRow[] rs = dtList.Select(COL_PACK_ID + " = ''");
                                        if (rs.Length > 0)
                                        {
                                            addPackageToList("", labelPackage.IdCuon);
                                        }
                                        else
                                        {
                                            if (Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]).Length > 0)
                                            {
                                                MessageBox.Show("Request scan unit ID in package " + Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]));
                                            }
                                            else
                                            {
                                                MessageBox.Show("Request scan free unit ID !");
                                            }
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.dtList.Rows.Count == 0)
                                    {
                                        addPackageToList(PackageInfo.packageNumber, labelPackage.IdCuon);
                                    }
                                    else
                                    {
                                        DataRow[] rs = dtList.Select(COL_PACK_ID + " = '" + PackageInfo.packageNumber + "'");
                                        if (rs.Length > 0)
                                        {
                                            addPackageToList(PackageInfo.packageNumber, labelPackage.IdCuon);
                                        }
                                        else
                                        {
                                            if (Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]).Length > 0)
                                            {
                                                MessageBox.Show("Request scan unit ID in package " + Convert.ToString(this.dtList.Rows[0][COL_PACK_ID]));
                                            }
                                            else
                                            {
                                                MessageBox.Show("Request scan free unit ID !");
                                            }
                                            return;
                                        }
                                    }
                                }

                                if (DestPackageNumber != null && DestPackageNumber.Trim().Length > 0 && !btnSave.Enabled)
                                {
                                    //enable button save
                                    btnSave.Enabled  = true;
                                    btnClear.Enabled = true;
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Error scan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        }
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.InnerException.ToString());
                        //MessageBox.Show("Error during loading information !", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    #endregion
                }
                else if (Convert.ToInt32(labelPackage.Type) == 1)
                {
                    #region Scan package
                    if (DestPackageNumber != null && DestPackageNumber.Length > 0)
                    {
                        DialogResult mgb = new DialogResult();
                        mgb = MessageBox.Show("Are you sure you want to update the package number?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        if (mgb != DialogResult.Yes)
                        {
                            return;
                        }
                    }

                    if (!checkExistsPackage(labelPackage.IdCuon))
                    {
                        return;
                    }

                    if (checkReservedInOtherList(labelPackage.IdCuon, true))
                    {
                        MessageBox.Show("Package/Uid already exists in another reserved list!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        return;
                    }

                    DestPackageNumber         = labelPackage.IdCuon;
                    txtDestPackageNumber.Text = DestPackageNumber;

                    if (this.dtList.Rows.Count > 0 && !btnSave.Enabled)
                    {
                        //enable button save
                        btnSave.Enabled  = true;
                        btnClear.Enabled = true;
                    }
                    #endregion
                }
                else
                {
                    MessageBox.Show("Wrong Package/UnitID QRCode format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return;
                }
                #endregion
            }
            else if (Util.OnlyHexInString(dcdData.Trim()))
            {
                #region Serial number

                string SerialNumber = dcdData.Trim();
                checkScan(SerialNumber, null);

                #endregion
            }
            else
            {
                MessageBox.Show("Wrong Package/UnitID QRCode format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return;
            }
        }
コード例 #8
0
        private void dcdEvent_Scanned(object sender, DecodeEventArgs e)
        {
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            TemVitri temVitriTMP = null;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);

                if (dcdData.Length < 20)
                {
                    dangQuet    = 0;
                    temVitriTMP = new TemVitri(dcdData);
                }
                else
                {
                    dangQuet = 1;
                    temCuon  = new TemCuon(dcdData);
                }


                //quet tem Vitri
                if (dangQuet == 0)
                {
                    if (temVitriTMP.ID == 0)
                    {
                        MessageBox.Show("Ma vach khong hop le", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        if (temViTri != null)
                        {
                            if (temViTri.ID != temVitriTMP.ID)
                            {
                                MessageBox.Show("Ban phai xoa vi tri cu truoc khi quet vi tri moi", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                            }
                        }
                        else
                        {
                            temViTri = temVitriTMP;

                            //load thong tin vi tri
                            lblViTri.Text       = temViTri.ID + "-" + temViTri.Ten;
                            btnXoaVitri.Enabled = true;
                            dangQuet            = 1;

                            lblStartMsgVitri.Visible = false;

                            if (dtCuon.Rows.Count > 0)
                            {
                                btnSave.Enabled  = true;
                                btnReset.Enabled = true;
                            }
                        }
                    }
                }
                //Quet tem Cuon
                else if (dangQuet == 1 || dangQuet == 2)
                {
                    dgListCuon.Visible = true;
                    //temCuon = new TemCuon(dcdData);
                    lblStartMsgLinhKien.Visible = false;
                    if (temCuon.IdCuon == null)
                    {
                        MessageBox.Show("Ma vach khong hop le", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        //check exist in the added list
                        TemCuon tmp = listTemCuon.Find(x => x.IdCuon == temCuon.IdCuon);
                        if (tmp == null)
                        {
                            listTemCuon.Add(temCuon);

                            updateGridLayout();

                            dangQuet = 2;

                            lblStartMsgLinhKien.Visible = false;
                            SoKien++;

                            if (temViTri != null)
                            {
                                btnSave.Enabled  = true;
                                btnReset.Enabled = true;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Cuon/Thung nay da duoc quet", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Co loi xay ra, hay quet lai tu dau", "Chu y", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }