private void getshadeno()
    {
        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 distinct shade_no,shade_id from shade_master_details where Com_Id='" + company_id + "'  ORDER BY shade_id asc", con);
                con.Open();
                DataSet        ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(ds);

                ComboBox6.DataSource     = ds;
                ComboBox6.DataTextField  = "shade_no";
                ComboBox6.DataValueField = "shade_id";
                ComboBox6.DataBind();
                ComboBox6.Items.Insert(0, new ListItem("Select party", "1"));


                con.Close();
            }
            con1000.Close();
        }
    }
Exemple #2
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);
            }
        }