Esempio n. 1
0
 private void BtnTransfer_Click(object sender, EventArgs e)
 {
     try
     {
         if (TxtRouteName.Text == "")
         {
             MessageBox.Show(this, "Select Any Route First", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             DataTable dt = DbClass.getdata(CommandType.Text, "select * from route.route_data1 where ID='" + TxtRouteID.Text + "'");
             if (dt.Rows.Count > 0)
             {
                 TreeListNode ss = trlRoute11.FocusedNode;
                 PublicClass.routename = TxtRouteName.Text;
                 PublicClass.RouteId   = TxtRouteID.Text.Trim();
                 updown = new frmupdownload();
                 if (updown.check == null)
                 {
                     MessageBox.Show(this, "Please Connect Instrument First..", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return;
                 }
                 if (updown.check == "true")
                 {
                     updown.MainForm      = _objMain;
                     updown.tsSerial.Text = "Instrument S.No= " + PublicClass.InstrumentSerial;
                     updown.ShowDialog();
                 }
                 else if (updown.check == "false")
                 {
                     MessageBox.Show(this, "You are connected unautherized Instrument..", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return;
                 }
             }
             else
             {
                 MessageBox.Show(this, "Load Any Level in Route First", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return;
             }
         }
     }
     catch (Exception ex) {
         throw ex;
     }
 }
Esempio n. 2
0
        private void btnupload_Click(object sender, EventArgs e)
        {
            _objMain.lblStatus.Caption = "Status: Uploading Route";
            objupdown = new frmupdownload();
            upload    = new frmUpload();
            string text1           = null;
            string CurrentInstName = PublicClass.currentInstrument;

            try
            {
                if (PublicClass.routename != null)
                {
                    upload.SelectedRouteName = PublicClass.routename;
                    upload.ShowDialog();
                    SplashScreenManager.ShowForm(typeof(WaitForm3));
                    IsInstrument = upload.IsInstrumentSelected;
                    if (CurrentInstName == "Kohtect-C911")
                    {
                        try
                        {
                            if (IsInstrument == false)
                            {
                                PathToUpLoad     = upload.PCPath;
                                PublicClass.Path = PathToUpLoad;
                            }
                            else
                            {
                                PathToUpLoad     = upload.textBox1.Text;
                                PublicClass.Path = PathToUpLoad;
                            }
                            if (upload.IsCancelClicked == false)
                            {
                                clsdb.Main = _objMain;
                                clsdb.C911uploaddata(PublicClass.routename, PublicClass.Path);
                                if (clsdb.check == "true")
                                {
                                    _objMain.lblStatus.Caption = "Status: Uploading Route Successfully In Instrument";
                                    MessageBox.Show("Route Create Sucessfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    _objMain.ribbonControl1.Enabled = true;
                                    this.Enabled = true;
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("No point In Route", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    _objMain.ribbonControl1.Enabled = true;
                                    this.Enabled = true;
                                    this.Close();
                                }
                                SplashScreenManager.CloseForm();
                            }
                        }
                        catch { }
                    }
                    else if (CurrentInstName == "SKF/DI")
                    {
                        try
                        {
                            if (IsInstrument == false)
                            {
                                PathToUpLoad     = upload.PCPath;
                                PublicClass.Path = PathToUpLoad;
                            }
                            else
                            {
                                string path = Path.GetTempPath();
                                text1        = upload.textBox1.Text;
                                PathToUpLoad = path + PublicClass.routename + ".dat";
                            }
                            if (upload.IsCancelClicked == false)
                            {
                                clsdb.Main = _objMain;
                                _objMain.ribbonControl1.Enabled = false;
                                this.Enabled = false;
                                if (text1 == null)
                                {
                                    clsdb.UsbSelected = true;
                                    clsdb.DIuploaddata(PublicClass.routename);
                                    if (clsdb.check == "true")
                                    {
                                        _objMain.lblStatus.Caption = "Status: Uploading Route Successfully In Instrument";
                                        MessageBox.Show("Route Create Sucessfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        SplashScreenManager.CloseForm();
                                        _objMain.ribbonControl1.Enabled = true;
                                        this.Enabled = true;
                                        this.Close();
                                    }
                                    else
                                    {
                                        MessageBox.Show("No point In Route", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                        SplashScreenManager.CloseForm();
                                        _objMain.ribbonControl1.Enabled = true;
                                        this.Enabled = true;
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    clsdb.DIuploaddata(PublicClass.routename);
                                    if (clsdb.check == "true")
                                    {
                                        _objMain.lblStatus.Caption = "Status: Uploading Route Successfully In Instrument";
                                        MessageBox.Show("Route Create Sucessfully In Instrument", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        //SplashScreenManager.CloseForm();
                                        _objMain.ribbonControl1.Enabled = true;
                                        this.Enabled = true;
                                        this.Close();
                                    }
                                    else
                                    {
                                        MessageBox.Show("No point In Route", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                        //SplashScreenManager.CloseForm();
                                        _objMain.ribbonControl1.Enabled = true;
                                        this.Enabled = true;
                                        this.Close();
                                    }
                                }
                            }
                            else
                            {
                                _objMain.lblStatus.Caption = "Status: Error";
                                MessageBox.Show("Route not Created", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                this.Enabled = true;
                                _objMain.ribbonControl1.Enabled = true;
                                this.Close();
                            }
                            SplashScreenManager.CloseForm();
                        }
                        catch { SplashScreenManager.CloseForm(); }
                    }
                    else
                    {
                        if (IsInstrument == false)
                        {
                            PathToUpLoad = upload.PCPath;
                        }
                        else
                        {
                            if (m_objRAPI.DevicePresent)
                            {
                                m_objRAPI.Connect();
                                string path = Path.GetTempPath();
                                text1        = upload.textBox1.Text;
                                PathToUpLoad = path + PublicClass.routename + ".sdf";
                            }
                            else
                            {
                                SplashScreenManager.CloseForm();
                                MessageBox.Show(this, "Device Not Connected....", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }
                        if (upload.IsCancelClicked == false)
                        {
                            _objMain.ribbonControl1.Enabled = false;
                            this.Enabled = false;
                            bool sStatus = CheckDemoSdf();
                            if (sStatus == true)
                            {
                                if (text1 != null)
                                {
                                    getRouteInformation(PublicClass.routename);
                                    UploadData _objupload = new UploadData();
                                    _objupload.Main = _objMain;
                                    _objupload.UploadValuesToBenstone();
                                    _objMain.lblStatus.Caption = "Status: Uploading Route";
                                    StartTheThread();
                                    _objMain.lblStatus.Caption = "Status: Uploading Route Successfully In Instrument";
                                    MessageBox.Show("Route Create Sucessfully In Instrument", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    _objMain.ribbonControl1.Enabled = true;
                                    this.Enabled = true;
                                }
                                else
                                {
                                    getRouteInformation(PublicClass.routename);
                                    UploadData _objupload = new UploadData();
                                    _objupload.Main = _objMain;
                                    _objupload.UploadValuesToBenstone();
                                    _objMain.lblStatus.Caption = "Status: Uploading Route Successfully";
                                    MessageBox.Show("Route Create Sucessfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    _objMain.ribbonControl1.Enabled = true;
                                    this.Enabled = true;
                                }
                            }
                            else
                            {
                                _objMain.lblStatus.Caption = "Status: Error";
                                MessageBox.Show("Route not Created", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                this.Enabled = true;
                                _objMain.ribbonControl1.Enabled = true;
                                this.Close();
                            }
                        }
                        if (PublicClass.routename != null)
                        {
                            this.Close();
                        }
                        SplashScreenManager.CloseForm();
                    }
                }
            }
            catch { SplashScreenManager.CloseForm(); }
        }