// Set UserName public CarryWorkCalculate(string uName) { // Set UserName username = uName; DurationManage dm = new DurationManage(); durationId = dm.getDurationId(); }
protected void Button1_Click(object sender, EventArgs e) { DurationManage dm = new DurationManage(); try { Session["DurationID"] = dm.getDurationId(); Session["PreviousDurationID"] = dm.getPreviousDurationId(); } catch (Exception) { Response.Write("<script>"); Response.Write("alert('ยังไม่ได้ตั้งค่าช่วงประเมิณ')"); Response.Write("</script>"); } }
protected void Page_Load(object sender, EventArgs e) { DurationManage dr = new DurationManage(); if (dr.Header() || dr.Dean()) { Session["OtherCarryUserName"] = HttpContext.Current.User.Identity.Name; Response.Redirect("~/CarryShowOnly/CarryCalculateMain.aspx"); } AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext(); var q = (from p in db.Users where p.UserName == HttpContext.Current.User.Identity.Name select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First(); FullName.InnerText = q; }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.User.Identity.Name != null) { try { Session["UserName"] = HttpContext.Current.User.Identity.Name; DurationManage dm = new DurationManage(); Session["DurationID"] = dm.getDurationId(); Session["PreviousDurationID"] = dm.getPreviousDurationId(); } catch (Exception) { Response.Redirect("SettingDurationSystem"); } } }
private void CreateSession() { DurationManage dm = new DurationManage(); Session["UserName"] = HttpContext.Current.User.Identity.Name; Session["ReportDurationId"] = dm.getDurationId(); }
protected void Page_Load(object sender, EventArgs e) { setDefaultPage(); if (HttpContext.Current.User.Identity.Name != "") { DurationManage dm = new DurationManage(); if (Roles.IsUserInRole(User.Identity.Name, "Admin")) { Response.Redirect("~/Admin/Admin_DefaultPage.aspx"); } else if (Roles.IsUserInRole(User.Identity.Name, "Dean")) { btnProfessor.Visible = true; try { if (dm.Dean()) { btnDean.Visible = true; } } catch (Exception) { } } else if (Roles.IsUserInRole(User.Identity.Name, "Header")) { btnProfessor.Visible = true; try { if (dm.Header()) { btnHeader.Visible = true; } } catch (Exception) { } } else if (Roles.IsUserInRole(User.Identity.Name, "Professor")) { btnProfessor.Visible = true; } Session["UserName"] = HttpContext.Current.User.Identity.Name; try { Session["DurationID"] = dm.getDurationId(); Session["PreviousDurationID"] = dm.getPreviousDurationId(); } catch (Exception) { Session["DurationID"] = dm.getPreviousDurationId(); Session["PreviousDurationID"] = dm.getPreviousDurationId()-1; } AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext(); try { var q = (from p in db.Users where p.UserName == HttpContext.Current.User.Identity.Name select p.DeptId).First(); Session["DeptId"] = q; } catch (Exception) { } } }