Beispiel #1
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();
                    }
                }
                Erp1.Clear();
                if (txtbarcode.Text == String.Empty) // "")
                {
                    Erp1.SetError(txtbarcode, "Please Type Engine No.....");
                    MessageBox.Show("Please Type Engine No. ...... ");
                    txtbarcode.Focus();
                }
                else if (TextBox1.Text == String.Empty) // "")
                {
                    Erp1.SetError(TextBox1, "Please Scan Engine No.....");
                    MessageBox.Show("Please Scan Engine No. ...... ");
                    TextBox1.Focus();
                }
                else if (PrjCombo.Text == String.Empty)
                {
                    Erp1.SetError(PrjCombo, "Please Select Project.....");
                    MessageBox.Show("Please Select Project. ...... ");
                    PrjCombo.Focus();
                }
                else if ((textBox7.Text == String.Empty) || (textBox8.Text == String.Empty) || (textBox11.Text == String.Empty) ||
                         (textBox12.Text == String.Empty) || (textBox13.Text == String.Empty) || (textBox14.Text == String.Empty))
                {
                    Erp1.SetError(panel2, "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 ");
                    panel2.Focus();
                }
                else
                {
                    Global.EngNo     = TextBox1.Text;
                    Global.EngineNo  = TextBox1.Text;
                    Global.FipNo     = TextBox2.Text;
                    Global.EngMd     = TextBox3.Text;
                    Global.Chasis_N  = TextBox4.Text;
                    Global.EnginerNm = textBox5.Text;
                    Global.TestRef   = TextBox6.Text;//eng_reating
                    Global.PrjNm     = PrjCombo.Text;
                    Global.T_Date    = TextBox9.Text;
                    Global.Shift     = TextBox10.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;
                    }

                    //Global.I_Rpm = int.Parse(textBox7.Text);
                    //Global.F_Rpm = int.Parse(textBox8.Text);
                    //Global.Max_Pow = Double.Parse(textBox11.Text);
                    //Global.Pow_RPM = Double.Parse(textBox12.Text);
                    //Double X = Double.Parse(textBox13.Text);
                    //Global.Max_Trq = X + (X / 10);
                    //Global.Trq_RPM = Double.Parse(textBox14.Text);

                    Global.Open_Connection("General", "con");
                    MySqlCommand cmd = new MySqlCommand("UPDATE TbSys SET " +
                                                        " CH1 = '" + Global.EngNo + "'," +
                                                        " CH2 = '" + Global.FipNo + "'," +
                                                        " CH3 = '" + Global.EngMd + "'," +
                                                        " CH4 = '" + Global.EnginerNm + "'," +
                                                        " 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 + "'" +
                                                        " 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();
                    Global.Read_Limfl();
                    Global.Flg_Ready          = true;
                    Global.main.BtnSA.Enabled = false;
                    Global.main.Btn21.Enabled = true;

                    //Global.I_Rpm = int.Parse(textBox7.Text);
                    //Global.F_Rpm = int.Parse(textBox8.Text);
                    //Global.Max_Pow = Double.Parse(textBox11.Text);
                    //Global.Pow_RPM  = Double.Parse(textBox12.Text);
                    //Double X = Double.Parse(textBox13.Text);
                    //Global.Max_Trq = X + (X / 10);
                    //Global.Trq_RPM = Double.Parse(textBox14.Text);


                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ErrorCode- 1002", ex.Message);
            }
        }
Beispiel #2
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     Erp1.Clear();
     Global.flg_prjOn = true;
     this.Close();
 }