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"); } }