コード例 #1
0
ファイル: EngOK.cs プロジェクト: vkk12345678/sonalika
        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");
            MySqlCommand cmd2 = new MySqlCommand("Insert into EngDetails values('" + Str + EngData[19] + "' )", Global.conData);

            cmd2.ExecuteNonQuery();
            Global.conData.Close();
        }
コード例 #2
0
ファイル: EngOK.cs プロジェクト: vkk12345678/sonalika
        private void Create_Endurance()
        {
            Excel.Application xlApp;
            Excel.Workbook    xlWorkBook;
            Excel.Worksheet   xlWorkSheet;
            Process[]         prs = Process.GetProcesses();
            foreach (Process pr in prs)
            {
                if (pr.ProcessName == "EXCEL")
                {
                    pr.Kill();
                }
            }
            try
            {
                String[] Enduno = new String[30];
                String[] Enduhead = new String[30];
                String[] Enduunit = new String[30];
                string   cell1, cell2;
                object   misValue = System.Reflection.Missing.Value;
                int      i, k;
                int      j, rx;
                xlApp      = new Excel.Application();
                xlWorkBook = xlApp.Workbooks.Open(Global.PATH + "Endurance.xlsx", 0, misValue, 4, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item("Endurance");
                xlWorkSheet.get_Range("B12", "U2000").Clear();
                //-------------------------
                xlWorkSheet.Cells[2, 19] = DateTime.Now.ToString("dd/MM/yyyy");
                xlWorkSheet.Cells[3, 19] = Global.T_CellNo;
                //-----------------------
                xlWorkSheet.Cells[4, 4] = Global.EngType;
                xlWorkSheet.Cells[5, 4] = Global.EngNo;
                xlWorkSheet.Cells[6, 4] = Global.Bor;
                xlWorkSheet.Cells[7, 4] = Global.Strk;
                xlWorkSheet.Cells[8, 4] = Global.NCyl;
                xlWorkSheet.Cells[9, 4] = Global.Svol;
                //------------------------
                xlWorkSheet.Cells[5, 8] = Global.EnginerNm;
                xlWorkSheet.Cells[6, 8] = Global.OperatorNm;
                xlWorkSheet.Cells[7, 8] = Global.TestRef;
                xlWorkSheet.Cells[8, 8] = Global.SGrv;

                //--------------------------
                //------------------------
                if (Global.flg_Radiator == true)
                {
                    xlWorkSheet.Cells[5, 12] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[5, 12] = "NO";
                }
                if (Global.flg_Fan == true)
                {
                    xlWorkSheet.Cells[6, 12] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[6, 12] = "NO";
                }
                if (Global.flg_AirCln == true)
                {
                    xlWorkSheet.Cells[7, 12] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[7, 12] = "NO";
                }
                if (Global.flg_Silincer == true)
                {
                    xlWorkSheet.Cells[8, 12] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[8, 12] = "NO";
                }
                ////--------------------------
                //----------------------------------
                xlWorkSheet.Cells[5, 16] = Global.CStrtTm;
                xlWorkSheet.Cells[6, 16] = Global.CStopTm;

                xlWorkSheet.Cells[8, 16] = Global.cumhours;


                Global.Open_Connection("General", "con");
                MySqlDataAdapter adp2 = new MySqlDataAdapter("Select * from Tb_Endu ", Global.con);
                DataSet          ds2  = new DataSet();
                adp2.Fill(ds2);
                prgT.Visible = true;
                prgT.Value   = (int)1;
                prgT.Caption = "Wait Data For Transfer .......";

                k = 20;
                for (i = 0; i <= k - 1; i++)
                {
                    Enduno[i]   = ds2.Tables[0].Rows[i].ItemArray[1].ToString();
                    Enduhead[i] = ds2.Tables[0].Rows[i].ItemArray[2].ToString();
                    xlWorkSheet.Cells[10, i + 2] = ds2.Tables[0].Rows[i].ItemArray[2].ToString();
                    Enduunit[i] = ds2.Tables[0].Rows[i].ItemArray[3].ToString();
                    xlWorkSheet.Cells[11, i + 2] = ds2.Tables[0].Rows[i].ItemArray[3].ToString();
                }
                k = i;
                adp2.Dispose();
                ds2.Dispose();
                Global.con.Close();
                Global.Open_Connection("Data", "conData");
                MySqlDataAdapter adp1 = new MySqlDataAdapter("Select * from " + Global.Eng_FileNm + " Order by Pn", Global.conData);
                DataSet          ds1  = new DataSet();
                adp1.Fill(ds1);
                rx = ds1.Tables[0].Rows.Count;

                prgT.Maximum = rx + 1;
                prgT.Value   = (int)1;
                for (int m = 0; m <= rx - 1; m++)
                {
                    prgT.Value = (int)(m + 1);
                    for (int n = 0; n <= k - 1; n++)
                    {
                        xlWorkSheet.Cells[m + 12, n + 2] = ds1.Tables[0].Rows[m].ItemArray[int.Parse(Enduno[n])].ToString();
                    }
                    prgT.Value = m;
                }
                Global.conData.Close();

                prgT.Caption = "Data Transfer Over .......";
                //cell3 = "B8";
                //cell4 = "AB10";
                cell1 = "B12";
                cell2 = "U" + (rx + 12);
                xlWorkSheet.get_Range(cell1, cell2).Font.Size          = 11; //style.FontStyle.Color = Color.White;
                xlWorkSheet.get_Range(cell1, cell2).Font.ColorIndex    = 5;
                xlWorkSheet.get_Range(cell1, cell2).Font.Name          = "Book Antiqua";
                xlWorkSheet.get_Range(cell1, cell2).Borders.ColorIndex = 15;
                xlWorkSheet.get_Range(cell1, cell2).Borders.LineStyle  = Excel.XlBorderWeight.xlHairline;
                xlWorkSheet.get_Range(cell1, cell2).BorderAround(Excel.XlLineStyle.xlDouble, Excel.XlBorderWeight.xlThin, Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic);
                //xlWorkSheet.get_Range(cell3, cell4).Borders.LineStyle = Excel.XlBorderWeight.xlHairline;
                //xlWorkSheet.get_Range(cell3, cell4).Font.Size = 11;
                //xlWorkSheet.get_Range(cell3, cell4).Font.Bold = false;
                //xlWorkSheet.get_Range(cell3, cell4).Borders.ColorIndex = 15;
                //xlWorkSheet.get_Range(cell3, cell4).Font.ColorIndex = 9;
                ////xlWorkSheet.get_Range("B9", "W9").Font.ColorIndex = 5;
                //xlWorkSheet.get_Range("B10", "W10").Font.ColorIndex = 1;
                //xlWorkSheet.get_Range(cell3, cell4).Font.Name = "Book Antiqua";
                //xlWorkSheet.get_Range(cell3, cell4).BorderAround(Excel.XlLineStyle.xlDouble, Excel.XlBorderWeight.xlThin, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);


                xlWorkBook.SaveAs((object)(Global.DataPath + "Endu_" + Global.Eng_FileNm.Substring(4)), misValue, misValue, misValue, false, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, misValue, misValue, misValue, misValue, misValue);

                xlApp.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 17007", ex.Message);
            }
        }
コード例 #3
0
ファイル: EngOK.cs プロジェクト: vkk12345678/sonalika
        private void Create_Performance()
        {
            Excel.Application xlApp;
            Excel.Workbook    xlWorkBook;
            Excel.Worksheet   xlWorkSheet;

            Process[] prs = Process.GetProcesses();
            foreach (Process pr in prs)
            {
                if (pr.ProcessName == "EXCEL")
                {
                    pr.Kill();
                }
            }
            try
            {
                String[] Perfno   = new String[30];
                String[] Perfhead = new String[30];
                String[] Perfunit = new String[30];

                object misValue = System.Reflection.Missing.Value;
                int    i, k;
                int    j, rx;
                xlApp = new Excel.Application();
                //xlApp = new Excel.ApplicationClass();
                xlWorkBook = xlApp.Workbooks.Open(Global.PATH + "Performance.xlsx", 0, misValue, 4, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

                xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item("Performance");
                xlWorkSheet.get_Range("B12", "X27").ClearContents(); // .Clear();
                xlWorkSheet.get_Range("B31", "M48").ClearContents();
                //-------------------------
                xlWorkSheet.Cells[3, 20] = DateTime.Now.ToString("dd/MM/yyyy");
                xlWorkSheet.Cells[5, 20] = "ECB - 200";
                xlWorkSheet.Cells[6, 20] = Global.OperatorNm;
                xlWorkSheet.Cells[7, 20] = Global.EnginerNm;
                xlWorkSheet.Cells[8, 20] = Global.T_CellNo;

                //-----------------------
                xlWorkSheet.Cells[5, 5] = Global.EngType;
                xlWorkSheet.Cells[6, 5] = Global.TestRef;
                xlWorkSheet.Cells[7, 5] = Global.FipNo;
                xlWorkSheet.Cells[8, 5] = Global.EngNo;
                ////----------------------------
                xlWorkSheet.Cells[5, 11] = Global.NCyl;
                xlWorkSheet.Cells[6, 11] = Global.Bor;
                xlWorkSheet.Cells[7, 11] = Global.Strk;
                xlWorkSheet.Cells[8, 11] = Global.Svol;
                //------------------------
                if (Global.flg_Radiator == true)
                {
                    xlWorkSheet.Cells[5, 16] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[5, 16] = "NO";
                }
                if (Global.flg_Fan == true)
                {
                    xlWorkSheet.Cells[6, 16] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[6, 16] = "NO";
                }
                if (Global.flg_AirCln == true)
                {
                    xlWorkSheet.Cells[7, 16] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[7, 16] = "NO";
                }
                if (Global.flg_Silincer == true)
                {
                    xlWorkSheet.Cells[8, 16] = "YES";
                }
                else
                {
                    xlWorkSheet.Cells[8, 16] = "NO";
                }
                ////--------------------------

                Global.Open_Connection("General", "con");
                MySqlDataAdapter adp2 = new MySqlDataAdapter("Select * from Tb_Perf ", Global.con);
                DataSet          ds2  = new DataSet();
                adp2.Fill(ds2);
                prgT.Visible = true;
                prgT.Value   = (int)1;
                prgT.Caption = "Wait Data For Transfer .......";

                k = ds2.Tables[0].Rows.Count;
                for (i = 0; i <= k - 1; i++)
                {
                    Perfno[i]   = ds2.Tables[0].Rows[i].ItemArray[1].ToString();
                    Perfhead[i] = ds2.Tables[0].Rows[i].ItemArray[2].ToString();
                    Perfunit[i] = ds2.Tables[0].Rows[i].ItemArray[3].ToString();
                }
                adp2.Dispose();
                ds2.Dispose();
                Global.con.Close();
                for (i = 0; i <= k - 1; i++)
                {
                    xlWorkSheet.Cells[9, 2 + i]  = Perfhead[i];
                    xlWorkSheet.Cells[10, 2 + i] = Perfunit[i];
                }

                Global.Open_Connection("Data", "conData");
                MySqlDataAdapter adp1 = new  MySqlDataAdapter("Select * from " + Global.Eng_FileNm + " Order by Pn", Global.conData);
                DataSet          ds1  = new DataSet();
                adp1.Fill(ds1);
                rx = ds1.Tables[0].Rows.Count;
                if (rx >= 15)
                {
                    rx = 15;
                }

                prgT.Maximum = rx + 1;
                prgT.Value   = (int)1;
                for (int m = 0; m <= rx - 1; m++)
                {
                    prgT.Value = (int)(m + 1);
                    for (i = 0; i <= k - 1; i++)
                    {
                        xlWorkSheet.Cells[m + 11, i + 2] = ds1.Tables[0].Rows[m].ItemArray[int.Parse(Perfno[i])].ToString();
                    }
                    //****************************************
                    xlWorkSheet.Cells[m + 31, 2]  = ds1.Tables[0].Rows[m].ItemArray[0].ToString();
                    xlWorkSheet.Cells[m + 31, 3]  = ds1.Tables[0].Rows[m].ItemArray[1].ToString();
                    xlWorkSheet.Cells[m + 31, 4]  = ds1.Tables[0].Rows[m].ItemArray[107].ToString();
                    xlWorkSheet.Cells[m + 31, 5]  = ds1.Tables[0].Rows[m].ItemArray[108].ToString();
                    xlWorkSheet.Cells[m + 31, 6]  = ds1.Tables[0].Rows[m].ItemArray[109].ToString();
                    xlWorkSheet.Cells[m + 31, 7]  = ds1.Tables[0].Rows[m].ItemArray[105].ToString();
                    xlWorkSheet.Cells[m + 31, 8]  = ds1.Tables[0].Rows[m].ItemArray[111].ToString();
                    xlWorkSheet.Cells[m + 31, 9]  = ds1.Tables[0].Rows[m].ItemArray[112].ToString();
                    xlWorkSheet.Cells[m + 31, 10] = ds1.Tables[0].Rows[m].ItemArray[101].ToString();
                    xlWorkSheet.Cells[m + 31, 11] = ds1.Tables[0].Rows[m].ItemArray[102].ToString();
                    xlWorkSheet.Cells[m + 31, 12] = ds1.Tables[0].Rows[m].ItemArray[119].ToString();
                    xlWorkSheet.Cells[m + 31, 13] = ds1.Tables[0].Rows[m].ItemArray[113].ToString();
                    prgT.Value = m + 1;
                }
                xlWorkSheet.Cells[33, 17] = Global.CStrtTm;
                xlWorkSheet.Cells[35, 17] = Global.CStopTm;

                Global.conData.Close();
                prgT.Caption = "Data Transfer Over .......";
                xlWorkBook.SaveAs((object)(Global.DataPath + "Perf_" + Global.Eng_FileNm.Substring(4)), misValue, misValue, misValue, false, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, misValue, misValue, misValue, misValue, misValue);

                xlApp.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 17007", ex.Message);
            }
        }
コード例 #4
0
        private void Save_File()
        {
            try
            {
                //String str;
                String[] SaveArr = new String[75];

                SaveArr[0]  = TextBox1.Text;
                SaveArr[1]  = TextBox2.Text;
                SaveArr[2]  = ComboBox1.Text;
                SaveArr[3]  = TextBox3.Text;
                SaveArr[4]  = TextBox4.Text;
                SaveArr[5]  = TextBox5.Text;
                SaveArr[6]  = TextBox6.Text;
                SaveArr[7]  = TextBox7.Text;
                SaveArr[8]  = TextBox8.Text;
                SaveArr[9]  = TextBox9.Text;
                SaveArr[10] = ComboBox2.Text;
                SaveArr[11] = ComboBox3.Text;

                if (CheckBox1.Checked == true)
                {
                    SaveArr[12] = "TRUE";
                }
                else
                {
                    SaveArr[12] = "FALSE";
                }
                if (CheckBox2.Checked == true)
                {
                    SaveArr[13] = "TRUE";
                }
                else
                {
                    SaveArr[13] = "FALSE";
                }
                if (CheckBox3.Checked == true)
                {
                    SaveArr[14] = "TRUE";
                }
                else
                {
                    SaveArr[14] = "FALSE";
                }
                SaveArr[15] = ComboBox20.Text;
                SaveArr[16] = ComboBox4.Text;
                SaveArr[17] = ComboBox5.Text;
                SaveArr[18] = ComboBox6.Text;
                SaveArr[19] = ComboBox7.Text;

                SaveArr[20] = TextBox10.Text;
                SaveArr[21] = ComboBox8.Text;
                SaveArr[22] = ComboBox9.Text;

                SaveArr[23] = TextBox11.Text;
                SaveArr[24] = ComboBox10.Text;
                SaveArr[25] = ComboBox11.Text;

                SaveArr[26] = TextBox12.Text;
                SaveArr[27] = ComboBox12.Text;
                SaveArr[28] = ComboBox13.Text;

                SaveArr[29] = TextBox13.Text;
                SaveArr[30] = ComboBox14.Text;
                SaveArr[31] = ComboBox15.Text;

                SaveArr[32] = TextBox14.Text;
                SaveArr[33] = ComboBox16.Text;
                SaveArr[34] = ComboBox17.Text;
                SaveArr[35] = ComboBox18.Text;

                if (RadioButton1.Checked == true)
                {
                    SaveArr[36] = "TRUE";
                }
                else
                {
                    SaveArr[36] = "FALSE";
                }
                SaveArr[37] = "FALSE";
                if (RadioButton3.Checked == true)
                {
                    SaveArr[38] = "TRUE";
                }
                else
                {
                    SaveArr[38] = "FALSE";
                }
                SaveArr[39] = ComboBox19.Text;

                if (CheckBox4.Checked == true)
                {
                    SaveArr[40] = "TRUE";
                }
                else
                {
                    SaveArr[40] = "FALSE";
                }
                SaveArr[41] = TextBox15.Text;
                SaveArr[42] = TextBox16.Text;

                if (CheckBox5.Checked == true)
                {
                    SaveArr[43] = "TRUE";
                }
                else
                {
                    SaveArr[43] = "FALSE";
                }
                SaveArr[44] = TextBox17.Text;
                SaveArr[45] = TextBox18.Text;

                if (CheckBox6.Checked == true)
                {
                    SaveArr[46] = "TRUE";
                }
                else
                {
                    SaveArr[46] = "FALSE";
                }
                SaveArr[47] = TextBox19.Text;
                SaveArr[48] = TextBox20.Text;

                if (CheckBox7.Checked == true)
                {
                    SaveArr[49] = "TRUE";
                }
                else
                {
                    SaveArr[49] = "FALSE";
                }
                SaveArr[50] = TextBox21.Text;
                SaveArr[51] = TextBox22.Text;

                if (CheckBox8.Checked == true)
                {
                    SaveArr[52] = "TRUE";
                }
                else
                {
                    SaveArr[52] = "FALSE";
                }


                SaveArr[53] = TextBox23.Text;
                SaveArr[54] = TextBox24.Text;

                SaveArr[55] = ComboBox21.Text;
                SaveArr[56] = comboBox22.Text;
                SaveArr[57] = comboBox23.Text;
                SaveArr[58] = comboBox24.Text;
                SaveArr[59] = comboBox25.Text;
                if (checkBox10.Checked == true)
                {
                    SaveArr[60] = "TRUE";
                }
                else
                {
                    SaveArr[60] = "FALSE";
                }
                SaveArr[61] = comboBox26.Text;
                SaveArr[62] = comboBox27.Text;
                SaveArr[63] = "1";
                SaveArr[64] = "1";
                //if (CheckBox1.Checked == true) SaveArr[63] = "TRUE"; else SaveArr[63] = "FALSE";
                //if (CheckBox2.Checked == true) SaveArr[64] = "TRUE"; else SaveArr[64] = "FALSE";
                if (checkBox9.Checked == true)
                {
                    SaveArr[65] = "TRUE";
                }
                else
                {
                    SaveArr[65] = "FALSE";
                }
                if (checkBox13.Checked == true)
                {
                    SaveArr[66] = "TRUE";
                }
                else
                {
                    SaveArr[66] = "FALSE";
                }


                SaveArr[67] = TextBox26.Text;
                SaveArr[68] = TextBox27.Text;
                SaveArr[69] = TextBox28.Text;
                SaveArr[70] = TextBox29.Text;
                SaveArr[71] = TextBox30.Text;
                SaveArr[72] = TextBox31.Text;
                SaveArr[73] = TextBox32.Text;


                String StrData = "";
                int    i       = 0;
                Global.Open_Connection("General", "con");
                for (i = 0; i <= 65; i++)
                {
                    StrData = StrData + "CH" + (i + 1) + " = '" + SaveArr[i] + "', ";
                }
                StrData = StrData + "CH67 ='" + SaveArr[66] + "'";


                MySqlCommand cmdInst = new MySqlCommand();
                cmdInst.CommandText = "UPDATE TbSys SET " + StrData + "WHERE FileName = 'SystemPara'";
                cmdInst.Connection  = Global.con;
                cmdInst.ExecuteNonQuery();
                MessageBox.Show("New Changes are saves .....");
                Global.con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 14003", ex.Message);
                Global.Create_OnLog(ex.Message);
            }
        }
コード例 #5
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:
                    ComboBox9.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ComboBox9.Items.Add(result);
                        }
                    }
                    ComboBox9.SelectedIndex = 0;
                    break;

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

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

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

                case 5:
                    ComboBox17.Items.Clear();
                    foreach (string result in regex.Split(input))
                    {
                        if (result != ",")
                        {
                            ComboBox17.Items.Add(result);
                        }
                    }
                    ComboBox17.SelectedIndex = 0;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 14002", ex.Message);
                Global.Create_OnLog(ex.Message);
            }
        }
コード例 #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ComboBox7.Items.Add("COM");
            ComboBox18.Items.Add("COM");
            ComboBox19.Items.Add("COM");
            ComboBox21.Items.Add("COM");
            foreach (string port in ports)
            {
                ComboBox7.Items.Add(port);
                ComboBox18.Items.Add(port);
                ComboBox19.Items.Add(port);
                ComboBox21.Items.Add(port);
            }
            try
            {
                //////OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" + Global.PATH + "General.accdb");
                ////////OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0; Data Source=" + Global.PATH + "General.accdb");
                Global.Open_Connection("General", "con");
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "SELECT * FROM TbSys WHERE FileName = 'SystemPara'";
                int I = 0;
                MySqlDataAdapter Dap = new MySqlDataAdapter("SELECT * FROM TbSys WHERE FileName = 'SystemPara'", Global.con);
                DataSet          ds  = new DataSet();
                Dap.Fill(ds);

                for (I = 0; I < (ds.Tables[0].Columns.Count - 1); I++)
                {
                    SyspArr[I] = ds.Tables[0].Rows[0].ItemArray[I + 1].ToString();
                }


                ds.Dispose();
                Dap.Dispose();
                Global.con.Close();

                TextBox1.Text  = SyspArr[0];
                TextBox2.Text  = SyspArr[1];
                ComboBox1.Text = SyspArr[2];
                TextBox3.Text  = SyspArr[3];
                TextBox4.Text  = SyspArr[4];
                TextBox5.Text  = SyspArr[5];
                TextBox6.Text  = SyspArr[6];
                TextBox7.Text  = SyspArr[7];
                TextBox8.Text  = SyspArr[8];
                TextBox9.Text  = SyspArr[9];
                ComboBox2.Text = SyspArr[10];
                ComboBox3.Text = SyspArr[11];
                if (SyspArr[12] == "TRUE")
                {
                    CheckBox1.Checked = true;
                }
                else
                {
                    CheckBox1.Checked = false;
                }
                if (SyspArr[13] == "TRUE")
                {
                    CheckBox2.Checked = true;
                }
                else
                {
                    CheckBox2.Checked = false;
                }
                if (SyspArr[14] == "TRUE")
                {
                    CheckBox3.Checked = true;
                }
                else
                {
                    CheckBox3.Checked = false;
                }
                ComboBox20.Text = SyspArr[15];
                ComboBox4.Text  = SyspArr[16];
                ComboBox5.Text  = SyspArr[17];
                ComboBox6.Text  = SyspArr[18];
                // ComboBox7.Items.Add(SyspArr[19]);
                ComboBox7.Text = SyspArr[19];

                TextBox10.Text = SyspArr[20];
                ComboBox8.Text = SyspArr[21];
                ComboBox9.Text = SyspArr[22];

                TextBox11.Text  = SyspArr[23];
                ComboBox10.Text = SyspArr[24];
                ComboBox11.Text = SyspArr[25];

                TextBox12.Text  = SyspArr[26];
                ComboBox12.Text = SyspArr[27];
                ComboBox13.Text = SyspArr[28];

                TextBox13.Text  = SyspArr[29];
                ComboBox14.Text = SyspArr[30];
                ComboBox15.Text = SyspArr[31];

                TextBox14.Text  = SyspArr[32];
                ComboBox16.Text = SyspArr[33];
                ComboBox17.Text = SyspArr[34];

                ComboBox18.Text = SyspArr[35];
                if (SyspArr[36] == "TRUE")
                {
                    RadioButton1.Checked = true;
                }
                //if (SyspArr[37] == "true") RadioButton2.Checked = true;
                if (SyspArr[38] == "TRUE")
                {
                    RadioButton3.Checked = true;
                }


                ComboBox19.Text = SyspArr[39];

                if (SyspArr[40] == "TRUE")
                {
                    CheckBox4.Checked = true;
                    TextBox15.Enabled = true;
                    TextBox16.Enabled = true;
                }
                else
                {
                    CheckBox4.Checked = false;
                    TextBox15.Enabled = false;
                    TextBox16.Enabled = false;
                }
                TextBox15.Text = SyspArr[41];
                TextBox16.Text = SyspArr[42];

                if (SyspArr[43] == "TRUE")
                {
                    CheckBox5.Checked = true;
                    TextBox17.Enabled = true;
                    TextBox18.Enabled = true;
                }
                else
                {
                    CheckBox5.Checked = false;
                    TextBox17.Enabled = false;
                    TextBox18.Enabled = false;
                }
                TextBox17.Text = SyspArr[44];
                TextBox18.Text = SyspArr[45];

                if (SyspArr[46] == "TRUE")
                {
                    CheckBox6.Checked = true;
                    TextBox19.Enabled = true;
                    TextBox20.Enabled = true;
                }
                else
                {
                    CheckBox6.Checked = false;
                    TextBox19.Enabled = false;
                    TextBox20.Enabled = false;
                }
                TextBox19.Text = SyspArr[47];
                TextBox20.Text = SyspArr[48];

                if (SyspArr[49] == "TRUE")
                {
                    CheckBox7.Checked = true;
                    TextBox21.Enabled = true;
                    TextBox22.Enabled = true;
                }
                else
                {
                    CheckBox7.Checked = false;
                    TextBox21.Enabled = false;
                    TextBox22.Enabled = false;
                }
                TextBox21.Text = SyspArr[50];
                TextBox22.Text = SyspArr[51];

                if (SyspArr[52] == "TRUE")
                {
                    CheckBox8.Checked = true;
                    TextBox23.Enabled = true;
                    TextBox24.Enabled = true;
                }
                else
                {
                    CheckBox8.Checked = false;
                    TextBox23.Enabled = false;
                    TextBox24.Enabled = false;
                }

                TextBox23.Text = SyspArr[53];
                TextBox24.Text = SyspArr[54];


                ComboBox21.Text = SyspArr[55];
                comboBox22.Text = SyspArr[56];
                comboBox23.Text = SyspArr[57];
                comboBox24.Text = SyspArr[58];
                comboBox25.Text = SyspArr[59];


                if (SyspArr[60] == "TRUE")
                {
                    checkBox10.Checked = true;
                }
                else
                {
                    checkBox10.Checked = false;
                }
                comboBox26.Text = SyspArr[61];
                comboBox27.Text = SyspArr[62];


                //if (SyspArr[63] == "TRUE") CheckBox1.Checked = true; else CheckBox1.Checked = false;
                //if (SyspArr[64] == "TRUE") CheckBox2.Checked = true; else CheckBox2.Checked = false;
                if (SyspArr[65] == "TRUE")
                {
                    checkBox9.Checked = true;
                }
                else
                {
                    checkBox9.Checked = false;
                }
                if (SyspArr[66] == "TRUE")
                {
                    checkBox13.Checked = true;
                }
                else
                {
                    checkBox13.Checked = false;
                }

                if (checkBox10.CheckState == CheckState.Checked)
                {
                    //groupBox7.Visible = true;
                    //groupBox7.Enabled = true;
                }
                else
                {
                    //groupBox7.Visible = false;
                    //groupBox7.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Code:- 14001 ", ex.Message);
                Global.Create_OnLog(ex.Message);
            }
        }