protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                d.AddParam("@UserName", txtUserName.Text);
                d.AddParam("@UserPassword", txtPassword.Text);
                d.AddParam("@NewPassword", txtNewPassword.Text);
                d.ExecuteProcedure("spUserPasswordUpdate");

                /// Shows a Message saying that the password has been updated and
                /// that they will receive an e-mail.
                /// </summary>
                if (cbxConfirm.Checked)//only if the cbxConfirm is checked will it send an e-mail confirming Password update
                {
                    SendEmailMessage(); //uses this method to send an e-mail confirming Password update
                }
            }
            catch (Exception ex)
            {
                lblStatus.Text = "Send Email Failed. " + ex.Message;//if there is an error the label will display it
            }
            finally
            {
                pnlChangePassword.Visible = false;//panel changes so you can't see it
                pnlPassUpdateConfirm.Visible = true;//panel changes so you can see it
                Session.Abandon();//abandons the Session
                Panel p1 = (Panel)Master.FindControl("pnlSignedIn");//Finds the pnlSignedOut on the MasterPage
                p1.Visible = true;//panel changes so you can see it
                Panel p2 = (Panel)Master.FindControl("pnlSignedOut");//Finds the  pnlSignedIn on the MasterPage
                p2.Visible = false;//panel changes so you can't see it
            }
        }
Exemple #2
0
        ////public string LogDate { get { return _logDate; } }
        ////public string LogDate { set { _logDate = value; } }
        ////public string LogDate
        ////{
        ////    get { return _logDate; }
        ////    set { _logDate = value; }
        ////}


        public void SaveToLog(string UserId, string LoginSuccessful, int LogDate)
        {
            DAL_Project.DAL dal = new DAL_Project.DAL("Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
            dal.AddParam("@UserID", UserId);
            dal.AddParam("@LoginSuccessful", LoginSuccessful);
            dal.AddParam("@LogDate", LogDate);
            dal.ExecuteProcedure("spLogin");
        }
Exemple #3
0
 ////public string LogDate { get { return _logDate; } }
 ////public string LogDate { set { _logDate = value; } }
 ////public string LogDate
 ////{
 ////    get { return _logDate; }
 ////    set { _logDate = value; }
 ////}
 public void SaveToLog(string UserId, string LoginSuccessful, int LogDate)
 {
     DAL_Project.DAL dal = new DAL_Project.DAL("Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
     dal.AddParam("@UserID", UserId);
     dal.AddParam("@LoginSuccessful", LoginSuccessful);
     dal.AddParam("@LogDate", LogDate);
     dal.ExecuteProcedure("spLogin");
 }
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            Session["SignedIn"] = "User";
            DataSet ds = new DataSet();

            DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
            d.AddParam("@UserName", txtUserName.Text);   //@UserName will compare value txtUserName.Text
            d.AddParam("@Password", txtPassword.Text);   //@Password will compare value txtPassword.Text
            ds = d.ExecuteProcedure("spLogin");


            if (ds.Tables[0].Rows.Count > 0)
            {
                lbnUser.Visible        = true;
                Session["UserID"]      = ds.Tables[0].Rows[0]["UserID"].ToString();
                Session["AccessLevel"] = ds.Tables[0].Rows[0]["AccessLevel"].ToString();
                Session["UserName"]    = ds.Tables[0].Rows[0]["UserName"].ToString();
                Session["Password"]    = ds.Tables[0].Rows[0]["Password"].ToString();


                if (Session["AccessLevel"].ToString() == "2")
                {
                    lbnAdmin.Visible = true;
                    lbnUser.Visible  = false;
                }

                if (chxStaySignedIn.Checked)
                {
                    HttpCookie myCookieAdm = new HttpCookie("StaySignedInUserID");
                    myCookieAdm.Value   = Session["UserID"].ToString();
                    myCookieAdm.Expires = DateTime.Now.AddDays(2);
                    Response.Cookies.Add(myCookieAdm);

                    HttpCookie myCookieReg = new HttpCookie("StaySignedInSecurityLevel");
                    myCookieReg.Value   = Session["SecurityAccessLevel"].ToString();
                    myCookieReg.Expires = DateTime.Now.AddDays(2);
                    Response.Cookies.Add(myCookieReg);
                }
            }

            else
            {
                lblErrorSignIn.Text = "INCORRECT USERNAME AND PASSWORD!";
            }
            lblYouAre.Text       = "Welcome " + txtUserName.Text;
            pnlSignedOut.Visible = true;
            pnlSignedIn.Visible  = false;
        }
Exemple #5
0
 private object RefreshPictureGrid(string PictureID)
 {
     string name = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
     DAL_Project.DAL dal = new DAL_Project.DAL(name);
     dal.AddParam("PictureID", PictureID);
     return dal.ExecuteProcedure("spGetPictures");
 }
Exemple #6
0
        private object RefreshPictureGrid(string PictureID)
        {
            string name = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;

            DAL_Project.DAL dal = new DAL_Project.DAL(name);
            dal.AddParam("PictureID", PictureID);
            return(dal.ExecuteProcedure("spGetPictures"));
        }
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            Session["SignedIn"] = "User";
               DataSet ds = new DataSet();
               DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
               d.AddParam("@UserName", txtUserName.Text);//@UserName will compare value txtUserName.Text
               d.AddParam("@Password", txtPassword.Text);//@Password will compare value txtPassword.Text
               ds = d.ExecuteProcedure("spLogin");

               if (ds.Tables[0].Rows.Count > 0)
               {
                   lbnUser.Visible = true;
                   Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString();
                   Session["AccessLevel"] = ds.Tables[0].Rows[0]["AccessLevel"].ToString();
                   Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString();
                   Session["Password"] = ds.Tables[0].Rows[0]["Password"].ToString();

                   if (Session["AccessLevel"].ToString() == "2")
                   {
                       lbnAdmin.Visible = true;
                       lbnUser.Visible = false;
                   }

                   if (chxStaySignedIn.Checked)
                   {
                       HttpCookie myCookieAdm = new HttpCookie("StaySignedInUserID");
                       myCookieAdm.Value = Session["UserID"].ToString();
                       myCookieAdm.Expires = DateTime.Now.AddDays(2);
                       Response.Cookies.Add(myCookieAdm);

                       HttpCookie myCookieReg = new HttpCookie("StaySignedInSecurityLevel");
                       myCookieReg.Value = Session["SecurityAccessLevel"].ToString();
                       myCookieReg.Expires = DateTime.Now.AddDays(2);
                       Response.Cookies.Add(myCookieReg);
                   }
               }

               else
               {
                   lblErrorSignIn.Text = "INCORRECT USERNAME AND PASSWORD!";
               }
               lblYouAre.Text = "Welcome " + txtUserName.Text;
               pnlSignedOut.Visible = true;
               pnlSignedIn.Visible = false;
        }
 private string GetEmailAddress()
 {
     DataSet ds = new DataSet();
     string clientId = (string)Session["ClientID"];
     DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
     d.AddParam("@ClientID", clientId);
     ds = d.ExecuteProcedure("spGetEmail");
     return ds.Tables[0].Rows[0]["Email"].ToString();
 }
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
         dal.AddParam("@LoginID", txtloginID.Text);
         dal.ExecuteProcedure("spLoginDelete");
         Clearfields(); //Clears all the fields
         BindData();    //binds the data
     }
     catch (Exception ex)
     {
         lblError.Text = "Opps, Something went wrong " + ex.Message;//if something goes wrong this will fire
     }
 }
        protected void btnDeleteError_Click(object sender, EventArgs e)
        {
            try//TODO
            {
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                dal.AddParam("@ErrorID", txtErrorID.Text);
                dal.ExecuteProcedure("spErrorDelete");
                Clearfields();//Clears all the fields
                BindData();//binds the data

            }
            catch (Exception ex)
            {
                lblError.Text = "Opps, Something went wrong " + ex.Message;
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
                dal.AddParam("@LoginID", txtloginID.Text);
                dal.ExecuteProcedure("spLoginDelete");
                Clearfields();//Clears all the fields
                BindData();//binds the data

            }
            catch (Exception ex)
            {
                lblError.Text = "Opps, Something went wrong " + ex.Message;//if something goes wrong this will fire
            }
        }
Exemple #12
0
 //When the Delete button is clicked....
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
         dal.AddParam("@ClientID", txtClientID.Text);
         dal.ExecuteProcedure("spClientDelete");
         Clearfields();//Clears all the fields
         BindData();//binds the data
         lblIfNotDelete.Visible = true;//turns this label on
     }
     catch (Exception ex)
     {
         lblError.Text = "Opps, Something went wrong " + ex.Message;//if something goes wrong this will fire
     }
 }
Exemple #13
0
        //when the Save button is clicked...
        protected void btnSave_Click(object sender, EventArgs e)
        {
            pnlEditDelete.Visible = true;//turns this panel visible
            try
            { //The DAL fires and the fields that have input are saved to the database
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                dal.AddParam("@ClientID", txtClientID.Text);
                dal.AddParam("@fName", txtfName.Text);
                dal.AddParam("@lName", txtlName.Text);
                dal.AddParam("@Address", txtAddress.Text);
                dal.AddParam("@City", txtCity.Text);
                dal.AddParam("@Province", txtProvince.Text);
                dal.AddParam("@PostCode", txtPostCode.Text);
                dal.AddParam("@Phone", txtPhone.Text);
                dal.ExecuteProcedure("spClientUpdate");

                BindData();//binds the data
                Clearfields();//Clears all the fields
            }
            catch (Exception ex)
            {
                lblError.Text = "Opps, Cosmic Rays affected the data, please try again later! " + ex.Message;//if something goes wrong this will fire
            }
        }