private void show_tax()
    {
        if (User.Identity.IsAuthenticated)
        {
            SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
            SqlCommand    cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000);
            SqlDataReader dr1000;
            con1000.Open();
            dr1000 = cmd1000.ExecuteReader();
            if (dr1000.Read())
            {
                company_id = Convert.ToInt32(dr1000["com_id"].ToString());
                SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
                SqlCommand    cmd = new SqlCommand("Select * from Tax_entry where Com_Id='" + company_id + "'  ORDER BY tax_id asc", con);
                con.Open();
                DataSet        ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(ds);

                ComboBox4.DataSource     = ds;
                ComboBox4.DataTextField  = "tax_name";
                ComboBox4.DataValueField = "tax_id";
                ComboBox4.DataBind();
                ComboBox4.Items.Insert(0, new ListItem("Select tax", "1"));


                con.Close();
            }
            con1000.Close();
        }
    }
Exemple #2
0
        private void frmProject_Load(object sender, EventArgs e)
        {
            try
            {
                txtFileName.Text = "";
                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 = "@ PTO rpm :";
                DGPrj[0, 2].Value = "PTO Rated Torque (Nm):";
                DGPrj[0, 3].Value = "@ PTO rpm :";
                DGPrj[0, 4].Value = "PTO Flyup RPM:";
                DGPrj[0, 5].Value = "PTO Idle RPM:";
                DGPrj[0, 6].Value = "PTO Max Torque(Nm):";
                DGPrj[0, 7].Value = "Engine Torque Range(1000/2000) Nm:";
                DGPrj[0, 8].Value = "PTO Ratio: ";
                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("Sequence", "conSeq");
                DataTable dt = Global.conSeq.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ComboBox3.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
                }
                Global.conSeq.Close();


                ComboBox4.Items.Clear();
                ComboBox4.Refresh();
                Global.Open_Connection("Limit", "conLim");
                dt = Global.conLim.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ComboBox4.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
                }
                Global.conLim.Close();

                Global.Open_Connection("General", "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("General", "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)
            {
                MessageBox.Show("Error Code:-11001  " + ex.Message);
            }
        }
Exemple #3
0
        private void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                int X = 0;
                if (txtFileName.Text == "")
                {
                    Ep.SetError(txtFileName, "please select/Enter fileName.....");
                    txtFileName.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 (txtFileName.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("General", "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() + "'," +
                                      " Max_Tq  = '" + DGPrj[1, 6].Value.ToString() + "'," +
                                      " Tq_Range  = '" + DGPrj[1, 7].Value.ToString() + "'," +
                                      " PTO_Ratio  = '" + DGPrj[1, 8].Value.ToString() + "'," +
                                      " PM_Log  = '" + DGPrj[1, 9].Value.ToString() + "'" +
                                      " WHERE ProjectFile = '" + txtFileName.Text + "'";
                    cmd.Connection = Global.con;
                    cmd.ExecuteNonQuery();
                    Load_DataGrid();
                    MessageBox.Show("File Updated .....");
                }
                else if (flg_New == true)
                {
                    Global.Open_Connection("General", "con");
                    MySqlCommand cmd = new MySqlCommand();
                    cmd.CommandText = "INSERT INTO tblProject VALUES ('" +
                                      txtFileName.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)
            {
                MessageBox.Show("Error Code:- 11004" + ex.Message);
            }
        }
Exemple #4
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);
            }
        }