Exemple #1
0
    public void fillDepartMent(string LocationId, DropDownList ddl)
    {
        string DeptId = string.Empty;

        DataTable dt = DM.GetDepartmentMaster(Session["CompId"].ToString());



        try
        {
            DataView dv = new DataView(dt);

            dv.RowFilter = "Location_Id ='" + LocationId + "'";
            dt           = dv.ToTable();



            ddl.DataSource     = dt;
            ddl.DataTextField  = "Dep_Name";
            ddl.DataValueField = "Dep_Id";
            ddl.DataBind();
            ddl.Items.Insert(0, "--Select One--");
            ddl.SelectedIndex = 0;
        }
        catch
        { }
    }
Exemple #2
0
    public static string[] GetCompletionListDepCode(string prefixText, int count, string contextKey)
    {
        DepartmentMaster objDepMaster = new DepartmentMaster();
        DataTable        dt           = new DataView(objDepMaster.GetDepartmentMaster(HttpContext.Current.Session["CompId"].ToString()), "Dep_Code like '" + prefixText.ToString() + "%'", "", DataViewRowState.CurrentRows).ToTable();

        dt = new DataView(dt, "Brand_Id='" + HttpContext.Current.Session["BrandId"].ToString() + "' and Location_Id='" + HttpContext.Current.Session["LocId"].ToString() + "' ", "", DataViewRowState.CurrentRows).ToTable();

        string[] txt = new string[dt.Rows.Count];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            txt[i] = dt.Rows[i]["Dep_Code"].ToString();
        }
        return(txt);
    }
Exemple #3
0
    public void FillddlParentDepDDL()
    {
        DataTable dt = objDep.GetDepartmentMaster(Session["CompId"].ToString());

        dt = new DataView(dt, "Brand_Id='" + Session["BrandId"].ToString() + "' and Location_Id='" + Session["LocId"].ToString() + "' ", "", DataViewRowState.CurrentRows).ToTable();


        if (dt.Rows.Count > 0)
        {
            ddlParentDep.DataSource = null;
            ddlParentDep.DataBind();
            ddlParentDep.DataSource     = dt;
            ddlParentDep.DataTextField  = "Dep_Name";
            ddlParentDep.DataValueField = "Dep_Id";
            ddlParentDep.DataBind();
            ListItem li = new ListItem("--Select--", "0");
            ddlParentDep.Items.Insert(0, li);
            ddlParentDep.SelectedIndex = 0;
        }
        else
        {
            try
            {
                ddlParentDep.Items.Clear();
                ddlParentDep.DataSource = null;
                ddlParentDep.DataBind();
                ListItem li = new ListItem("--Select--", "0");
                ddlParentDep.Items.Insert(0, li);
                ddlParentDep.SelectedIndex = 0;
            }
            catch
            {
                ListItem li = new ListItem("--Select--", "0");
                ddlParentDep.Items.Insert(0, li);
                ddlParentDep.SelectedIndex = 0;
            }
        }
    }