Exemple #1
0
        private void DGOut_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int port = 0;
            int c    = DGOut.CurrentRow.Index;

            if (c >= 8)
            {
                port = 1;
            }
            else
            {
                port = 0;
            }

            if (Convert.ToBoolean(DGOut[0, c].Value) == true)

            {
                DGOut[1, c].Style.BackColor = Color.Green;;
                DGOut[1, c].Style.ForeColor = Color.Yellow;
                DGOut[0, c].Value           = 0;
                Global.Dig_OutBit(port, c, false);
            }
            else
            {
                DGOut[1, c].Style.BackColor = Color.Red;;
                DGOut[1, c].Style.ForeColor = Color.Yellow;
                DGOut[0, c].Value           = 1;
                Global.Dig_OutBit(port, c, true);
            }
        }
Exemple #2
0
        //private void Read_Project()
        //{
        //    try
        //    {
        //        Global.Open_Connection("General", "con");
        //        OleDbCommand cmd = new OleDbCommand("SELECT * FROM tblProject Where ProjectFile = '" + Global.PrjNm + "'", Global.con);
        //        OleDbDataReader Rd = cmd.ExecuteReader();
        //        while (Rd.Read())
        //        {
        //            frmMain.Prj[0] = Rd.GetValue(0).ToString();
        //            frmMain.Prj[1] = Rd.GetValue(1).ToString();
        //            frmMain.Prj[2] = Rd.GetValue(2).ToString();
        //            //frmMain.Prj[3] = Rd.GetValue(3).ToString();
        //            frmMain.Prj[4] = Rd.GetValue(4).ToString();
        //            Global.NCyl = Rd.GetValue(4).ToString();
        //            frmMain.Prj[5] = Rd.GetValue(5).ToString();
        //            frmMain.Prj[6] = Rd.GetValue(6).ToString();
        //            Global.EngMd = frmMain.Prj[6].Trim();
        //        }
        //        Global.con.Close();
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show("Error in Rd_Project : ", ex.Message);
        //        Global.Create_OnLog(ex.Message);
        //    }

        //}

        private void Check_File_Validation()
        {
            try
            {
                if (Global.EngNo == String.Empty)
                {
                    MessageBox.Show("Engine No. Not Entered ......., ");
                }
                else
                {
                    Global.Open_Connection("General", "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.cumhours = "0000.00.00";
                    Global.Open_Connection("General", "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;
                        }
                        if (Convert.ToInt32(Global.Prj[12]) >= 1000)
                        {
                            Global.Dig_OutBit(0, 6, true);
                        }
                        else
                        {
                            Global.Dig_OutBit(0, 6, false);
                        }
                        x += 1;
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Engine File  Not Found ....... ");
                        return;
                    }
                    Global.con.Close();
                    //  **************************
                    Global.Open_Connection("Limit", "conLim");
                    DataTable dt = Global.conLim.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (Global.Prj[3] == dt.Rows[i]["TABLE_NAME"].ToString())
                        {
                            f_Found = true;
                            break;
                        }
                        x += 1;
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Limit File  Not Found ....... ");
                        return;
                    }
                    //    **************************

                    Global.Open_Connection("Sequence", "conSeq");
                    dt = Global.conSeq.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (Global.Prj[2] == dt.Rows[i]["TABLE_NAME"].ToString())
                        {
                            f_Found = true;
                            break;
                        }
                        x += 1;
                    }
                    if (f_Found == false)
                    {
                        MessageBox.Show("Sequence File  Not Found ....... ");
                        return;
                    }
                    //     **************************
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Check File validation:" + ex.Message);
            }
        }