Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //To make sure do not allow staff to access boss console through browser
            if (Context.User.Identity.Name != "KaiTatL97")
            {
                Response.Redirect("../../Account/Login.aspx");
                return;

                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Dear " + Session["AccountUsername"].ToString() + ", you are not allowed to access this page.'); window.location = '../../Account/Login.aspx'; ", true);

                //return;
            }



            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginBoss")).Text = "Your last logged in was <b>"
                                                                    + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginStaff")).Text = "Your last logged in was <b>"
                                                                     + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }

            if (!IsPostBack)
            {
                connection.Open();

                SqlCommand retrieveSubmittedReportsCommand = new SqlCommand("SELECT CaseNumber, Date, Subject, ReportStatus, CreatedDateTime FROM Report " +
                                                                            "WHERE Username = @Username AND ReportStatus = 'rejected' ", connection);

                retrieveSubmittedReportsCommand.Parameters.AddWithValue("@Username", Context.User.Identity.Name);

                SqlDataReader retrieveSubmittedReports = retrieveSubmittedReportsCommand.ExecuteReader();

                DataTable dt = new DataTable();
                dt.Load(retrieveSubmittedReports);

                connection.Close();


                GridView1.DataSource = dt;
                ViewState["Datable"] = dt;
                GridView1.DataBind();
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginStaff")).Text = "Your last logged in was <b>"
                                                                     + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //To make sure do not allow staff to access boss console through browser
            if (Context.User.Identity.Name != "KaiTatL97")
            {
                Response.Redirect("../../Account/Login.aspx");
                return;


                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Dear " + Session["AccountUsername"].ToString() + ", you are not allowed to access this page.'); window.location = '../../Account/Login.aspx'; ", true);

                //return;
            }



            if (Request.IsAuthenticated && (IsPostBack || !IsPostBack))
            {
                ((Label)Master.FindControl("lastLoginBoss")).Text = "Your last logged in was <b>"
                                                                    + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";

                showNewPendingReports();
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }

            if (Session["approvedMsg"] != null)
            {
                if (System.Web.HttpContext.Current.Request.Url.ToString() == "http://localhost:53380/Content/BossConsole/PendingReports")
                {
                    alertBoxApproved.Visible = true;
                    approvedMsg.Visible      = true;
                    approvedMsg.Text         = Session["approvedMsg"].ToString();
                    Session["approvedMsg"]   = null;
                }
            }

            if (Session["rejectedMsg"] != null)
            {
                if (System.Web.HttpContext.Current.Request.Url.ToString() == "http://localhost:53380/Content/BossConsole/PendingReports")
                {
                    alertBoxRejected.Visible = true;
                    rejectedMsg.Visible      = true;
                    rejectedMsg.Text         = Session["rejectedMsg"].ToString();
                    Session["rejectedMsg"]   = null;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //To make sure do not allow staff to access boss console through browser
            if (Context.User.Identity.Name != "KaiTatL97")
            {
                Response.Redirect("../../Account/Login.aspx");
                return;

                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Dear " + Session["AccountUsername"].ToString() + ", you are not allowed to access this page.'); window.location = '../../Account/Login.aspx'; ", true);

                //return;
            }


            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginBoss")).Text = "Your last logged in was <b>"
                                                                    + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";

                if (IsPostBack)
                {
                    errormsgPasswordAuthenticate.Visible = false;
                }
            }


            if (!IsPostBack)
            {
                connection.Open();

                SqlCommand retrieveSubmittedReportsCommand = new SqlCommand("SELECT DISTINCT(Username) FROM UserAccount WHERE Username != @Username ", connection);

                retrieveSubmittedReportsCommand.Parameters.AddWithValue("@Username", Context.User.Identity.Name);

                SqlDataReader retrieveSubmittedReports = retrieveSubmittedReportsCommand.ExecuteReader();

                DataTable dt = new DataTable();
                dt.Load(retrieveSubmittedReports);

                connection.Close();


                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginStaff")).Text = "Your last logged in was <b>"
                                                                     + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }


            //At page load, the name of the person who sign in will fill in the FROM input box automatically
            //Unable to edit
            TextBox3.Text = Context.User.Identity.Name;
            //TextBox3.Text = Session["AccountUsername"].ToString();
            TextBox3.ReadOnly = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //To make sure do not allow staff to access boss console through browser
            if (Context.User.Identity.Name != "KaiTatL97")
            {
                Response.Redirect("../../Account/Login.aspx");
                return;

                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Dear " + Session["AccountUsername"].ToString() + ", you are not allowed to access this page.'); window.location = '../../Account/Login.aspx'; ", true);

                //return;
            }



            //This should be on click of the particular report then will appear
            string   dbCaseNumber   = "";
            string   dbUsername     = "";
            DateTime dbDate         = DateTime.Now;
            string   dbSubject      = "";
            string   dbDescription  = "";
            string   dbRemarks      = "";
            string   dbReportStatus = "";

            connection.Open();
            SqlCommand myCommand = new SqlCommand("SELECT CaseNumber, Username, Date, Subject, Description, Remarks, ReportStatus FROM Report WHERE CaseNumber = @caseNo", connection);

            myCommand.Parameters.AddWithValue("@caseNo", Session["caseNumberOfThisSelectedReport"].ToString());
            SqlDataReader myReader = myCommand.ExecuteReader();

            while (myReader.Read())
            {
                dbCaseNumber   = (myReader["CaseNumber"].ToString());
                dbUsername     = (myReader["Username"].ToString());
                dbDate         = (DateTime)(myReader["Date"]);
                dbSubject      = (myReader["Subject"].ToString());
                dbDescription  = (myReader["Description"].ToString());
                dbRemarks      = (myReader["Remarks"].ToString());
                dbReportStatus = (myReader["ReportStatus"].ToString());
            }

            connection.Close();


            Label2.Text = dbCaseNumber + " -";

            Label4.Text  = dbDate.ToString("dd/MM/yyyy");
            Label6.Text  = dbUsername;
            Label8.Text  = dbSubject;
            Label10.Text = dbDescription;

            TextBox3.Text = dbDate.ToString("dd/MM/yyyy");
            TextBox5.Text = dbUsername;
            TextBox7.Text = dbSubject;
            TextBox9.Text = dbDescription;
            Label12.Text  = dbRemarks;

            if (dbReportStatus == "rejected")
            {
                //Make the labels disappear
                Label4.Visible  = false;
                Label6.Visible  = false;
                Label8.Visible  = false;
                Label10.Visible = false;

                //Make the textbox visible
                TextBox3.Visible = true;
                TextBox5.Visible = true;
                TextBox7.Visible = true;
                TextBox9.Visible = true;

                //Make textbox editable to resubmit
                TextBox3.ReadOnly = true;
                TextBox5.ReadOnly = true;
                TextBox7.ReadOnly = true;
                TextBox9.ReadOnly = true;
            }

            if (dbReportStatus != "accepted")
            {
                btnSaveAsPDF.Enabled = false;
                //Label13.Visible = false;
                PasswordTxt.Enabled = false;
            }

            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginBoss")).Text = "Your last logged in was <b>"
                                                                    + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }

            //Label8.Text = this.Decrypt(Label8.Text.Trim());
            Label10.Text  = Decrypt(Label10.Text.Trim());
            TextBox9.Text = Decrypt(TextBox9.Text.Trim());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //This should be on click of the particular report then will appear
                string   dbCaseNumber   = "";
                string   dbUsername     = "";
                DateTime dbDate         = DateTime.Now;
                string   dbSubject      = "";
                string   dbDescription  = "";
                string   dbRemarks      = "";
                string   dbReportStatus = "";

                connection.Open();
                SqlCommand myCommand = new SqlCommand("SELECT CaseNumber, Username, Date, Subject, Description, Remarks, ReportStatus FROM Report WHERE CaseNumber = @caseNo", connection);
                myCommand.Parameters.AddWithValue("@caseNo", Session["caseNumberOfThisSelectedReport"].ToString());
                SqlDataReader myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                    dbCaseNumber   = (myReader["CaseNumber"].ToString());
                    dbUsername     = (myReader["Username"].ToString());
                    dbDate         = (DateTime)(myReader["Date"]);
                    dbSubject      = (myReader["Subject"].ToString());
                    dbDescription  = (myReader["Description"].ToString());
                    dbRemarks      = (myReader["Remarks"].ToString());
                    dbReportStatus = (myReader["ReportStatus"].ToString());
                }

                connection.Close();
                if (!IsPostBack)
                {
                    Label2.Text = dbCaseNumber + " -";

                    Label4.Text  = dbDate.ToString("dd/MM/yyyy");
                    Label6.Text  = dbUsername;
                    Label8.Text  = dbSubject;
                    Label10.Text = Decrypt(dbDescription);

                    TextBox3.Text = dbDate.ToString();
                    TextBox5.Text = dbUsername;
                    TextBox7.Text = dbSubject;
                    TextBox9.Text = Decrypt(dbDescription);
                    Label12.Text  = dbRemarks;
                }


                if (dbReportStatus == "accepted" || dbReportStatus == "pending")

                {
                    btnReSubmitRpt.Visible = false;
                }
                if (dbReportStatus != "accepted")
                {
                    Label13.Visible     = false;
                    PasswordTxt.Visible = false;
                }
                if (dbReportStatus == "rejected" || dbReportStatus == "drafts")
                {
                    //Make the labels disappear
                    Label8.Visible  = false;
                    Label10.Visible = false;

                    //Make the textbox visible
                    TextBox7.Visible = true;
                    TextBox9.Visible = true;

                    //Make textbox editable to resubmit
                    TextBox7.ReadOnly = false;
                    TextBox9.ReadOnly = false;
                }


                if (dbReportStatus != "accepted")
                {
                    btnSaveAsPDF.Visible = false;
                }

                if (Request.IsAuthenticated)
                {
                    ((Label)Master.FindControl("lastLoginStaff")).Text = "Your last logged in was <b>"
                                                                         + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
                }

                if (IsPostBack)
                {
                    errormsgPasswordAuthenticate.Visible = false;
                }

                if (dbReportStatus == "drafts")
                {
                    TextBox9.Text = Decrypt(dbDescription.Trim());
                }
                //Label8.Text = this.Decrypt(Label8.Text.Trim());
                Label10.Text = Decrypt(dbDescription.Trim());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //To make sure do not allow staff to access boss console through browser
            if (Context.User.Identity.Name != "KaiTatL97")
            {
                Response.Redirect("../../Account/Login.aspx");
                return;

                //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Dear " + Session["AccountUsername"].ToString() + ", you are not allowed to access this page.'); window.location = '../../Account/Login.aspx'; ", true);

                //return;
            }


            if (Request.IsAuthenticated)
            {
                ((Label)Master.FindControl("lastLoginBoss")).Text = "Your last logged in was <b>"
                                                                    + ActionLogs.getLastLoggedInOf(Context.User.Identity.Name) + "</b>";
            }

            if (IsPostBack)
            {
                errormsgPasswordAuthenticate.Visible = false;
            }

            if (Session["caseNumberOfThisPendingReport"] == null || Session["usernameOfThisPendingReport"] == null)
            {
                return;
            }
            else
            {
                //This should be on click of the particular report then will appear
                string   dbCaseNumber   = "";
                string   dbUsername     = "";
                DateTime dbDate         = DateTime.Now;
                string   dbSubject      = "";
                string   dbDescription  = "";
                string   dbRemarks      = "";
                string   dbReportStatus = "";

                connection.Open();
                SqlCommand myCommand = new SqlCommand("SELECT CaseNumber, Username, Date, Subject, Description, ReportStatus FROM Report WHERE CaseNumber = @caseNo AND Username = @AccountUsername", connection);
                myCommand.Parameters.AddWithValue("@caseNo", Session["caseNumberOfThisPendingReport"].ToString());
                myCommand.Parameters.AddWithValue("@AccountUsername", Session["usernameOfThisPendingReport"].ToString());

                //Hardcoded the case number - next time change to auto input when onclick of the particular report
                SqlDataReader myReader = myCommand.ExecuteReader();


                while (myReader.Read())
                {
                    dbCaseNumber   = (myReader["CaseNumber"].ToString());
                    dbUsername     = (myReader["Username"].ToString());
                    dbDate         = (DateTime)(myReader["Date"]);
                    dbSubject      = (myReader["Subject"].ToString());
                    dbDescription  = (myReader["Description"].ToString());
                    dbReportStatus = (myReader["ReportStatus"].ToString());
                }

                connection.Close();

                Label2.Text  = dbCaseNumber;
                Label4.Text  = dbDate.ToString("dd/MM/yyyy");
                Label6.Text  = dbUsername;
                Label8.Text  = dbSubject;
                Label10.Text = Decrypt(dbDescription);
                //Label10.Text = Decrypt(Label10.Text.Trim());
            }
        }