Пример #1
0
 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;
     }
 }
Пример #2
0
        public bool updateOffline(MaintainenceCL offlineStatus)
        {
            Maintainence query = (from x in dbcontext.Maintainences select x).FirstOrDefault();

            query.isOffline = offlineStatus.isOffline;
            dbcontext.SaveChanges();
            return(query.isOffline);
        }
Пример #3
0
        public string updateNote(MaintainenceCL homeNote)
        {
            Maintainence query = (from x in dbcontext.Maintainences select x).FirstOrDefault();

            query.HomeNote = homeNote.homeNote;
            dbcontext.SaveChanges();
            return(query.HomeNote);
        }
Пример #4
0
        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");
        }
Пример #5
0
        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);
        }
Пример #6
0
        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");
        }
Пример #7
0
 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));
     }
 }