Exemplo n.º 1
0
 protected void RunningVariableDrp_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (RunningVariableDrp.SelectedValue == "004")
     {
         SqlConnection con1    = new SqlConnection(ConnectionString12);
         string        sqlstrg = "select SubID, Name from SubCode where GeneralID = '004' and LanguageID=" + (int)Utils.GetLanguage() + " order by Name DESC";
         SqlCommand    cmd1    = new SqlCommand();
         cmd1.Connection  = con1;
         cmd1.CommandType = CommandType.Text;
         cmd1.CommandText = sqlstrg;
         con1.Open();
         SqlDataAdapter daAdapter1 = new SqlDataAdapter(cmd1);
         DataSet        asd1       = new DataSet();
         daAdapter1.Fill(asd1);
         if (asd1.Tables[0].Rows.Count != 0)
         {
             YearFromDrp.DataSource     = asd1;
             YearFromDrp.DataTextField  = "Name";
             YearFromDrp.DataValueField = "SubID";
             YearFromDrp.DataBind();
             YearToDrp.DataSource     = asd1;
             YearToDrp.DataTextField  = "Name";
             YearToDrp.DataValueField = "SubID";
             YearToDrp.DataBind();
             con1.Close();
         }
         YearFromDrp.Visible = true;
         YearToDrp.Visible   = true;
         YearFromLbl.Visible = true;
         YearToLbl.Visible   = true;
     }
     if (RunningVariableDrp.SelectedValue != "004" && ChangingVariableDrp.SelectedValue != "004")
     {
         YearFromDrp.Visible = false;
         YearToDrp.Visible   = false;
         YearFromLbl.Visible = false;
         YearToLbl.Visible   = false;
     }
 }
Exemplo n.º 2
0
        protected void ChangingVariableDrp_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ChangingVariableDrp.SelectedValue) || string.IsNullOrEmpty(ddlThemes.SelectedValue))
            {
                return;
            }
            SqlConnection con1    = new SqlConnection(ConnectionString12);
            string        sqlstrg = "SELECT dbo.GeneralCode.GeneralID, dbo.GeneralCode.Name, dbo.ThemesVariables.ThemeID " +
                                    "FROM   dbo.ThemesVariables " +
                                    "INNER JOIN   dbo.GeneralCode ON dbo.ThemesVariables.VariableID = dbo.GeneralCode.GeneralID " +
                                    "WHERE        (dbo.GeneralCode.GeneralID <> " + ChangingVariableDrp.SelectedValue + ") " +
                                    " AND (dbo.ThemesVariables.ThemeID = " + ddlThemes.SelectedValue + ")" +
                                    " And GeneralCode.LanguageID=" + (int)Utils.GetLanguage();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con1;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = sqlstrg;
            con1.Open();
            SqlDataAdapter daAdapter = new SqlDataAdapter(cmd);
            DataSet        asd       = new DataSet();

            daAdapter.Fill(asd);
            if (asd.Tables[0].Rows.Count != 0)
            {
                RunningVariableDrp.DataSource     = asd;
                RunningVariableDrp.DataTextField  = "Name";
                RunningVariableDrp.DataValueField = "GeneralID";
                ListItem lstitem = new ListItem("Please Select variable", "");
                RunningVariableDrp.Items.Add(lstitem);
                RunningVariableDrp.DataBind();
                con1.Close();
                RunningVariableDrp.Enabled = true;
            }
            if (ChangingVariableDrp.SelectedValue == "004")
            {
                con1    = new SqlConnection(ConnectionString12);
                sqlstrg = "select SubID, Name from SubCode where GeneralID = '004' and LanguageID=" + (int)Utils.GetLanguage() + " order by Name DESC";
                SqlCommand cmd1 = new SqlCommand();
                cmd1.Connection  = con1;
                cmd1.CommandType = CommandType.Text;
                cmd1.CommandText = sqlstrg;
                con1.Open();
                SqlDataAdapter daAdapter1 = new SqlDataAdapter(cmd1);
                DataSet        asd1       = new DataSet();
                daAdapter1.Fill(asd1);
                if (asd1.Tables[0].Rows.Count != 0)
                {
                    YearFromDrp.DataSource     = asd1;
                    YearFromDrp.DataTextField  = "Name";
                    YearFromDrp.DataValueField = "SubID";
                    YearFromDrp.DataBind();
                    YearToDrp.DataSource     = asd1;
                    YearToDrp.DataTextField  = "Name";
                    YearToDrp.DataValueField = "SubID";
                    YearToDrp.DataBind();
                    con1.Close();
                }
                YearFromDrp.Visible = true;
                YearToDrp.Visible   = true;
                YearFromLbl.Visible = true;
                YearToLbl.Visible   = true;
            }
            if (RunningVariableDrp.SelectedValue != "004" && ChangingVariableDrp.SelectedValue != "004")
            {
                YearFromDrp.Visible = false;
                YearToDrp.Visible   = false;
                YearFromLbl.Visible = false;
                YearToLbl.Visible   = false;
            }
        }