protected void Page_Load(object sender, EventArgs e) { Session.Clear(); try { MaintainenceCL maintainStatus = maintainBLL.getStatus(); if (!IsPostBack) { BackendText.Text = maintainStatus.homeNote; } if (!maintainStatus.isOffline) { IsOffline.Visible = true; NotOffline.Visible = false; } else { IsOffline.Visible = false; NotOffline.Visible = true; } } catch (Exception ex) { throw; } }
public bool updateOffline(MaintainenceCL offlineStatus) { Maintainence query = (from x in dbcontext.Maintainences select x).FirstOrDefault(); query.isOffline = offlineStatus.isOffline; dbcontext.SaveChanges(); return(query.isOffline); }
public string updateNote(MaintainenceCL homeNote) { Maintainence query = (from x in dbcontext.Maintainences select x).FirstOrDefault(); query.HomeNote = homeNote.homeNote; dbcontext.SaveChanges(); return(query.HomeNote); }
protected void btnSubmit_Click(object sender, EventArgs e) { MaintainenceCL note = new MaintainenceCL(); note.homeNote = txtNote.Text.ToString().Replace("\n", "<br />"); note.isOffline = (btnMaintainence.Text == "On") ? true : false; maintainBLL.updateNote(note); lblSuccessful.Text = "Note has been successfully updated."; Response.AppendHeader("Refresh", "5;url=Maintainence.aspx"); }
public MaintainenceCL getStatus() { Maintainence query = (from x in dbcontext.Maintainences select x).FirstOrDefault(); MaintainenceCL returnStatus = new MaintainenceCL() { homeNote = query.HomeNote, isOffline = query.isOffline, }; return(returnStatus); }
protected void btnMaintainence_Click(object sender, EventArgs e) { MaintainenceCL updateOffline = new MaintainenceCL(); if (btnMaintainence.Text == "On") { updateOffline.isOffline = false; } else { updateOffline.isOffline = true; } maintainBLL.updateOffline(updateOffline); Response.Redirect("Maintainence.aspx"); }
protected void Page_Load(object sender, EventArgs e) { try { MaintainenceCL maintainStatus = maintainBLL.getStatus(); if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } txtNote.Text = maintainStatus.homeNote.ToString().Replace("<br />", "\n"); btnMaintainence.Text = (maintainStatus.isOffline)?"On":"Off"; } } catch (Exception ex) { throw (new Exception(ex.Message)); } }