protected void FillMinistry() { SqlConnection con = DataAccess.GetConnction(); try { SqlCommand cmd = new SqlCommand("USP_Ministry", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd = new SqlCommand(" select '0' MinId,'-----Select-----' Minname,'' MinType union select MinId,Minname,case when MinType = 'C' and (left(minname, 10) = 'Department' or left(minname, 4) = 'NITI' ) then 'Departments' when MinType = 'C' and left(minname, 8) = 'Ministry' then 'Ministries' when MinType='M' then 'Funding Agency' When MinType='P' then 'PSU' else 'States' end MinType from P_LineMinistry order by MinType, MinName asc ", con); ddlMinistry.DataSource = fc.fillDropDownDT(cmd, ddlMinistry, "MinName", "MinId", "----Select----", ""); ddlMinistry.DataTextField = "Minname"; ddlMinistry.DataValueField = "MinId"; ddlMinistry.DataGroupField = "MinType"; ddlMinistry.DataBind(); } catch (Exception e) { LogError(e); } finally { if (con.State == System.Data.ConnectionState.Open) { con = null; } } }
protected void fillDropDowns() { SqlConnection con = DataAccess.GetConnction(); try { SqlCommand cmd; cmd = new SqlCommand(" select MinId,Minname,case when MinType = 'C' and (left(minname, 10) = 'Department' or left(minname, 4) = 'NITI' ) then 'Departments' when MinType = 'C' and left(minname, 8) = 'Ministry' then 'Ministries' when MinType='M' then 'Funding Agency' When MinType='P' then 'PSU' else 'States' end MinType from P_LineMinistry order by MinType, MinName asc ", con); ddlMinistry.DataSource = fc.fillDropDownDT(cmd, ddlMDB, "MinName", "MinId", "", ""); ddlMinistry.DataTextField = "Minname"; ddlMinistry.DataValueField = "MinId"; //ddlMinistry.DataGroupField = "MinType"; ddlMinistry.DataBind(); //ddlMinistry.Items.Insert(0,new System.Web.UI.WebControls.ListItem("---Select---","")); } catch (Exception e) { LogError(e); } finally { if (con.State == System.Data.ConnectionState.Open) { con = null; } } }
protected void FillMinistryName() { SqlConnection con = DataAccess.GetConnction(); try { SqlCommand cmd = new SqlCommand("USP_SelectMinistry", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter { ParameterName = "@UserId", DbType = DbType.String, Value = Session["UserId"].ToString() }); cmd.Parameters.Add(new SqlParameter { ParameterName = "@Rolls", DbType = DbType.String, Value = Session["Rolls"].ToString() }); cmd.Parameters.Add(new SqlParameter { ParameterName = "@Ministry", DbType = DbType.String, Value = Session["ministry"].ToString() }); //SqlCommand cmd = new SqlCommand("select convert(varchar(50),'') MinId,'-----Select Ministry-----' Minname,'' MinType union select convert(varchar(50),MinId)MinId,Minname,case when MinType = 'C' and (left(minname, 10) = 'Department' or left(minname, 4) = 'NITI' ) then 'Departments' when MinType = 'C' and left(minname, 8) = 'Ministry' then 'Ministries' when MinType='M' then 'MDB' else 'States' end MinType from P_LineMinistry where MinId not in(1,2) order by MinType, MinName asc", con); ddlMinistry.DataSource = fc.fillDropDownDT(cmd, ddlMinistry, "MinName", "MinId", "----Select Ministry----", ""); ddlMinistry.DataTextField = "Minname"; ddlMinistry.DataValueField = "MinId"; ddlMinistry.DataGroupField = "MinType"; ddlMinistry.DataBind(); } catch (Exception e) { //LogError(e); } finally { if (con.State == System.Data.ConnectionState.Open) { con = null; } } }