示例#1
0
    protected void LoadBranch(int agentID)
    {
        ddlBranch.Items.Clear();
        ListItem li = new ListItem("-Select-", "0");

        ddlBranch.Items.Add(li);


        List <LOCATION> LOCATIONs = new List <LOCATION>();

        LOCATIONs = LOCATIONManager.GetAllLOCATIONsByAgentID(agentID);


        List <string> onlyBranch = new List <string>();

        foreach (LOCATION location in LOCATIONs)
        {
            onlyBranch.Add(location.BRANCH);
        }

        List <string> distinctBranch = new List <string>();

        distinctBranch = onlyBranch.Distinct().ToList();


        for (int i = 0; i < distinctBranch.Count; i++)
        {
            ListItem litems = new ListItem(distinctBranch[i].ToString(), distinctBranch[i].ToString());
            ddlBranch.Items.Add(litems);
        }

        ddlBranch.DataBind();
    }
    private void loadLocation()
    {
        List <LOCATION> locations = new List <LOCATION>();

        if (Session["userType"] != null && (Session["lOCATION"] != null || Session["aGENT"] != null))
        {
            if (Session["userType"].ToString() == "Location")
            {
                LOCATIONGROUP lOCATIONGROUP = new LOCATIONGROUP();
                lOCATIONGROUP = (LOCATIONGROUP)Session["lOCATION"];

                hfLoggedinLocationID.Value = lOCATIONGROUP.LOCATIONGROUPID.ToString();

                if (ddlAgent.SelectedItem.Text != "All Agents")
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByAgentIDnGroupID(int.Parse(ddlAgent.SelectedItem.Value), int.Parse(hfLoggedinLocationID.Value));
                }
                else
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByGroupID(int.Parse(hfLoggedinLocationID.Value));
                }
                //locations = LOCATIONManager.GetAllLOCATIONsByGroupID(int.Parse(hfLoggedinLocationID.Value));
                //trLocation.Visible = false;
            }
            else if (Session["userType"].ToString() == "Agent")
            {
                AGENT aGENT = (AGENT)Session["aGENT"];
                hfAgentID.Value = aGENT.AGENTID.ToString();

                trLocation.Visible = true;
                if (hfAgentID.Value == "4")
                {
                    if (ddlAgent.SelectedItem.Text != "All Agents")
                    {
                        locations = LOCATIONManager.GetAllLOCATIONsByAgentID(int.Parse(ddlAgent.SelectedItem.Value));
                    }
                    else
                    {
                        locations = LOCATIONManager.GetAllLOCATIONs();
                    }
                }
                else
                {
                    locations = LOCATIONManager.GetAllLOCATIONsByAgentID(int.Parse(hfAgentID.Value));
                }
            }

            dlLocation.DataSource = locations;
            dlLocation.DataBind();
            tblSearchByRefCode.Visible = false;
        }
        else
        {
            Session.RemoveAll(); Response.Redirect("LogInPage.aspx");
        }
    }
示例#3
0
    private void loadLocation()
    {
        List <LOCATION> locations = new List <LOCATION>();

        if (hfAgentID.Value == "4")//main office will c all the report
        {
            locations = LOCATIONManager.GetAllLOCATIONs();
        }
        else
        {
            locations = LOCATIONManager.GetAllLOCATIONsByAgentID(int.Parse(hfAgentID.Value));
        }

        dlLocation.DataSource = locations;
        dlLocation.DataBind();
    }
示例#4
0
    protected void LoadCountry(int agentID)
    {
        ddlCountry.Items.Clear();


        ListItem li = new ListItem("-Select-", "0");

        ddlCountry.Items.Add(li);
        List <LOCATION> countrys = new List <LOCATION>();

        countrys = LOCATIONManager.GetAllLOCATIONsByAgentID(agentID);

        List <string> onlyCountry = new List <string>();
        string        allCountry  = " ";

        foreach (LOCATION country in countrys)
        {
            onlyCountry.Add(country.COUNTRY.ToString());
        }

        List <string> distinctCountry = new List <string>();

        distinctCountry = onlyCountry.Distinct().ToList();



        for (int i = 0; i < distinctCountry.Count; i++)
        {
            ListItem litems = new ListItem(distinctCountry[i].ToString(), distinctCountry[i].ToString());
            ddlCountry.Items.Add(litems);
        }

        ddlCountry.DataBind();

        loadCityByCountry();
    }