Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                decimal userID = Convert.ToDecimal(Session["userID"]);
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    userDetail objProNew = objEntity.userDetails.FirstOrDefault(Pro => Pro.userID == userID);
                    if (objProNew != null)
                    {
                        objProNew.state = txtState.Text;

                        objProNew.addressLine1 = txtAddLine1.Text;
                        objProNew.addressLine2 = txtAddressLine2.Text;
                        objProNew.city         = txtCity.Text;
                        objProNew.firstName    = txtFName.Text;
                        objProNew.lastName     = txtLName.Text;

                        objProNew.contactNumber = txtContact.Text;
                        objProNew.userPass      = StringCipher.EncryptStringAES(txtPass.Text);
                        objProNew.DOB           = Convert.ToDateTime(txtDOB.Text);

                        objEntity.SaveChanges();

                        string filename = objProNew.userID.ToString() + ".jpg";
                        flPhoto.SaveAs(Server.MapPath("~/userData/userPic/" + filename));


                        Response.Redirect("~/adUsers.aspx", false);
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "User Save");
                liVal.Text = ex.Message;
            }
        }