public IEnumerable <SelectListItem> DistrictAuth(string cRegion, string selectedValue) { System.Web.Security.FormsIdentity identity = (System.Web.Security.FormsIdentity)HttpContext.User.Identity; string[] roles = identity.Ticket.UserData.Split('|'); if (roles.Length > 4) { IMsDistrictAuthorizationQuery msDistrictAuthorizationQuery = new MsDistrictAuthorizationListQuery(); IList <MsDistrictAuthorizationDto> listDistrictAuth = msDistrictAuthorizationQuery .GetMsDistrictAuthorizationQRY(2, 0, 0 , "cStatus = 1 AND nPernr = " + roles[5] + " AND cRegionCode = '" + cRegion + "'" , "cDistrictName"); IEnumerable <SelectListItem> query = (from da in listDistrictAuth select new SelectListItem { Value = da.cDistrictCode, Text = da.cDistrictName, Selected = da.cDistrictCode.Equals(selectedValue) ? true : false }); return(query); } return(null); }
public IEnumerable <SelectListItem> ProvinceAuth(string selValue) { System.Web.Security.FormsIdentity identity = (System.Web.Security.FormsIdentity)HttpContext.User.Identity; string[] roles = identity.Ticket.UserData.Split('|'); selValue = string.IsNullOrEmpty(selValue) ? string.Empty : selValue; if (roles.Length > 4) { IMsDistrictAuthorizationQuery msDistrictAuthorizationQuery = new MsDistrictAuthorizationListQuery(); IList <MsDistrictAuthorizationDto> listDistrictAuth = msDistrictAuthorizationQuery .GetMsDistrictAuthorizationQRY(2, 0, 0, "cStatus = 1 AND nPernr = " + roles[5], "cProvince"); IEnumerable <SelectListItem> query = (from da in listDistrictAuth group da by new { da.cProvince } into g select new SelectListItem { Value = g.FirstOrDefault().cProvince, Text = g.FirstOrDefault().cProvince, Selected = selValue.Equals(g.FirstOrDefault().cProvince) }); return(query); } return(null); }
public String GetRegionSelected() { string ddlRegion = Request["ddlRegion"]; if (!string.IsNullOrEmpty(ddlRegion)) { Session["ddlRegion"] = ddlRegion; } else { // Set default region string regionSelected = string.Empty; IMsDistrictAuthorizationQuery msDistrictAuthorizationQuery = new MsDistrictAuthorizationListQuery(); IList <MsDistrictAuthorizationDto> listDistrictAuth = msDistrictAuthorizationQuery .GetMsDistrictAuthorizationQRY(2, 0, 0 , "cStatus = 1 AND nPernr = " + HttpContext.User.Identity.Name, string.Empty); if (listDistrictAuth.Count > 0) { regionSelected = listDistrictAuth[0].cRegionCode; } ddlRegion = Session["ddlRegion"] == null ? regionSelected : Session["ddlRegion"].ToString(); } return(ddlRegion); }
public IEnumerable <MsDistrictAuthorizationDto> RegionAuth(int pernr) { IMsDistrictAuthorizationQuery msDistrictAuthorizationQuery = new MsDistrictAuthorizationListQuery(); IList <MsDistrictAuthorizationDto> listDistrictAuth = msDistrictAuthorizationQuery .GetMsDistrictAuthorizationQRY(2, 0, 0, "cStatus = 1 AND nPernr = " + pernr, "cRegionName"); IEnumerable <MsDistrictAuthorizationDto> query = (from da in listDistrictAuth group da by new { da.cRegionCode, da.cRegionName } into g select new MsDistrictAuthorizationDto { cRegionCode = g.FirstOrDefault().cRegionCode, cRegionName = g.FirstOrDefault().cRegionName, }); return(query); }