protected void Page_Load(object sender, EventArgs e) { ntf.VisibleOnPageLoad = false; if (!IsPostBack) { var user = _userBL.GetUser(HttpContext.Current.User.Identity.Name); IEnumerable <t_Sites> sites; if (user.Role == "consumer") { sites = _siteBL.GetSitesByConsumerID(user.ConsumerId); } else if (user.Role == "staff") { sites = _siteBL.GetSitesByStaffId(user.StaffId); } else { sites = null; } cboSites.DataSource = sites; var current = sites.FirstOrDefault(); if (current != null) { txtLocation.Text = current.Location; } cboSites.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { ntf.VisibleOnPageLoad = false; if (!IsPostBack) { var user = _userBL.GetUser(HttpContext.Current.User.Identity.Name); IEnumerable <t_Sites> sites; if (user.Role == "consumer") { sites = _siteBL.GetSitesByConsumerID(user.ConsumerId); } else if (user.Role == "staff") { sites = _siteBL.GetSitesByStaffId(user.StaffId); } else { sites = null; } cboSites.DataSource = sites; var current = sites.FirstOrDefault(); if (current != null) { txtLocation.Text = current.Location; } cboSites.DataBind(); } // Pi-solution developer - multi languages if (!IsPostBack) { language = (Session["myapplication.language"] == null) ? "vi" : Session["myapplication.language"].ToString(); List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Logger/Daily_Monthly.aspx")).ToList(); //Parse content to form var var1 = list.Where(x => x.ControlId.Contains("lbFrom")).FirstOrDefault(); lbFrom.Text = (var1 == null) ? "" : var1.Contents; var var2 = list.Where(x => x.ControlId.Contains("lbTo")).FirstOrDefault(); lbTo.Text = (var2 == null) ? "" : var2.Contents; var var3 = list.Where(x => x.ControlId.Contains("btnView")).FirstOrDefault(); btnView.Text = (var3 == null) ? "" : var3.Contents; var var4 = list.Where(x => x.ControlId.Contains("btnExport")).FirstOrDefault(); btnExport.Text = (var4 == null) ? "" : var4.Contents; // News comparing to supervisor List <t_LanguageTranslate> list2 = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Site/Config.aspx")).ToList(); var var11 = list2.Where(x => x.ControlId.Contains("lbTagName")).FirstOrDefault(); lbTagName.Text = (var11 == null) ? "" : var11.Contents; var var22 = list2.Where(x => x.ControlId.Contains("lbLocation")).FirstOrDefault(); lbLocation.Text = (var22 == null) ? "" : var22.Contents; } }
public IEnumerable <t_Sites> GetData(string staff) { if (staff != null) { var listMonthlyComplexData = _siteBL.GetSitesByStaffId(staff); return(listMonthlyComplexData); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var user = _userBL.GetUser(HttpContext.Current.User.Identity.Name); IEnumerable <t_Sites> sites; if (user.Role == "consumer") { sites = _siteBL.GetSitesByConsumerID(user.ConsumerId); } else if (user.Role == "staff") { sites = _siteBL.GetSitesByStaffId(user.StaffId); } else { sites = null; } cboSites.DataSource = sites; cboSites.DataBind(); } }