protected void Page_Load(object sender, EventArgs e) { facade = new BusinessLogic.BusinessFacade(myConn); Intership intership = new Intership(); //repeater_tabs.DataSource = Intership.GetAll(); //repeater_tabs.DataBind(); repeater_Content.DataSource = repeater_tabs.DataSource; repeater_Content.DataBind(); //File reader string filepath = Server.MapPath("~/UserData/template/Preparation.txt"); if (File.Exists(filepath)) { StreamReader reader = new StreamReader(filepath); literal_stickyText.Text = reader.ReadToEnd().Replace(Environment.NewLine, "<br />"); } if (User.IsInRole("superadmin") || User.IsInRole("admin")) { pnl_ApplyAdd.Visible = true; } }
public static Intership getIntershipById(int id, bool selectAll = false) { dbContext = new TeachinVietnamDataContext(); BusinessLogic.proc_getIntershipByIdResult i = null; if (selectAll == false) { i = dbContext.proc_getIntershipById(id).Where(x => x.active == true).FirstOrDefault(); } else { i = dbContext.proc_getIntershipById(id).FirstOrDefault(); } if (i != null) { Intership _intership = new Intership(); _intership.id = i.id; _intership.articleName = i.articleName; _intership.articleIntroduction = i.articleIntroduction.Replace(Environment.NewLine, "<br />"); _intership.articleContent = i.articleContent.Replace(Environment.NewLine, "<br />"); _intership.active = (bool)i.active; _intership.createdDate = (DateTime)i.createdDate; _intership.enableFreeGuide = i.EnableFreeGuide != null ? (bool)i.EnableFreeGuide : false; _intership.enableApplyOnline = i.EnableApplyOnline != null ? (bool)i.EnableApplyOnline : false; return _intership; } return null; }
public static List<Intership> GetAll() { dbContext = new TeachinVietnamDataContext(); var allIntership = dbContext.tbl_Interships.Where(x => x.active == true).OrderByDescending(x => x.createdDate); List<Intership> ilist = new List<Intership>(); foreach (var i in allIntership) { Intership _intership = new Intership(); _intership.id = i.id; _intership.articleName = i.articleName; _intership.articleIntroduction = i.articleIntroduction.Replace(Environment.NewLine, "<br />"); _intership.articleContent = i.articleContent.Replace(Environment.NewLine, "<br />"); _intership.active = (bool)i.active; _intership.createdDate = (DateTime)i.createdDate; _intership.enableFreeGuide = i.EnableFreeGuide != null ? (bool)i.EnableFreeGuide : false; _intership.enableApplyOnline = i.EnableApplyOnline != null ? (bool)i.EnableApplyOnline : false; ilist.Add(_intership); } return ilist; }