//Allows paging, splitting the data up into smaller groups
 //so you go to the next page to see the data,
 //like a book, instead of seeing all the data on one long page
 protected void LoginGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
     LoginGridView.DataSource = dal.ExecuteProcedure("spLoginSelect");
     LoginGridView.PageIndex  = e.NewPageIndex;
     LoginGridView.DataBind();
 }
Beispiel #2
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");
 }
 //Allows paging, splitting the data up into smaller groups
 //so you go to the next page to see the data,
 //like a book, instead of seeing all the data on one long page
 protected void LoginGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
     LoginGridView.DataSource = dal.ExecuteProcedure("spLoginSelect");
     LoginGridView.PageIndex = e.NewPageIndex;
     LoginGridView.DataBind();
 }
Beispiel #4
0
        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
            }
        }
Beispiel #5
0
        private DataSet RefreshPictureGrid()
        {
            string name = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;

            DAL_Project.DAL dal = new DAL_Project.DAL(name);
            return(dal.ExecuteProcedure("spGetPictures"));
        }
Beispiel #6
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");
 }
Beispiel #7
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");
        }
Beispiel #8
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"));
        }
        private void BindData()
        {
            DAL_Project.DAL d  = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
            DataSet         ds = new DataSet();

            LoginGridView.DataSource = d.ExecuteProcedure("spLoginSelect");
            LoginGridView.DataBind();
        }
Beispiel #10
0
 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 btnEdit_Click(object sender, EventArgs e)
 {
     if (txtloginID.Text == "")                        // if no LoginId is in the textbox...
     {
         lblError.Text = "Please select a Log first!"; //the label with say this
     }
     else//but if there is a LoginId in the textbox...
     {
         pnlEditDelete.Visible = false;//Off
         DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
         DataSet         ds  = new DataSet();
         dal.ExecuteProcedure("spLoginSelect");
         pnlLogFields.Visible = true;//On
     }
 }
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     if (txtloginID.Text == "")// if no LoginId is in the textbox...
     {
         lblError.Text = "Please select a Log first!";//the label with say this
     }
     else//but if there is a LoginId in the textbox...
     {
         pnlEditDelete.Visible = false;//Off
         DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
         DataSet ds = new DataSet();
         dal.ExecuteProcedure("spLoginSelect");
         pnlLogFields.Visible = true;//On
     }
 }
 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 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;
        }
        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
            }
        }
Beispiel #16
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
     }
 }
Beispiel #17
0
 //when the edit button is clicked...
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     if (txtClientID.Text == "")// if no ClientId is in the textbox...
     {
         lblError.Text = "Please select a Client first!";//the label with say this
     }
     else//but if there is a ClientId in the textbox...
     {
         pnlEditDelete.Visible = false;//Off
         pnlEditingClient.Visible = true;//On
         DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
         DataSet ds = new DataSet();
         dal.ExecuteProcedure("spClientSelect");
         pnlClientFields.Visible = true;//On
     }
 }
        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 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;
        }
        protected void ErrorGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ErrorGridView.SelectedIndex = Convert.ToInt32(e.CommandArgument.ToString());
            int ErrorID = Convert.ToInt32(ErrorGridView.SelectedValue.ToString());

            if (e.CommandName == "Select Error")
            {
                DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                DataSet ds = new DataSet();
                d.ExecuteProcedure("spErrorSelect");
                FillFields(ds);
                SetEnabled(true);

                txtErrorID.Text = ErrorGridView.SelectedRow.Cells[1].Text;
                txtErrorMessage.Text = ErrorGridView.SelectedRow.Cells[2].Text;
                txtClientID.Text = ErrorGridView.SelectedRow.Cells[3].Text;
                txtItemSaleID.Text = ErrorGridView.SelectedRow.Cells[4].Text;
                txtErrorTime.Text = ErrorGridView.SelectedRow.Cells[5].Text;
            }
            BindData();
        }
        //When the Select is clicked, enables the fields to be filled, fills the fields, clears the error label if needed
        protected void LoginGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            LoginGridView.SelectedIndex = Convert.ToInt32(e.CommandArgument.ToString());
            int LoginID = Convert.ToInt32(LoginGridView.SelectedValue.ToString());

            if (e.CommandName == "Select Log")// if the Select Button is clicked on the GridView
            {
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
                DataSet         ds  = new DataSet();
                ds = dal.ExecuteProcedure("spLoginSelect");
                FillFields(ds);                                                 //Fills all the fields
                SetEnabled(true);                                               //Enables the fields to be filled

                pnlLogFields.Visible = true;                                    //makes all the fields visible
                txtloginID.Text      = LoginGridView.SelectedRow.Cells[1].Text; //will input data from the corresponding cell in the database to the textbox
                txtuserName.Text     = LoginGridView.SelectedRow.Cells[2].Text; //will input data from the corresponding cell in the database to the textbox
                txtloginSuccess.Text = LoginGridView.SelectedRow.Cells[3].Text; //will input data from the corresponding cell in the database to the textbox
                txtlogDate.Text      = LoginGridView.SelectedRow.Cells[4].Text; //will input data from the corresponding cell in the database to the textbox
                lblError.Text        = "";                                      //if the lblError was fired will clear the message
            }
            BindData();
        }
        //When the Select is clicked, enables the fields to be filled, fills the fields, clears the error label if needed
        protected void LoginGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            LoginGridView.SelectedIndex = Convert.ToInt32(e.CommandArgument.ToString());
            int LoginID = Convert.ToInt32(LoginGridView.SelectedValue.ToString());

            if (e.CommandName == "Select Log")// if the Select Button is clicked on the GridView
            {
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
                DataSet ds = new DataSet();
                ds = dal.ExecuteProcedure("spLoginSelect");
                FillFields(ds);//Fills all the fields
                SetEnabled(true);//Enables the fields to be filled

                pnlLogFields.Visible = true;//makes all the fields visible
                txtloginID.Text = LoginGridView.SelectedRow.Cells[1].Text;//will input data from the corresponding cell in the database to the textbox
                txtuserName.Text = LoginGridView.SelectedRow.Cells[2].Text;//will input data from the corresponding cell in the database to the textbox
                txtloginSuccess.Text = LoginGridView.SelectedRow.Cells[3].Text;//will input data from the corresponding cell in the database to the textbox
                txtlogDate.Text = LoginGridView.SelectedRow.Cells[4].Text;//will input data from the corresponding cell in the database to the textbox
                lblError.Text = "";//if the lblError was fired will clear the message
            }
            BindData();
        }
Beispiel #23
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
            }
        }
 private void BindData()
 {
     DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
     DataSet ds = new DataSet();
     ErrorGridView.DataSource = d.ExecuteProcedure("spErrorSelect");
     ErrorGridView.DataBind();
 }
Beispiel #25
0
 private DataSet RefreshPictureGrid()
 {
     string name = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
     DAL_Project.DAL dal = new DAL_Project.DAL(name);
     return dal.ExecuteProcedure("spGetPictures");
 }
Beispiel #26
0
 //Allows paging, splitting the data up into smaller groups
 //so you go to the next page to see the data,
 //like a book, instead of seeing all the data on one long page
 protected void ClientGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
     ClientGridView.DataSource = dal.ExecuteProcedure("spClientSelect");
     ClientGridView.PageIndex = e.NewPageIndex;
     ClientGridView.DataBind();
 }
Beispiel #27
0
        //When the Select is clicked, enables the fields to be filled, fills the fields, clears the error label if needed
        protected void ClientGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ClientGridView.SelectedIndex = Convert.ToInt32(e.CommandArgument.ToString());
            int ClientID = Convert.ToInt32(ClientGridView.SelectedValue.ToString());

            if (e.CommandName == "Select Client")// if the Select Button is clicked on the GridView
            {
                DAL_Project.DAL dal = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                DataSet ds = new DataSet();
                ds = dal.ExecuteProcedure("spClientSelect");
                FillFields(ds);//Fills all the fields
                SetEnabled(true);//Enables the fields to be filled

                pnlClientFields.Visible = true;//makes all the fields visible
                txtClientID.Text = ClientGridView.SelectedRow.Cells[1].Text;//will input data from the corresponding cell in the database to the textbox
                txtfName.Text = ClientGridView.SelectedRow.Cells[2].Text;//will input data from the corresponding cell in the database to the textbox
                txtlName.Text = ClientGridView.SelectedRow.Cells[3].Text;//will input data from the corresponding cell in the database to the textbox
                txtAddress.Text = ClientGridView.SelectedRow.Cells[4].Text;//will input data from the corresponding cell in the database to the textbox
                txtCity.Text = ClientGridView.SelectedRow.Cells[5].Text;//will input data from the corresponding cell in the database to the textbox
                txtProvince.Text = ClientGridView.SelectedRow.Cells[6].Text;//will input data from the corresponding cell in the database to the textbox
                txtPostCode.Text = ClientGridView.SelectedRow.Cells[7].Text;//will input data from the corresponding cell in the database to the textbox
                txtPhone.Text = ClientGridView.SelectedRow.Cells[8].Text;//will input data from the corresponding cell in the database to the textbox
                lblError.Text = "";//if the lblError was fired will clear the message
            }
            BindData();
        }
 private void BindData()
 {
     DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbExerciseForScott1;Integrated Security=SSPI");
     DataSet ds = new DataSet();
     LoginGridView.DataSource = d.ExecuteProcedure("spLoginSelect");
     LoginGridView.DataBind();
 }