Esempio n. 1
0
        public static Double CF_DIN_70020(Double DbT, Double Pb)
        {
            try
            {
                double Sq_Root    = 1;
                double inv_corfct = 1;

                if ((Pb >= 1.1000) || (Pb <= 0.900))
                {
                    Pb = 1.013;
                }
                if ((DbT >= 50.0) || (DbT <= 10))
                {
                    DbT = 31;
                }

                Sq_Root    = Math.Sqrt(((273 + DbT) / 293));
                inv_corfct = (Sq_Root * (760 / (Pb * 750)));

                return(Convert.ToDouble(inv_corfct.ToString("0.00000")));
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Error in CF_DIN_70020" + ex.Message);
                return(1.0000);
            }
        }
Esempio n. 2
0
 private void Load_InCell()
 {
     try
     {
         int x = 0;
         Rw             = PrjGV.CurrentRow.Index;
         ComboBox1.Text = PrjGV[0, Rw].Value.ToString();
         ComboBox2.Text = PrjGV[1, Rw].Value.ToString();
         ComboBox3.Text = PrjGV[2, Rw].Value.ToString();
         ComboBox4.Text = PrjGV[3, Rw].Value.ToString();
         ComboBox5.Text = PrjGV[4, Rw].Value.ToString();
         ComboBox6.Text = PrjGV[5, Rw].Value.ToString();
         for (x = 0; x < 10; x++)
         {
             DGPrj[1, x].Value = PrjGV[(x + 6), Rw].Value.ToString();
         }
         Global.Open_Connection("gen_db", "con");
         Adp.Update(ds.Tables[0]);
     }
     catch (Exception ex)
     {
         Global.Create_OnLog(ex.Message + " :  Load In Cell....", "Alart");
         //MessageBox.Show("Error Code:-11002 " + ex.Message);
     }
 }
Esempio n. 3
0
        private void Load_DataGrid()
        {
            try
            {
                Adp = new MySqlDataAdapter("SELECT * FROM tblProject", Global.con);
                ds  = new DataSet();
                Adp.Fill(ds);
                MySqlCommandBuilder cBuilder = new MySqlCommandBuilder(Adp);
                BindingSource       bSource  = new BindingSource();
                bSource.DataSource = ds.Tables[0];
                PrjGV.DataSource   = bSource;

                int x = 0;
                for (x = 0; x < (PrjGV.RowCount - 1); x++)
                {
                    ComboBox1.Items.Add(PrjGV[0, x].Value);
                }
                ComboBox1.SelectedIndex = 0;
                Load_InCell();
                Adp.Update(ds.Tables[0]);
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Load GridData....", "Alart");
                //MessageBox.Show("Error Code:-11003" + ex.Message);
            }
        }
Esempio n. 4
0
        public static void Read_LimtStandby()
        {
            try
            {
                Global.Open_Connection("lim_db", "conLim");
                MySqlCommand    cmd = new MySqlCommand("SELECT * FROM LIM_STANDBY", Global.conLim);
                MySqlDataReader Rd  = cmd.ExecuteReader();
                Int16           x   = 0;
                while (Rd.Read())
                {
                    Global.Ls[x] = Rd.GetValue(3).ToString();
                    Global.Hs[x] = Rd.GetValue(4).ToString();

                    x += 1;
                }
                Rd.Close();
                Global.con.Close();
                Global.Create_OnLog("Limit Standard file Read Successfully .....", "Normal");
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Limit Standard file not Read Successfully .....", "Alart");

                //MessageBox.Show("Error Code:-15019", ex.Message);
            }
        }
Esempio n. 5
0
        private void LoadError()
        {
            try
            {
                //"D:\\TestCell_" + Global.T_CellNo + "\\" + Global.Data_Dir + "\\Log_Data\\" + OnLog_Data + ".csv"

                GridGen.Refresh();
                String          DataPath    = "D:\\TestCell_" + Global.T_CellNo + "\\" + Global.Data_Dir + "\\";
                string          strFileName = DataPath + "Log_Data\\" + Global.OnLog_Data + ".csv";
                OleDbConnection conn        = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(strFileName) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\"");
                conn.Open();
                OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM " + System.IO.Path.GetFileName(strFileName), conn);
                DataSet          ds1     = new DataSet("Temp");
                adapter.Fill(ds1);
                GridGen.DataSource = ds1.Tables[0];
                for (int i = 0; i <= 6; i++)
                {
                    if (GridGen.Columns[i].Name.Substring(3, 8) == "Not_Prog")
                    {
                        GridGen.Columns[i].Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Alart", ex.Message + " :  LoadError file....");
                //MessageBox.Show("Error Code:- 12002", ex.Message);
            }
        }
Esempio n. 6
0
 private void TextBox24_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (!(string.IsNullOrEmpty(TextBox24.Text)))
         {
             char[] chars = TextBox24.Text.ToCharArray();
             for (int i = 0; i < TextBox24.Text.Length; i++)
             {
                 int code;
                 code = Convert.ToInt16(chars[i]);
                 if (!((!(code > 57 || code < 48)) || (code == 46)))
                 {
                     TextBox24.Text           = TextBox24.Text.Remove(i, 1);
                     TextBox24.SelectionStart = TextBox24.Text.Length;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Code:- 14016", ex.Message);
         Global.Create_OnLog(ex.Message);
     }
 }
Esempio n. 7
0
        private void btnStart_Click_1(object sender, EventArgs e)
        {
            if (Global.flg_CycleStarted == true)
            {
                if (btnStart.Text == "Start-FastLog Data")
                {
                    btnStart.Text      = "Stop-FastLog Data";
                    Global.flg_fastlog = true;
                    Global.flg_fstart  = true;
                    Global.flg_fstop   = false;
                    Global.Create_OnLog("Fast Logging Staerted.....", "Alart");
                    frqVal.Text        = "Fast log started...........    " + Global.HzLog;
                    frqVal.ForeColor   = Color.Yellow;
                    frqVal.BackColor   = Color.Red;
                    ctlLED1.tmron      = true;
                    btnStart.BackColor = Color.Gray;
                    btnStart.ForeColor = Color.White;

                    long interval;

                    // Read interval from form

                    if (!long.TryParse(Global.Dly_cnt.ToString(), out interval))
                    {
                        return;
                    }

                    // Set timer interval
                    _microTimer.Interval = interval;

                    // Ignore event if late by half the interval
                    _microTimer.IgnoreEventIfLateBy = interval / 2;

                    // Start timer
                    _microTimer.Start();
                }
                else if (btnStart.Text == "Stop-FastLog Data")
                {
                    btnStart.Text      = "Start-FastLog Data";
                    Global.flg_fastlog = false;
                    _microTimer.Stop();
                    ctlLED1.tmron = false;
                    Global.Create_OnLog("Fast Logging Stopped.....", "Alart");
                    Global.flg_fstart  = false;
                    Global.flg_fstop   = true;
                    frqVal.Text        = "Fast log Stopped.............." + Global.HzLog;
                    frqVal.BackColor   = Color.Gainsboro;
                    frqVal.ForeColor   = Color.Blue;
                    btnStart.BackColor = Color.Gainsboro;
                    btnStart.ForeColor = Color.Blue;
                }
            }
            else
            {
                MessageBox.Show("First Start the cycle ..........", "Dynalec Cont5rols Pvt. ltd");
                return;
            }
        }
Esempio n. 8
0
        //private void fill_Engine_Details()
        //{

        //    String Str = "";
        //    Global.CStopTm = DateTime.Now.ToString("hh:mm:ss tt");

        //    for (int x = 0; x <= 19; x++) EngData[x] = null;
        //    //string  Str = null;
        //    EngData[0] = Global.Eng_FileNm;
        //    EngData[1] = Global.EngType;
        //    EngData[2] = Global.TestRef;
        //    EngData[3] = Global.FipNo;
        //    EngData[4] = Global.EngNo;
        //    EngData[5] = Global.NCyl;
        //    EngData[6] = Global.Bor;
        //    EngData[7] = Global.Strk;
        //    EngData[8] = Global.Svol;

        //    if (Global.flg_Radiator == true) EngData[9] = "YES"; else EngData[9] = "NO";
        //    if (Global.flg_Fan == true) EngData[10] = "YES"; else EngData[10] = "NO";
        //    if (Global.flg_AirCln == true) EngData[11] = "YES"; else EngData[11] = "NO";
        //    if (Global.flg_Silincer == true) EngData[12] = "YES"; else EngData[12] = "NO";

        //    EngData[13] = "EDB- 200";
        //    EngData[14] = Global.OperatorNm;
        //    EngData[15] = Global.EnginerNm;
        //    EngData[16] = Global.T_CellNo;
        //    EngData[17] = Global.CStrtTm;
        //    EngData[18] = Global.CStopTm;
        //    if (Global.ErrorMatrix == null) Global.ErrorMatrix = "*******";
        //    EngData[19] = Global.ErrorMatrix;

        //    Str = "";
        //    for (int i = 0; i <= 18; i++)
        //    {
        //        if ((EngData[i] == null) || (EngData[i] == ""))
        //        {
        //            EngData[i] = "****";
        //        }
        //        Str = Str + EngData[i] + "', '";
        //    }
        //    Global.Open_DataConn("Data", "conData");
        //    SqlCommand cmd2 = new SqlCommand("Insert into EngDetails values('" + Str + EngData[19] + "' )", Global.conData);
        //    cmd2.ExecuteNonQuery();
        //    Global.conData.Close();

        //}

        private void ExportData()
        {
            try
            {
                if (Global.flg_RecorsPmData == true)
                {
                    Global.Open_PMConn(Global.CDate, "conPM");
                    MySqlDataAdapter adp = new MySqlDataAdapter("select * from " + Global.Eng_PMFileNm, Global.conPM);
                    DataSet          ds  = new DataSet();
                    adp.Fill(ds);
                    prgT.Maximum = ds.Tables[0].Rows.Count - 1;
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                        {
                            prgT.Value = i;
                            string str  = "";
                            string str1 = "'" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'";
                            for (int j = 1; j <= ds.Tables[0].Columns.Count - 2; j++)
                            {
                                str = str + ds.Tables[0].Rows[i].ItemArray[j].ToString() + ", ";
                            }

                            string str2 = "'" + ds.Tables[0].Rows[i].ItemArray[13].ToString() + "'";


                            MySqlCommand cmd = new MySqlCommand("Insert into " + Global.Eng_PMFileNm + "values(" + str1 + "," + str + "" + str2 + " )", Global.conPM);
                            cmd.ExecuteNonQuery();
                        }
                        Global.conPM.Close();
                        MessageBox.Show("Data Transfer Over");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("No Data ......");
                        this.Close();
                    }
                }
                else
                {
                    this.Close();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error Code:-15006", ex.Message);
                Global.Create_OnLog(ex.Message + " :  Export Data....", "Alart");
                this.Close();
            }
        }
Esempio n. 9
0
        private void frmInOut_Load(object sender, EventArgs e)
        {
            DGIn.RowCount = 16;

            tmrRead.Enabled = true;
            try
            {
                foreach (DataGridViewColumn colm in ViewGrid.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                foreach (DataGridViewColumn colm in DGIn.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                foreach (DataGridViewColumn colm in DGOut.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                Global.Rd_Confg();

                int Rn = 0;
                while (Rn < 125)
                {
                    ViewGrid.RowCount    += 1;
                    ViewGrid[0, Rn].Value = Global.PNo[Rn].ToString();
                    ViewGrid[1, Rn].Value = Global.PSName[Rn].ToString();
                    ViewGrid.Font         = new System.Drawing.Font("Calibri", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                    ViewGrid[3, Rn].Value = Global.PMin[Rn].ToString() + "  :  " + Global.PMax[Rn].ToString();
                    ViewGrid[4, Rn].Value = Global.PUnit[Rn].ToString();
                    ViewGrid[5, Rn].Value = Global.PMark[Rn].ToString();
                    Rn += 1;
                }

                //Double P1 = Convert.ToDouble(Global.GenData[Global.fxd[10]]); //Global.Atp; //
                //Double D1 = Convert.ToDouble(Global.GenData[Global.fxd[8]]) + 4; //.Global.Drb; //
                //Double W1 = Convert.ToDouble(Global.GenData[Global.fxd[9]]);  //  Global.Web; // Convert.ToDouble(Global.GenData[Global.fxd[9]]);

                //textBox1.Text = P1.ToString();
                //textBox2.Text = D1.ToString();
                //textBox3.Text = W1.ToString();
                Global.Rd_System();
                Load_DigInOut();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Load frmIO....", "Alart");
                //MessageBox.Show("Error Code:-5001 " + ex.Message);
            }
        }
Esempio n. 10
0
        //*******************************************************
        public void LoadDgView()
        {
            try
            {
                Global.Open_Connection("gen_db", "con");
                MySqlDataAdapter adp = new MySqlDataAdapter("Select * from Tb_View Order By N", Global.con);
                DataSet          ds  = new DataSet();
                adp.Fill(ds);

                DGView.ColumnCount = 22;
                if (DGView.RowCount >= 10)
                {
                    DGView.RowCount = Global.Sn + 2;
                }
                else
                {
                    DGView.RowCount = 12;
                }
                DGView.Font = new System.Drawing.Font("Book Antiqua", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                DGView.Columns[0].Width = 50;
                DGView.Columns[0].Name  = "Sn";
                DGView.Columns[1].Width = 120;
                DGView.Columns[1].Name  = "LogTime";
                for (int i = 0; i < 20; i++)
                {
                    DGView.Columns[i + 2].Width = 80;
                    ViewNo[i] = ds.Tables[0].Rows[i].ItemArray[1].ToString();
                    DGView.Columns[i + 2].Name = Global.PSName[int.Parse(ViewNo[i])] + "    " + Global.PUnit[int.Parse(ViewNo[i])];
                }

                DGView.Columns[21].Width = 180;
                //DGView.Rows[Global.Sn].Cells[0].Value = Global.Sn;
                //DGView.Rows[Global.Sn].Cells[1].Value = Global.GenData[122];

                for (int i = 0; i < 22; i++)
                {
                    DGView.Rows[Global.Sn].Cells[i + 2].Value = Global.Data[int.Parse(ViewNo[i])];
                }
                if (Global.Sn >= 10)
                {
                    DGView.RowCount += 1;
                    DGView.FirstDisplayedScrollingRowIndex = (Global.Sn - 5);
                }
                DGView.Rows[Global.Sn].Selected = true;
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Error in frmMain: DGView() : ", "Alart");
                return;//MessageBox.Show("Error Code:- 12002", ex.Message);
            }
        }
Esempio n. 11
0
        private void EngOK_Load(object sender, EventArgs e)
        {
            try
            {
                MSFG.RowCount    = 20;
                MSFG.ColumnCount = 2;
                String Str = "";
                foreach (DataGridViewColumn colm in MSFG.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                for (int i = 1000; i <= 1018; i++)
                {
                    MSFG.Rows[i - 1000].Cells[0].Value = i;
                }

                MSFG.Rows[0].Cells[1].Value  = "Low Oil Pressure";
                MSFG.Rows[1].Cells[1].Value  = "Clutch Plate Damage";
                MSFG.Rows[2].Cells[1].Value  = "Cylinder Head gasket leakage";
                MSFG.Rows[3].Cells[1].Value  = "Rear Oil Seal Leak";
                MSFG.Rows[4].Cells[1].Value  = "Oil Filter Leak";
                MSFG.Rows[5].Cells[1].Value  = "Dip stick Holder Leak";
                MSFG.Rows[6].Cells[1].Value  = "Head Cover Leakage";
                MSFG.Rows[7].Cells[1].Value  = "Cam Oil seal Leakage";
                MSFG.Rows[8].Cells[1].Value  = "High Blowby";
                MSFG.Rows[9].Cells[1].Value  = "Water Pump Leakage";
                MSFG.Rows[10].Cells[1].Value = "Rear Cover Leakage";
                MSFG.Rows[11].Cells[1].Value = "Front Cover Leakage";
                MSFG.Rows[12].Cells[1].Value = "Tappet noise";
                MSFG.Rows[13].Cells[1].Value = "Abnormal Noise from Head";
                MSFG.Rows[14].Cells[1].Value = "Abnormal Noise from Block";
                MSFG.Rows[15].Cells[1].Value = "Timer Belt Noise";
                MSFG.Rows[16].Cells[1].Value = "Oil Sump Leak";
                MSFG.Rows[17].Cells[1].Value = "Low Power";
                MSFG.Rows[18].Cells[1].Value = "Injector Leakage";
                lblDfMatrix.Text             = "";

                //******************
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Fill Engine Details....", "Alart");
                //MessageBox.Show("ErrorCode :- 2001", ex.Message);
            }
        }
Esempio n. 12
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     { /////////////////////P 27/2/2013//////////////
         Global.Open_Connection("gen_db", "con");
         MySqlCommand    cmd = new MySqlCommand("Select Passw from Sec where TokenNo= '" + comboBox1.Text + "'", Global.con);
         MySqlDataReader rd  = cmd.ExecuteReader();
         while (rd.Read())
         {
             str = rd.GetValue(0).ToString();
         }
         Global.con.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         Global.Create_OnLog(": comboBox1_SelectedIndex", "Alart");
     }
 }
Esempio n. 13
0
        private void Load_DigInOut()
        {
            try
            {
                DGIn.RowCount = 16;

                Global.Open_Connection("gen_db", "con");
                MySqlCommand    cmd = new MySqlCommand("SELECT * FROM tbsys WHERE FileName = 'DigInPuts'", Global.con);
                MySqlDataReader Rd  = cmd.ExecuteReader();
                Int16           x   = 0;
                while (Rd.Read())
                {
                    for (x = 0; x <= 15; x++)
                    {
                        DGIn[1, x].Value           = Rd.GetValue(x + 1).ToString();
                        DGIn[1, x].Style.BackColor = Color.Green;
                    }
                }
                Global.con.Close();

                //****************************

                DGOut.RowCount = 16;
                Global.Open_Connection("gen_db", "con");
                MySqlCommand    cmd1 = new MySqlCommand("SELECT * FROM tbsys WHERE FileName = 'DigOutPuts'", Global.con);
                MySqlDataReader Rd1  = cmd1.ExecuteReader();
                x = 0;
                while (Rd1.Read())
                {
                    for (x = 0; x <= 15; x++)
                    {
                        DGOut[1, x].Value           = Rd1.GetValue(x + 1).ToString();
                        DGOut[1, x].Style.BackColor = Color.Green;
                    }
                }
                Global.con.Close();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Load DigIO....", "Alart");
                //MessageBox.Show("Error Code;-5002 " + ex.Message);
            }
        }
Esempio n. 14
0
        //public static void fLog_Thread()
        //{
        //    try
        //    {

        //            while (true)
        //            {
        //                if (Global.flg_fastlog == true)
        //                {
        //                    Thread.Sleep(Global.Dly_cnt);
        //                    LogfData();
        //                }
        //            }

        //    }
        //    catch (Exception ex)
        //    {
        //        return;
        //    }
        //}
        ////**********************
        //public static void LogfData()
        //{
        //    try
        //    {
        //        int i = 0;
        //        Global.Capture_fData();
        //        String strData = null;
        //        for (i = 0; i <= 55; i++)
        //        {
        //            if (Global.fData[i] == null) Global.fData[i] = "0.0";
        //            strData = strData + Global.fData[i] + ", ";
        //        }
        //        strData = strData + Global.fData[56] + "\n";

        //        var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
        //        using (var wr = new StreamWriter(filePath, true))
        //        {
        //            var row = new List<string> { strData.Substring(0, strData.Length - 1) };
        //            var sb = new StringBuilder();
        //            foreach (string value in row)
        //            {
        //                if (sb.Length > 0)
        //                    sb.Append(",");
        //                sb.Append(value);
        //            }
        //            wr.WriteLine(sb.ToString());
        //        }
        //        //*****************************
        //    }
        //    catch (Exception ex)
        //    {
        //        Global.Create_OnLog("Data fast Log Problem... ", "Alart");
        //        Global.flg_SFCStart = false;
        //    }
        //}
        //************************
        //public static void LogfData()
        //{
        //    try
        //    {
        //        int i = 0;
        //        Global.Capture_fData();
        //        String strData = null;
        //        for (i = 0; i <= 40; i++)
        //        {
        //            if (Global.fData[i] == null) Global.fData[i] = "0.0";
        //            strData = strData + Global.fData[i] + ", ";
        //        }
        //        strData = strData + Global.fData[40] + "\n";

        //        var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
        //        using (var wr = new StreamWriter(filePath, true))
        //        {
        //            var row = new List<string> { strData.Substring(0, strData.Length - 1) };
        //            var sb = new StringBuilder();
        //            foreach (string value in row)
        //            {
        //                if (sb.Length > 0)
        //                    sb.Append(",");
        //                sb.Append(value);
        //            }
        //            wr.WriteLine(sb.ToString());
        //        }
        //        //*****************************
        //    }
        //    catch (Exception ex)
        //    {
        //        Global.Create_OnLog("Data fast Log Problem... ", "Alart");
        //        Global.flg_SFCStart = false;
        //    }
        //}
        ////***************************

        /// <summary>
//        /// /********************************************
        public static void LogfData()      //Only For Gantner
        {
            try
            {
                int i = 0;
                Global.Capture_fData();
                String strData = System.DateTime.Now.ToString("hh.mm.ss tt") + ", ";
                for (i = 1; i <= 22; i++)
                {
                    if (Global.fData[i] == null)
                    {
                        Global.fData[i] = "0.0";
                    }
                    strData = strData + Global.fData[i] + ", ";
                }
                strData = strData + Global.Data[22] + "\n";

                var filePath = Global.DataPath + "FastLog_Data\\" + Global.Eng_fData_FileNm + ".csv";
                using (var wr = new StreamWriter(filePath, true))
                {
                    var row = new List <string> {
                        strData.Substring(0, strData.Length - 1)
                    };
                    var sb = new StringBuilder();
                    foreach (string value in row)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(",");
                        }
                        sb.Append(value);
                    }
                    wr.WriteLine(sb.ToString());
                }
                //*****************************
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Data fast Log Problem... ", "Alart");
                Global.flg_SFCStart = false;
            }
        }
Esempio n. 15
0
 public static Double Cf_new(Double Patm, Double Tatm)
 {
     try
     {
         if ((Patm >= 1.1000) || (Patm <= 0.900))
         {
             Patm = 0.98;
         }
         if ((Tatm >= 50.0) || (Tatm <= 10))
         {
             Tatm = 31;
         }
         double cf = 1 + ((0.65 * (100 - Patm)) + (0.17 * (Tatm - 300))) / 100;
         return(Convert.ToDouble(cf.ToString("0.00000")));
     }
     catch (Exception ex)
     {
         Global.Create_OnLog("Error in CF_New" + ex.Message);
         return(1.0000);
     }
 }
Esempio n. 16
0
        private void fillcombo()
        {
            try
            {
                Global.Open_Connection("gen_db", "con");
                MySqlCommand cmd = new MySqlCommand("Select TokenNo from Sec", Global.con);
                //cmd.ExecuteNonQuery();
                MySqlDataReader rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    comboBox1.Items.Add(rd.GetValue(0));
                }

                Global.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 16001", ex.Message);
                Global.Create_OnLog("Login Failed.....", "Alart");
            }
        }
Esempio n. 17
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Global.Open_Connection("gen_db", "con");
         MySqlCommand    cmd = new MySqlCommand("Select Passw from Sec where TokenNo= '" + comboBox1.Text + "'", Global.con);
         MySqlDataReader rd  = cmd.ExecuteReader();
         while (rd.Read())
         {
             str = rd.GetValue(0).ToString();
         }
         Global.con.Close();
         if ((str == textBox1.Text.Trim()) && (comboBox1.Text.Trim() == "Supervisor"))
         {
             Global.flg_Log_supervisor = true;
             this.Close();
         }
         else if ((str == textBox1.Text.Trim()) && (comboBox1.Text.Trim() == "Service"))
         {
             Global.flg_Log_service = true;
             this.Close();
         }
         else
         {
             MessageBox.Show("Password is wrong ");
             textBox1.Text  = "";
             comboBox1.Text = "";
             comboBox1.Focus();
             Global.flg_Log_supervisor = false;
             Global.flg_Log_service    = false;
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show("Error Code:- 16002", ex.Message);
         Global.Create_OnLog("Check Password    ", "Alart"); //  button1_Click");
     }
 }
Esempio n. 18
0
        private void frmSimulation_Load(object sender, EventArgs e)
        {
            try
            {
                Global.Open_Connection("gen_db", "con");
                MySqlCommand    cmd1 = new MySqlCommand("SELECT * FROM TbSys WHERE FileName = 'EngNo'", Global.con);
                MySqlDataReader Rd1  = cmd1.ExecuteReader();

                while (Rd1.Read())
                {
                    textBox36.Text = Rd1.GetValue(18).ToString();
                    textBox37.Text = Rd1.GetValue(19).ToString();
                    textBox38.Text = Rd1.GetValue(20).ToString();
                    textBox39.Text = Rd1.GetValue(21).ToString();
                }
                Global.con.Close();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " : Simulation....", "Alart");
                //MessageBox.Show("Error - 1001", ex.Message);
            }
        }
Esempio n. 19
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (str == textBox1.Text.Trim())
         {
             frmMain frm = new frmMain();
             frm.ShowDialog(this);
             frm.Dispose();
             this.Close();
         }
         else
         {
             MessageBox.Show("Password is wrong ");
             textBox1.Text = "";
             textBox1.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Code:- 16002", ex.Message);
         Global.Create_OnLog(ex.Message + ": button1_Click");
     }
 }
Esempio n. 20
0
        private void frmProject_Load(object sender, EventArgs e)
        {
            try
            {
                ComboBox1.Items.Clear();
                ComboBox2.Items.Clear();
                ComboBox3.Items.Clear();
                ComboBox4.Items.Clear();

                DGPrj.RowCount           = 10;
                DGPrj.RowTemplate.Height = 30;
                foreach (DataGridViewColumn colm in DGPrj.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }

                DGPrj[0, 0].Value = "Engine Rated Power (kW):";
                DGPrj[0, 1].Value = "@ Engine rpm :";
                DGPrj[0, 2].Value = "Engine Rated Torque (Nm):";
                DGPrj[0, 3].Value = "@ Engine rpm :";
                DGPrj[0, 4].Value = "Engine Flyup RPM:";
                DGPrj[0, 5].Value = "Engine Idle RPM:";
                DGPrj[0, 6].Value = "Engine Start RPM:";
                DGPrj[0, 7].Value = "Engine Start plus Duration(s)";
                DGPrj[0, 8].Value = "Engine Cummulative (hr.mm):";
                DGPrj[0, 9].Value = "Log PM' Data After Eng.OFF(secs)";
                DGPrj.Columns[1].DefaultCellStyle.ForeColor = Color.Red;

                ComboBox3.Items.Clear();
                ComboBox3.Refresh();

                Global.Open_Connection("seq_db", "conSeq");
                MySqlCommand cmd = new MySqlCommand("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='seq_db'", Global.conSeq);

                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    ComboBox3.Items.Clear();
                    while (reader.Read())
                    {
                        ComboBox3.Items.Add((string)reader["TABLE_NAME"]);
                    }
                    reader.Dispose();
                }


                cmd.Dispose();
                Global.conSeq.Close();
                ComboBox3.SelectedIndex = 0;

                //----------------------------------

                ComboBox4.Items.Clear();
                ComboBox4.Refresh();
                Global.Open_Connection("lim_db", "conLim");
                MySqlCommand cmd1 = new MySqlCommand("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'lim_db'", Global.conLim);
                using (MySqlDataReader reader = cmd1.ExecuteReader())
                {
                    ComboBox4.Items.Clear();
                    while (reader.Read())
                    {
                        ComboBox4.Items.Add((string)reader["TABLE_NAME"]);
                    }
                    reader.Close();
                }
                cmd1.Dispose();

                Global.conLim.Close();
                ComboBox4.SelectedIndex = 0;



                Global.Open_Connection("gen_db", "con");
                Adp = new MySqlDataAdapter("SELECT * FROM tblEngine", Global.con);
                ds  = new DataSet();
                Adp.Fill(ds);

                int x = 0;
                ComboBox2.Items.Clear();
                for (x = 0; x <= (ds.Tables[0].Rows.Count - 1); x++)
                {
                    ComboBox2.Items.Add(ds.Tables[0].Rows[x].ItemArray[0]);
                }
                ds.Dispose();
                Adp.Dispose();

                Global.Open_Connection("gen_db", "con");
                Adp = new MySqlDataAdapter("Select * from tblProject", Global.con);
                ds  = new DataSet();
                Adp.Fill(ds);
                PrjGV.DataSource        = ds.Tables[0];
                PrjGV.Columns[0].Width  = 100;
                PrjGV.Columns[1].Width  = 100;
                PrjGV.Columns[2].Width  = 100;
                PrjGV.Columns[3].Width  = 100;
                PrjGV.Columns[4].Width  = 100;
                PrjGV.Columns[5].Width  = 100;
                PrjGV.Columns[6].Width  = 60;
                PrjGV.Columns[7].Width  = 60;
                PrjGV.Columns[8].Width  = 60;
                PrjGV.Columns[9].Width  = 60;
                PrjGV.Columns[10].Width = 60;
                PrjGV.Columns[11].Width = 60;
                PrjGV.Columns[12].Width = 60;
                PrjGV.Columns[13].Width = 60;
                PrjGV.Columns[14].Width = 60;
                PrjGV.Columns[15].Width = 60;
                foreach (DataGridViewColumn colm in PrjGV.Columns)
                {
                    colm.SortMode = DataGridViewColumnSortMode.NotSortable;
                }
                Adp.Update(ds.Tables[0]);
                Load_InCell();
            }

            catch (Exception ex)
            {
                Global.Create_OnLog("ex.Message .........", "Alart");
                return;
                //MessageBox.Show ("Error Code:-11001  " + ex.Message);
            }
        }
Esempio n. 21
0
        public static void Check_Limit()
        {
            Int16  L  = 0;
            String A1 = "";
            String B1 = "";
            String C1 = "";
            String D1 = "";

            String A2    = "";
            String B2    = "";
            String C2    = "";
            String D2    = "";
            Double InVal = 0;

            try
            {
                for (L = 0; L <= 95; L++)
                {
                    if (L == 2)
                    {
                        L = 6;
                    }
                    if (Global.PSName[L] != "Not_Prog")
                    {
                        if (Global.LL1[L] != "")
                        {
                            A1 = Global.LL1[L].Substring(0, 1);
                        }
                        if (Global.L1[L] != "")
                        {
                            B1 = Global.L1[L].Substring(0, 1);
                        }
                        if (Global.H1[L] != "")
                        {
                            C1 = Global.H1[L].Substring(0, 1);
                        }
                        if (Global.HH1[L] != "")
                        {
                            D1 = Global.HH1[L].Substring(0, 1);
                        }

                        if (Global.LL1[L].Length > 1)
                        {
                            A2 = Global.LL1[L].Substring(1);
                        }
                        else
                        {
                            A2 = Global.PMin[L];
                        }
                        if (Global.L1[L].Length > 1)
                        {
                            B2 = Global.L1[L].Substring(1);
                        }
                        else
                        {
                            B2 = Global.PMin[L];
                        }
                        if (Global.H1[L].Length > 1)
                        {
                            C2 = Global.H1[L].Substring(1);
                        }
                        else
                        {
                            C2 = Global.PMax[L];
                        }
                        if (Global.HH1[L].Length > 1)
                        {
                            D2 = Global.HH1[L].Substring(1);
                        }
                        else
                        {
                            D2 = Global.PMax[L];
                        }

                        if (Global.GenData[L] != null)
                        {
                            InVal = Convert.ToDouble(Global.GenData[L]);
                        }
                        else
                        {
                            InVal = 0.0;
                        }
                        Global.StrAlarm = "";
                        if (((A1 == "O") && (InVal <= Convert.ToDouble(A2))) || ((D1 == "O") && (InVal >= Convert.ToDouble(D2))))
                        {
                            Global.Flg_AList = true;
                            if (Global.Flg_AList == true)
                            {
                                Global.arrLim[L] = "O : " + Global.PSName[L] + " ";
                                Global.BufLim[L] = "O";
                                Global.Create_OnLog("IGNITION OFF  : " + Global.PSName[L], "Normal");
                                Global.StrAlarm = "Engine OFF" + Global.arrLim[L];
                                Global.Create_OnLog("Engine ShutOFF: " + Global.PSName[L] + " : " + InVal, "Normal");
                                Global.flg_ChlLim = true;
                                return;
                            }
                        }
                        else if (((A1 == "I") && (InVal < Convert.ToDouble(A2))) || ((D1 == "I") && (InVal > Convert.ToDouble(D2))))
                        {
                            Global.Flg_AList = true;

                            if (Global.LimNo[L] <= 2)
                            {
                                Global.LimNo[L] += 1;
                            }
                            if (Global.LimNo[L] > 2)
                            {
                                if ((Global.Flg_AList == true) && (Global.BufLim[L] != "I"))
                                {
                                    Global.arrLim[L] = "I:" + Global.PSName[L] + " ";
                                    Global.BufLim[L] = "I";
                                    Global.StrAlarm  = "Engine @ Idle " + " : " + InVal;
                                    Global.Create_OnLog("Engine @ Idle: " + Global.PSName[L] + " : " + InVal, "Normal");
                                    Global.flg_ChlLim = true;
                                }
                            }
                            return;
                        }
                        //Global.StrAlarm = "";
                        else if (((B1 == "A") && (InVal < double.Parse(B2))) || ((C1 == "A") && (InVal > Double.Parse(C2))))
                        {
                            if ((Global.BufLim[L] != "A") && ((InVal < double.Parse(B2)) || ((C1 == "A") && (InVal > Double.Parse(C2)))))
                            {
                                Global.arrLim[L] = "A : " + Global.PSName[L] + " ";
                                Global.Create_OnLog("Alarm  : " + Global.PSName[L], "Normal");
                                Global.BufLim[L] = "A";
                                Global.Flg_AList = true;
                            }
                        }
                        else
                        {
                            Global.BufLim[L] = "N";
                        }
                    }
                }
                for (int k = 0; k <= 95; k++)
                {
                    Global.StrAlarm = Global.StrAlarm + Global.arrLim[k];
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Error Check_Limit :" + L + " : " + InVal, "Normal");
            }
        }
Esempio n. 22
0
        private void Check_File_Validation()
        {
            try
            {
                if (Global.EngNo == String.Empty)
                {
                    MessageBox.Show("Engine No. Not Entered ......., ");
                }
                else
                {
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand    cmd = new MySqlCommand("SELECT * FROM tblProject WHERE ProjectFile = '" + Global.PrjNm + "'", Global.con);
                    MySqlDataReader Rd  = cmd.ExecuteReader();
                    int             x   = 0;
                    while (Rd.Read())
                    {
                        for (x = 0; x < (Rd.FieldCount - 1); x++)
                        {
                            Global.Prj[x] = Rd.GetValue(x).ToString();
                        }
                    }

                    Global.TestTyp  = Global.Prj[5];
                    Global.cumhours = "0000.00.00";
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand    cmd1 = new MySqlCommand("SELECT * FROM tblEngine", Global.con);
                    MySqlDataReader Rd1  = cmd1.ExecuteReader();
                    x = 0;
                    while (Rd1.Read())
                    {
                        if (Global.Prj[1] == Rd1.GetValue(0).ToString())
                        {
                            f_Found = true;
                            break;
                        }
                        x += 1;
                        Rd1.Close();
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Engine File  Not Found ....... ");
                        return;
                    }
                    Global.con.Close();
                    //  **************************
                    x = 0;
                    Global.Open_Connection("lim_db", "conLim");
                    MySqlCommand cmd2 = new MySqlCommand("SELECT TABLE_NAME FROM lim_db.INFORMATION_SCHEMA.TABLES", Global.conLim);
                    using (MySqlDataReader reader = cmd2.ExecuteReader())
                    {
                        if (Global.Prj[3] == ((string)reader["TABLE_NAME"]))
                        {
                            f_Found = true;
                        }
                        x += 1;
                        reader.Close();
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Limit File  Not Found ....... ");
                        return;
                    }

                    cmd2.Dispose();
                    Global.conLim.Close();
                    //**********************************
                    x = 0;
                    Global.Open_Connection("seq_db", "conSeq");
                    MySqlCommand cmd3 = new MySqlCommand("SELECT TABLE_NAME FROM seq_db.INFORMATION_SCHEMA.TABLES", Global.conSeq);
                    using (MySqlDataReader reader = cmd3.ExecuteReader())
                    {
                        if (Global.Prj[2] == ((string)reader["TABLE_NAME"]))
                        {
                            f_Found = true;
                        }
                        x += 1;
                        reader.Close();
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Sequence File  Not Found ....... ");
                        return;
                    }
                    cmd3.Dispose();
                    Global.conSeq.Close();
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Check Validation EngDialog....", "Alart");
            }
        }
Esempio n. 23
0
        private void EngDialog_Load(object sender, EventArgs e)
        {
            try
            {
                TextBox1.Text = String.Empty;
                Global.Open_Connection("gen_db", "con");
                MySqlCommand    cmd1 = new MySqlCommand("SELECT * FROM TbSys WHERE FileName = 'EngNo'", Global.con);
                MySqlDataReader Rd1  = cmd1.ExecuteReader();

                while (Rd1.Read())
                {
                    TextBox1.Text = DateTime.Now.ToString("dd_MM_yyyy"); //Rd1.GetValue(1).ToString();
                    TextBox2.Text = Rd1.GetValue(2).ToString();
                    TextBox3.Text = Rd1.GetValue(3).ToString();
                    TextBox4.Text = Rd1.GetValue(4).ToString();
                    TextBox5.Text = Rd1.GetValue(5).ToString();
                    TextBox6.Text = Rd1.GetValue(6).ToString();
                    PrjCombo.Text = Rd1.GetValue(7).ToString();

                    if (Rd1.GetValue(8).ToString() == "True")
                    {
                        checkBox1.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBox1.CheckState = CheckState.Unchecked;
                    }
                    if (Rd1.GetValue(9).ToString() == "True")
                    {
                        checkBox2.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBox2.CheckState = CheckState.Unchecked;
                    }
                    if (Rd1.GetValue(10).ToString() == "True")
                    {
                        checkBox3.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBox3.CheckState = CheckState.Unchecked;
                    }
                    if (Rd1.GetValue(11).ToString() == "True")
                    {
                        checkBox4.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBox4.CheckState = CheckState.Unchecked;
                    }
                    if (Rd1.GetValue(12).ToString() == "True")
                    {
                        checkBox5.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBox5.CheckState = CheckState.Unchecked;
                    }

                    if (Rd1.GetValue(13).ToString() == "True")
                    {
                        rd_New.Checked = true;
                    }
                    else
                    {
                        rd_New.Checked = false;
                    }
                    if (Rd1.GetValue(14).ToString() == "True")
                    {
                        rd_Last.Checked = true;
                    }
                    else
                    {
                        rd_Last.Checked = false;
                    }
                    if (Rd1.GetValue(15).ToString() == "True")
                    {
                        rd_smooth.Checked = true;
                    }
                    else
                    {
                        rd_smooth.Checked = false;
                    }
                    if (Rd1.GetValue(16).ToString() == "True")
                    {
                        rd_standard.Checked = true;
                    }
                    else
                    {
                        rd_standard.Checked = false;
                    }

                    textBox7.Text  = Rd1.GetValue(17).ToString();
                    textBox8.Text  = Rd1.GetValue(18).ToString();
                    textBox13.Text = Rd1.GetValue(19).ToString();
                    HzCombo.Text   = Rd1.GetValue(20).ToString();



                    TextBox9.Text = DateTime.Now.ToString("dd/MM/yyyy");
                    string ST = (Global.sysIn[10]);
                    long   Mn = (Convert.ToInt32(ST.Substring(0, 1)) * 60) + Convert.ToInt32(ST.Substring(2));
                    long   Tm;
                    Tm = (Convert.ToInt16(DateTime.Now.Hour.ToString()) * 60) + Convert.ToInt16(DateTime.Now.Minute.ToString());

                    if ((Tm > Mn) && (Tm <= (Mn + 480)))
                    {
                        TextBox10.Text = "A";
                    }
                    else if ((Tm > (Mn + 480)) && (Tm <= (Mn + 960)))
                    {
                        TextBox10.Text = "B";
                    }
                    else
                    {
                        TextBox10.Text = "C";
                    }
                }
                Rd1.Close();
                Global.con.Close();
                Fill_Combo();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  EngDialog_Load....", "Alart");
            }
        }
Esempio n. 24
0
        private void LoadParameter_Arr()
        {
            int I = 0;

            InV[0]  = ipVal1;
            InV[1]  = ipVal2;
            InV[2]  = ipVal3;
            InV[3]  = ipVal4;
            InV[4]  = ipVal5;
            InV[5]  = ipVal6;
            InV[6]  = ipVal7;
            InV[7]  = ipVal8;
            InV[8]  = ipVal9;
            InV[9]  = ipVal10;
            InV[10] = ipVal11;
            InV[11] = ipVal12;
            InV[12] = ipVal13;
            InV[13] = ipVal14;
            InV[14] = ipVal15;
            InV[15] = ipVal16;
            InV[16] = ipVal17;
            InV[17] = ipVal18;
            InV[18] = ipVal19;
            InV[19] = ipVal20;
            InV[20] = ipVal21;
            InV[21] = ipVal22;
            InV[22] = ipVal23;
            InV[23] = ipVal24;
            InV[24] = ipVal25;
            InV[25] = ipVal26;
            InV[26] = ipVal27;
            InV[27] = ipVal28;
            InV[28] = ipVal29;
            InV[29] = ipVal30;
            InV[30] = ipVal31;
            InV[31] = ipVal32;
            InV[32] = ipVal33;
            InV[33] = ipVal34;
            InV[34] = ipVal35;
            InV[35] = ipVal36;
            InV[36] = ipVal37;
            InV[37] = ipVal38;
            InV[38] = ipVal39;
            InV[39] = ipVal40;
            InV[40] = ipVal41;
            InV[41] = ipVal42;
            InV[42] = ipVal43;
            InV[43] = ipVal44;
            InV[44] = ipVal45;
            InV[45] = ipVal46;
            InV[46] = ipVal47;
            InV[47] = ipVal48;
            //InV[48] = ipVal36;
            //InV[49] = ipVal37;
            //InV[50] = ipVal38;
            //InV[51] = ipVal39;
            //InV[52] = ipVal40;
            //InV[53] = ipVal41;
            //InV[54] = ipVal42;
            //InV[55] = ipVal56;
            //InV[56] = ipVal57;
            //InV[57] = ipVal58;
            //InV[58] = ipVal59;
            //InV[59] = ipVal60;
            //InV[60] = ipVal61;
            //InV[61] = ipVal62;
            //InV[62] = ipVal63;
            //InV[63] = ipVal64;
            //InV[64] = ipVal65;
            //InV[65] = ipVal66;
            //InV[66] = ipVal67;
            //InV[67] = ipVal68;
            //InV[68] = ipVal69;
            //InV[69] = ipVal70;


            try
            {
                Global.Rd_Confg();
                Global.Open_Connection("gen_db", "con");
                MySqlCommand    cmd = new MySqlCommand("SELECT * FROM tb_scrn ORDER BY N", Global.con);
                MySqlDataReader Rd  = cmd.ExecuteReader();

                int x = 0;
                while (Rd.Read())
                {
                    if (x > 47)
                    {
                        break;
                    }
                    Global.scrn_Par[x] = Rd.GetValue(1).ToString();
                    x += 1;
                }
                Rd.Close();
                Global.con.Close();



                for (I = 0; I <= 47; I++)
                {
                    InV[I].Invoke(new Action(() => InV[I].P_Name = Global.PSName[int.Parse(Global.scrn_Par[I])].ToString()));
                    if (InV[I].P_Name.Substring(0, 1) == "P")
                    {
                        InV[I].Invoke(new Action(() => InV[I].BackColor = Color.Silver));
                    }
                    else if ((InV[I].P_Name.Substring(0, 1) == "T") || (InV[I].P_Name.Substring(0, 1) == "R"))
                    {
                        InV[I].Invoke(new Action(() => InV[I].BackColor = Color.DarkGray));
                    }
                    else
                    {
                        InV[I].Invoke(new Action(() => InV[I].BackColor = Color.Gainsboro));
                    }
                    //InV[I].Invoke(new Action(() => InV[I].BackColor = Color.Gainsboro));
                    InV[I].Invoke(new Action(() => InV[I].P_Color = Color.Navy));                     //.MediumBlue));
                    InV[I].Invoke(new Action(() => InV[I].U_Color = Color.Black));
                    InV[I].Invoke(new Action(() => InV[I].colFont = new System.Drawing.Font("Book Antiqua", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))));
                    InV[I].Invoke(new Action(() => InV[I].P_Font  = new System.Drawing.Font("Book Antiqua", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))));
                    InV[I].Invoke(new Action(() => InV[I].U_Font  = new System.Drawing.Font("Book Antiqua", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))));

                    if (InV[I].P_Name == "Not_Prog")
                    {
                        InV[I].P_Name = "";
                        InV[I].P_Unit = "";
                        InV[I].Invoke(new Action(() => InV[I].colFillColor = Color.LightGray));
                        InV[I].Invoke(new Action(() => InV[I].colForeColor = Color.LightGray));
                    }

                    else
                    {
                        InV[I].Invoke(new Action(() => InV[I].P_Name = Global.PSName[int.Parse(Global.scrn_Par[I])].ToString()));
                        InV[I].Invoke(new Action(() => InV[I].P_Unit = Global.PUnit[int.Parse(Global.scrn_Par[I])].ToString()));

                        InV[I].colFillColor = Color.ForestGreen;
                        InV[I].colForeColor = Color.White;
                    }
                }
                Init_Gantner();
                Init_TCP_Port();
                //t1 = Task.Run(() => { Global.Capture_fData(); });
                //t1 = Task.Run(() => { clsADAM6000.Read_AdamValues6018(); });
                //t2 = Task.Run(() => { clsADAM6000.Read_AdamValues6017(); });


                GantnerThread = new Thread(new ThreadStart(Gantner_Thread));
                GantnerThread.Start();

                //ADAM6018Thread = new Thread(new ThreadStart(ADAM6018_Thread));
                //ADAM6018Thread.Start();

                //ADAM6017Thread = new Thread(new ThreadStart(ADAM6017_Thread));
                //ADAM6017Thread.Start();



                Global.Create_OnLog("Load_Arr()", "Normal ");

                LoadDgView();
                tmrRead.Start();

                timer1.Start();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("Load_Arr()", "Alart");
                //MessageBox.Show("Error in frmMain: Load_Arr():  " + ex.Message);
            }
        }
Esempio n. 25
0
        private void btnASave_Click(object sender, EventArgs e)
        {
            try
            {
                Global.JobOrdNo = "***";
                Process[] prs = Process.GetProcesses();
                foreach (Process pr in prs)
                {
                    //if (pr.ProcessName == "ModbusPollCS") pr.Kill();
                    if (pr.ProcessName == "Editors")
                    {
                        pr.Kill();
                    }
                    if (pr.ProcessName == "Dataappliacation")
                    {
                        pr.Kill();
                    }
                }

                if (TextBox1.Text == String.Empty) // "")
                {
                    MessageBox.Show("Please Type Engine No. ...... ");
                    TextBox1.Focus();
                }
                else if (PrjCombo.Text == String.Empty)
                {
                    MessageBox.Show("Please Select Project. ...... ");
                    PrjCombo.Focus();
                }
                else if ((textBox7.Text == String.Empty) || (textBox8.Text == String.Empty) || (textBox13.Text == String.Empty))
                {
                    Erp1.SetError(groupBox2, "Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                  " 2. Engine FlyUp RPM " + "\n" +
                                  " 3. Engine Max Power @ RPM " + "\n" +
                                  " 4. Engine Max Torque@ RPM ");

                    MessageBox.Show("Some Input Value Is missing." + "\n\n" + " 1. Engine Idle RPM " + "\n" +
                                    " 2. Engine FlyUp RPM " + "\n" +
                                    " 3. Engine Max Power @ RPM " + "\n" +
                                    " 4. Engine Max Torque@ RPM ");
                    groupBox2.Focus();
                }
                else
                {
                    Global.EngNo      = TextBox1.Text;
                    Global.EngineNo   = TextBox1.Text;
                    Global.FipNo      = TextBox2.Text;
                    Global.EngMd      = TextBox3.Text;
                    Global.OperatorNm = TextBox4.Text;
                    Global.EnginerNm  = TextBox5.Text;
                    Global.TestRef    = TextBox6.Text;
                    Global.PrjNm      = PrjCombo.Text;
                    Global.T_Date     = TextBox9.Text;
                    Global.Shift      = TextBox10.Text;
                    Global.HzLog      = HzCombo.Text;

                    if (checkBox1.CheckState == CheckState.Checked)
                    {
                        Global.flg_smk = true;
                    }
                    else
                    {
                        Global.flg_smk = false;
                    }
                    if (checkBox2.CheckState == CheckState.Checked)
                    {
                        Global.flg_Radiator = true;
                    }
                    else
                    {
                        Global.flg_Radiator = false;
                    }
                    if (checkBox3.CheckState == CheckState.Checked)
                    {
                        Global.flg_Fan = true;
                    }
                    else
                    {
                        Global.flg_Fan = false;
                    }
                    if (checkBox4.CheckState == CheckState.Checked)
                    {
                        Global.flg_AirCln = true;
                    }
                    else
                    {
                        Global.flg_AirCln = false;
                    }
                    if (checkBox5.CheckState == CheckState.Checked)
                    {
                        Global.flg_Silincer = true;
                    }
                    else
                    {
                        Global.flg_Silincer = false;
                    }
                    if (rd_New.Checked == true)
                    {
                        Global.flg_NewFile = true;
                    }
                    else
                    {
                        Global.flg_NewFile = false;
                    }
                    if (rd_Last.Checked == true)
                    {
                        Global.flg_OldFile = true;
                    }
                    else
                    {
                        Global.flg_OldFile = false;
                    }
                    if (rd_smooth.Checked == true)
                    {
                        Global.flg_Smt_Changeover = true;
                    }
                    else
                    {
                        Global.flg_Smt_Changeover = false;
                    }
                    if (rd_standard.Checked == true)
                    {
                        Global.flg_Std_Changeover = true;
                    }
                    else
                    {
                        Global.flg_Std_Changeover = false;
                    }


                    String X = textBox7.Text;
                    Global.S_Rpm = int.Parse(X);
                    Global.I_Rpm = (int.Parse(X) + int.Parse(X) / 10);

                    String Y = textBox8.Text;
                    Global.F_Rpm = (int.Parse(Y) + int.Parse(Y) / 10);

                    String Z = textBox13.Text;
                    Global.Max_Trq = (Double.Parse(Z) + (Double.Parse(Z) / 10));


                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd = new MySqlCommand("UPDATE TbSys SET " +
                                                        " CH1 = '" + Global.EngNo + "'," +
                                                        " CH2 = '" + Global.FipNo + "'," +
                                                        " CH3 = '" + Global.EngMd + "'," +
                                                        " CH4 = '" + Global.OperatorNm + "'," +
                                                        " CH5 = '" + Global.TKnNo + "'," +
                                                        " CH6 = '" + Global.TestRef + "'," +
                                                        " CH7 = '" + Global.PrjNm + "'," +
                                                        " CH8 = '" + Global.flg_smk + "'," +
                                                        " CH9 = '" + Global.flg_Radiator + "'," +
                                                        " CH10 = '" + Global.flg_Fan + "'," +
                                                        " CH11 = '" + Global.flg_AirCln + "'," +
                                                        " CH12 = '" + Global.flg_Silincer + "'," +
                                                        " CH13 = '" + Global.flg_NewFile + "'," +
                                                        " CH14 = '" + Global.flg_OldFile + "'," +
                                                        " CH15 = '" + Global.flg_Smt_Changeover + "'," +
                                                        " CH16 = '" + Global.flg_Std_Changeover + "'," +
                                                        " CH17 = '" + X + "'," +
                                                        " CH18 = '" + Y + "'," +
                                                        " CH19 = '" + Z + "'," +
                                                        " CH20 = '" + Global.HzLog + "'" +
                                                        " WHERE FileName = 'EngNo'", Global.con);
                    cmd.ExecuteNonQuery();
                    Global.con.Close();
                    Global.Rd_System();
                    Global.PrjNm = PrjCombo.Text;
                    Check_File_Validation();
                    Global.flg_Auto   = true;
                    Global.flg_Manual = false;
                    Global.Read_Eng();
                    clsLimit.Read_Limfl();
                    Global.Flg_Ready          = true;
                    Global.main.BtnSA.Enabled = false;
                    Global.main.Btn21.Enabled = true;
                    Global.flg_Semi_Auto      = false;

                    switch (HzCombo.Text)
                    {
                    case "100 Hz":
                        Global.Dly_cnt = 10000;
                        break;

                    case "080 Hz":
                        Global.Dly_cnt = 12500;
                        break;

                    case "060 Hz":
                        Global.Dly_cnt = 16667;
                        break;

                    case "050 Hz":
                        Global.Dly_cnt = 20000;
                        break;

                    case "040 Hz":
                        Global.Dly_cnt = 25000;
                        break;

                    case "020 Hz":
                        Global.Dly_cnt = 50000;
                        break;

                    case "010 Hz":
                        Global.Dly_cnt = 100000;
                        break;

                    case "001 Hz":
                        Global.Dly_cnt = 1000000;
                        break;

                    default:
                        Global.Dly_cnt = 1000000;
                        break;
                    }
                    //Global.flg_RunStart = true;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " : Engine Dialog  Save Auto File....", "Alart");
            }
        }
Esempio n. 26
0
        private void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                int X = 0;
                if (ComboBox1.Text == "")
                {
                    Ep.SetError(ComboBox1, "please select/Enter fileName.....");
                    ComboBox1.Focus();
                    return;
                }
                if (ComboBox2.Text == "")
                {
                    Ep.SetError(ComboBox2, "please select Engine File.....");
                    ComboBox2.Focus();
                    return;
                }
                if (ComboBox3.Text == "")
                {
                    Ep.SetError(ComboBox3, "please select Sequence File.....");
                    ComboBox3.Focus();
                    return;
                }

                if (ComboBox4.Text == "")
                {
                    Ep.SetError(ComboBox4, "please select Limit File.....");
                    ComboBox4.Focus();
                    return;
                }

                if (ComboBox5.Text == "")
                {
                    Ep.SetError(ComboBox5, "please select Correction Standard.....");
                    ComboBox5.Focus();
                    return;
                }
                if (ComboBox6.Text == "")
                {
                    Ep.SetError(ComboBox6, "please Test Type Standard.....");
                    ComboBox6.Focus();
                    return;
                }

                for (X = 1; X < (DGPrj.RowCount); X++)
                {
                    if (DGPrj[1, X].Value == null)
                    {
                        Ep.SetError(DGPrj, "please Enter the Value .....");
                        DGPrj.Focus();
                        return;
                    }
                    else
                    {
                        Ep.Clear();
                    }
                }
                Format_Cells();
                X       = 0;
                flg_New = true;
                while (X < PrjGV.RowCount - 1)
                {
                    if (ComboBox1.Text == PrjGV[0, X].Value.ToString())
                    {
                        flg_New = false;
                        Rw      = PrjGV.CurrentRow.Index;
                        break;
                    }
                    else
                    {
                        flg_New = true;
                    }
                    X++;
                }

                Rw = PrjGV.CurrentRow.Index;

                if (flg_New == false)
                {
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "UPDATE tblProject SET " +
                                      " EngFile  = '" + ComboBox2.Text + "'," +
                                      " ProgFile  = '" + ComboBox3.Text + "'," +
                                      " LimitFile  = '" + ComboBox4.Text + "'," +
                                      " CorrFile  = '" + ComboBox5.Text + "'," +
                                      " Test_Type  = '" + ComboBox6.Text + "'," +
                                      " R_power  = '" + DGPrj[1, 0].Value.ToString() + "'," +
                                      " R_rpm  = '" + DGPrj[1, 1].Value.ToString() + "'," +
                                      " MT_Torque  = '" + DGPrj[1, 2].Value.ToString() + "'," +
                                      " MT_rpm  = '" + DGPrj[1, 3].Value.ToString() + "'," +
                                      " Fly_rpm  = '" + DGPrj[1, 4].Value.ToString() + "'," +
                                      " Idle_rpm  = '" + DGPrj[1, 5].Value.ToString() + "'," +
                                      " E_Strpm  = '" + DGPrj[1, 6].Value.ToString() + "'," +
                                      " T_Crank  = '" + DGPrj[1, 7].Value.ToString() + "'," +
                                      " C_Time  = '" + DGPrj[1, 8].Value.ToString() + "'," +
                                      " PM_Log  = '" + DGPrj[1, 9].Value.ToString() + "'" +
                                      " WHERE ProjectFile = '" + ComboBox1.Text + "'";
                    cmd.Connection = Global.con;
                    cmd.ExecuteNonQuery();
                    Load_DataGrid();
                    MessageBox.Show("File Updated .....");
                }
                else if (flg_New == true)
                {
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO tblProject VALUES ('" +
                                      ComboBox1.Text + "','" +
                                      ComboBox2.Text + "','" +
                                      ComboBox3.Text + "','" +
                                      ComboBox4.Text + "','" +
                                      ComboBox5.Text + "','" +
                                      ComboBox6.Text + "','" +
                                      DGPrj[1, 0].Value + "','" +
                                      DGPrj[1, 1].Value + "','" +
                                      DGPrj[1, 2].Value + "','" +
                                      DGPrj[1, 3].Value + "','" +
                                      DGPrj[1, 4].Value + "','" +
                                      DGPrj[1, 5].Value + "','" +
                                      DGPrj[1, 6].Value + "','" +
                                      DGPrj[1, 7].Value + "','" +
                                      DGPrj[1, 8].Value + "','" +
                                      DGPrj[1, 9].Value + "')";
                    cmd.Connection = Global.con;
                    cmd.ExecuteNonQuery();
                    Load_DataGrid();
                    MessageBox.Show("File Saved .....");
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  File Save....", "Alart");
                //MessageBox.Show("Error Code:- 11004" + ex.Message );
            }
        }
Esempio n. 27
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Global.flg_fastlog == false)
            {
                //FASTLOGThread = new Thread(new ThreadStart(fLog_Thread));
                //FASTLOGThread.Abort();

                Global.Create_OnLog("Fast Logging Stopped.....", "Normal");
                frqVal.Text      = "Fast log Stopped.............." + Global.HzLog;
                frqVal.BackColor = Color.Gainsboro;
                frqVal.ForeColor = Color.Blue;
            }

            //if (ADAM6018Thread.ThreadState == ThreadState.Aborted)
            //{
            //    ADAM6018Thread = new Thread(new ThreadStart(ADAM6018_Thread));
            //    ADAM6018Thread.Start();
            //}
            //if (ADAM6017Thread.ThreadState == ThreadState.Aborted)
            //{
            //    ADAM6017Thread = new Thread(new ThreadStart(ADAM6017_Thread));
            //    ADAM6017Thread.Start();
            //}
            if (GantnerThread.ThreadState == ThreadState.Aborted)
            {
                GantnerThread = new Thread(new ThreadStart(Gantner_Thread));
                GantnerThread.Start();
            }
            if (tmrRead.Enabled == false)
            {
                tmrRead.Interval = 100;
                tmrRead.Start();
            }



            DisplayLimits();
            flg_Showlim = false;
            int i = 0;

            for (i = 0; i <= 59; i++)
            {
                if (Global.BufLim[i] == "A")
                {
                    flg_Showlim = true;
                    break;
                }
            }
            if ((flg_Showlim == true) && (Global.varRPM >= 650))  //(Global.flg_EngStart = true))
            {
                mnuAlarm.BackColor = Color.Red;
                mnuAlarm.ForeColor = Color.Yellow;
                mnuAlarm.Text      = "Check Alarm : " + Global.PSName[i];
            }
            else
            {
                mnuAlarm.BackColor = Color.LightGray;
                mnuAlarm.ForeColor = Color.Red;
                mnuAlarm.Text      = "Alarm Status...";
            }
            if (Global.flg_UpdateViewData == true)
            {
                Update_ViewData();
            }
        }
Esempio n. 28
0
        private void Format_Cells()
        {
            try
            {
                Double l = new double();
                int    M = DGPrj.CurrentRow.Index;
                for (M = 0; M <= 9; M++)
                {
                    switch (M)
                    {
                    case 0:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        DGPrj[1, M].Value = l.ToString("000.0");
                        break;

                    case 2:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        DGPrj[1, M].Value = l.ToString("000.0");
                        break;

                    case 1:
                    case 3:
                    case 4:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        DGPrj[1, M].Value = l.ToString("0000");
                        break;

                    case 5:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "600";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        if ((l >= 1210) || (l <= 540))
                        {
                            MessageBox.Show("Error: Idle rpm of Engine should be bet' 800 to 1200....");
                            DGPrj[1, M].Value = "550";
                        }
                        break;

                    case 6:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "600";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        if ((l >= 1210) || (l <= 540))
                        {
                            MessageBox.Show("Error: Min Rpm To start the Engine should be bet' 550 to 1200....");
                            DGPrj[1, M].Value = "550";
                        }
                        break;

                    case 7:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);

                        if ((l > 2))
                        {
                            DGPrj[1, M].Value = 2;
                        }

                        break;

                    case 8:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        DGPrj[1, M].Value = l.ToString("0000.00");
                        break;

                    case 9:
                        if (DGPrj[1, M].Value.ToString() == "")
                        {
                            DGPrj[1, M].Value = "0";
                        }
                        l = Convert.ToDouble(DGPrj[1, M].Value);
                        if (l > 60)
                        {
                            DGPrj[1, M].Value = "60";
                        }
                        if (l < 2)
                        {
                            DGPrj[1, M].Value = "02";
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Create_OnLog(ex.Message + " :  Format Cell....", "Alart");
                // MessageBox.Show("Error Code:- 11005", ex.Message);
            }
        }
Esempio n. 29
0
        private void Add_RangeList(String M_Type, int M_No)
        {
            try
            {
                String str = "";
                switch (M_Type)
                {
                case "NONE":
                    str = "NONE";
                    break;

                case "4018*8":
                    str = "K-Type,J-Type";
                    break;

                case "4017*8":
                    str = "-10~+10V,4~20mA";
                    break;

                case "4015*6":
                    str = "-50~150°C,0~200°C,0~400°C";
                    break;
                }

                string input   = str;
                string pattern = @"(,)";
                Regex  regex   = new Regex(pattern);
                switch (M_No)
                {
                case 1:
                    ADAMRange1.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ADAMRange1.Items.Add(result);
                        }
                    }
                    ADAMRange1.SelectedIndex = 0;
                    break;

                case 2:
                    ADAMRange2.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ADAMRange2.Items.Add(result);
                        }
                    }
                    ADAMRange2.SelectedIndex = 0;
                    break;

                case 3:
                    ADAMRange3.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ADAMRange3.Items.Add(result);
                        }
                    }
                    ADAMRange3.SelectedIndex = 0;
                    break;

                case 4:
                    ADAMRange4.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ADAMRange4.Items.Add(result);
                        }
                    }
                    ADAMRange4.SelectedIndex = 0;
                    break;

                case 5:
                    ADAMRange5.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ADAMRange5.Items.Add(result);
                        }
                    }
                    ADAMRange5.SelectedIndex = 0;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 14002", ex.Message);
                Global.Create_OnLog(ex.Message, "Alart");
            }
        }
Esempio n. 30
0
        private void btnSavePort_Click(object sender, EventArgs e)
        {
            try
            {
                int x = dgPConf.CurrentRow.Index;

                dgPConf[1, x].Value = cmbDeviceName.Text;
                dgPConf[2, x].Value = cmbPort.Text;
                dgPConf[3, x].Value = cmbBaudRate.Text;
                dgPConf[4, x].Value = cmbParity.Text;
                dgPConf[5, x].Value = cmbStopBit.Text;
                dgPConf[6, x].Value = txtInstID.Text;
                dgPConf[7, x].Value = txtStartAdd.Text;
                dgPConf[8, x].Value = txtNReads.Text;

                if (chkSelect.Text == "Selected")
                {
                    dgPConf[9, x].Value = "True";
                }
                else if (chkSelect.Text == "Not Selected")
                {
                    dgPConf[9, x].Value = "False";
                }


                //string S = dgPConf[9, x].Value;
                Boolean st = Convert.ToBoolean(dgPConf[9, Rw].Value);
                foreach (DataGridViewRow row in dgPConf.Rows)
                {
                    if (st == true)
                    {
                        chkSelect.Text       = "Selected";
                        chkSelect.CheckState = CheckState.Checked;
                        dgPConf.Rows[Rw].DefaultCellStyle.BackColor = Color.Gainsboro;
                    }
                    else if (st == false)
                    {
                        chkSelect.Text       = "Not Selected";
                        chkSelect.CheckState = CheckState.Unchecked;
                        dgPConf.Rows[Rw].DefaultCellStyle.BackColor = Color.WhiteSmoke;
                    }
                }



                //----------------Save
                int y = x + 1;
                Global.Open_Connection("gen_db", "con");
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "UPDATE tb_comports SET " +
                                  " ComPorts  = '" + cmbPort.Text + "'," +
                                  " BaudRates  = '" + cmbBaudRate.Text + "'," +
                                  " Parity  = '" + cmbParity.Text + "'," +
                                  " StopBit  = '" + cmbStopBit.Text + "'," +
                                  " InstId  = '" + txtInstID.Text + "'," +
                                  " StartAdd  = '" + txtStartAdd.Text + "'," +
                                  " NReads  = '" + txtNReads.Text + "'," +
                                  " State  = '" + st + "'" +
                                  " WHERE DeviceNames =  '" + cmbDeviceName.Text + "'";
                cmd.Connection = Global.con;
                cmd.ExecuteNonQuery();

                if (Rw == 1)    // Save ADAM 1 CONFIGURATION
                {
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd1 = new MySqlCommand();
                    cmd1.CommandText = "UPDATE tbsys SET " +
                                       " CH1  = '" + txtM1.Text + "'," + " CH2  = '" + ADAMType1.Text + "'," + " CH3  = '" + ADAMRange1.Text + "'," +
                                       " CH4  = '" + txtM2.Text + "'," + " CH5  = '" + ADAMType2.Text + "'," + " CH6  = '" + ADAMRange2.Text + "'," +
                                       " CH7  = '" + txtM3.Text + "'," + " CH8  = '" + ADAMType3.Text + "'," + " CH9  = '" + ADAMRange3.Text + "'," +
                                       " CH10  = '" + txtM4.Text + "'," + " CH11  = '" + ADAMType4.Text + "'," + " CH12  = '" + ADAMRange4.Text + "'," +
                                       " CH13  = '" + txtM5.Text + "'," + " CH14  = '" + ADAMType5.Text + "'," + " CH15  = '" + ADAMRange5.Text + "'" +
                                       " WHERE FileName = 'ADAMGroup01'";
                    cmd1.Connection = Global.con;
                    cmd1.ExecuteNonQuery();
                }
                else if (Rw == 2)    // Save ADAM 2 CONFIGURATION
                {
                    Global.Open_Connection("gen_db", "con");
                    MySqlCommand cmd2 = new MySqlCommand();
                    cmd2.CommandText = "UPDATE tbsys SET " +
                                       " CH1  = '" + txtM1.Text + "'," + " CH2  = '" + ADAMType1.Text + "'," + " CH3  = '" + ADAMRange1.Text + "'," +
                                       " CH4  = '" + txtM2.Text + "'," + " CH5  = '" + ADAMType2.Text + "'," + " CH6  = '" + ADAMRange2.Text + "'," +
                                       " CH7  = '" + txtM3.Text + "'," + " CH8  = '" + ADAMType3.Text + "'," + " CH9  = '" + ADAMRange3.Text + "'," +
                                       " CH10  = '" + txtM4.Text + "'," + " CH11  = '" + ADAMType4.Text + "'," + " CH12  = '" + ADAMRange4.Text + "'," +
                                       " CH13  = '" + txtM5.Text + "'," + " CH14  = '" + ADAMType5.Text + "'," + " CH15  = '" + ADAMRange5.Text + "'" +
                                       " WHERE FileName = 'ADAMGroup02'";
                    cmd2.Connection = Global.con;
                    cmd2.ExecuteNonQuery();
                }
                Global.Create_OnLog("System Port Configuration File Is Saved Properly ", "Normal");
                loadInCell();
            }
            catch (Exception ex)
            {
                Global.Create_OnLog("System Port Configuration File Is not Saved Properly ", "Alart");
                MessageBox.Show(ex.Message);
            }
        }