Inheritance: System.Web.UI.Page
コード例 #1
0
        /// <summary>
        /// EDIT any user view
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns>view</returns>
        public async Task <IActionResult> EditUser(string UserId)
        {
            EditProfile profile = new EditProfile();

            AccountUser user = await userManager.FindByIdAsync(UserId);

            profile.UserProfileVM          = new EidtUserProfileViewModel();
            profile.UserProfileVM.Id       = user.Id;
            profile.UserProfileVM.AboutMe  = user.AboutMe;
            profile.UserProfileVM.FName    = user.FirstName;
            profile.UserProfileVM.LName    = user.LastName;
            profile.UserProfileVM.Gender   = user.Gender;
            profile.UserProfileVM.DOB      = user.DOB;
            profile.UserProfileVM.Email    = user.Email;
            profile.UserProfileVM.UserName = user.UserName;

            profile.SQVM                       = new SecurityQuestionViewModel();
            profile.SQVM.UserId                = user.Id;
            profile.SQVM.QuestionId            = user.SecurityQuestion;
            profile.SQVM.Answer                = user.Answer;
            profile.SQVM.SecurityQuestionsList = new SecurityQuestions().GetSecurityQuestion();

            profile.RSVM = new ResetPasswordViewModel();
            return(View(profile));
        }
コード例 #2
0
        public virtual EditProfile GetProfile(UserProfile userProfile)
        {
            var properties = this.userProfileProvider.GetCustomProperties(userProfile);

            var model = new EditProfile();

            if (properties.ContainsKey(this.FirstName))
            {
                model.FirstName = properties[this.FirstName];
            }
            if (properties.ContainsKey(this.LastName))
            {
                model.LastName = properties[this.LastName];
            }
            if (properties.ContainsKey(this.PhoneNumber))
            {
                model.PhoneNumber = properties[this.PhoneNumber];
            }
            if (properties.ContainsKey(this.Interest))
            {
                model.Interest = properties[this.Interest];
            }

            model.InterestTypes = this.profileSettingsService.GetInterests();

            return(model);
        }
コード例 #3
0
        public async Task <IActionResult> UpdateSQ(EditProfile obj)
        {
            SecurityQuestionViewModel model = obj.SQVM;

            if (ModelState.IsValid)
            {
                AccountUser user = new AccountUser();

                user = await userManager.FindByIdAsync(model.UserId);

                if (user != null)
                {
                    user.SecurityQuestion = model.QuestionId;
                    user.Answer           = model.Answer;


                    var res = await userManager.UpdateAsync(user);

                    if (res.Succeeded)
                    {
                        toastNotification.AddSuccessToastMessage("Security Question Update successfully");
                    }
                    else
                    {
                        toastNotification.AddErrorToastMessage("Some issue to update Security Question ");
                        TempData["Error"] = "Error";
                    }
                }
            }
            return(RedirectToAction("EditUser", new RouteValueDictionary(
                                        new { controller = "Admin", action = "EditUser", UserId = model.UserId })));
        }
コード例 #4
0
        public ActionResult Edit([Bind(Include = "Username, NewEmail, ConfirmPassword")] EditProfile profile)
        {
            var id = Convert.ToInt32(Session["Login"].ToString());

            var user = (from u in db.Users
                        where u.Id == id
                        select u).FirstOrDefault();

            if (ModelState.IsValid)
            {
                // Kiểm tra Email của user muốn đổi đã có trong database chưa
                var count = (from u in db.Users
                             where u.Email == profile.NewEmail
                             select u).Count();
                if (count > 0)
                {
                    ModelState.AddModelError("EmailExist", "Địa chỉ email đã được sử dụng");
                    return(View("Profile", user));
                }
                // Xác minh mật khẩu
                var hashedPassword = Crypto.Hash(profile.ConfirmPassword);
                if (hashedPassword != user.Password)
                {
                    ModelState.AddModelError("ConfirmPasswordError", "Mật khẩu xác nhận không đúng");
                    profile.Username = user.Username;
                    return(View("Edit", profile));
                }
                user.Email           = profile.NewEmail;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                return(View("Profile", user));
            }

            return(View("Profile", user));
        }
コード例 #5
0
        public void showEditProfilePage(ProfileModel profileModel)
        {
            EditProfile editProfilePage = new EditProfile();

            editProfilePage.BindingContext = new EditProfileviewModel(profileModel);
            navigation.PushAsync(editProfilePage);
        }
コード例 #6
0
ファイル: AdminPanel.cs プロジェクト: mahmudmihon/MedicalShop
        private void AdminEditProfile_Click(object sender, EventArgs e)
        {
            EditProfile ep = new EditProfile(userId);

            ep.Show();
            this.Hide();
        }
コード例 #7
0
        void IUnitOfWork.Update(AbstractDomainModel domainModel)
        {
            try
            {
                editProfile = (EditProfile)domainModel;
                //string[] fullName = editProfile.FullName.Split(' ');
                //string firstName = fullName[0];
                //string lastName = string.Empty;
                //for (int i = 1; i < fullName.Length; i++)
                //{
                //    if (i > 1)
                //    { lastName += " "; }
                //    else { lastName += fullName[i]; }
                //}
                Provider provider = new Provider();
                provider.UserId       = editProfile.UserId;
                provider.ProviderId   = editProfile.ProviderId;
                provider.FirstName    = editProfile.FirstName;
                provider.LastName     = editProfile.LastName;
                provider.GenderId     = editProfile.Gender;
                provider.TimeZone     = editProfile.TimeZone;
                provider.MobileNumber = editProfile.MobileNumber;
                //provider.CountryId = editProfile.CountryId;
                //provider.CityId = editProfile.CityId;
                //provider.LocalityId = editProfile.LocalityId;
                provider.ZipCode = editProfile.ZipCode;

                providerRepository.Update(provider);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public async Task <IdentityResult> EditProfileConfirm(EditProfile model)
        {
            ApplicationUser currentUser = new ApplicationUser();

            currentUser = await userManager.FindByEmailAsync(model.Email);

            string uniqueFileName = currentUser.ProfilePicPath;

            currentUser.FirstName   = model.FirstName;
            currentUser.LastName    = model.LastName;
            currentUser.PhoneNumber = model.PhoneNumber;
            currentUser.DOB         = model.DOB;
            currentUser.Bio         = model.Bio;

            if (model.ProfilePic != null)
            {
                string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                uniqueFileName = Guid.NewGuid().ToString() + "_" + model.ProfilePic.FileName;
                string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    model.ProfilePic.CopyTo(fileStream);
                }
            }
            currentUser.ProfilePicPath = uniqueFileName;
            var result = await userManager.UpdateAsync(currentUser);

            return(result);
        }
コード例 #9
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            EditProfile editProfile = new EditProfile(this.usernameLogged);

            editProfile.ShowDialog();
            LoadContent();
        }
コード例 #10
0
        public void UpdatepasswordInValid()
        {
            Actions.UpdatePasswordInValid();
            EditProfile editProfile = new EditProfile();

            Assert.AreEqual(editProfile.ErrorMessageInvalid.Text, Config.UpdatePasswordDetails.UpdatePasswordInvalid.invalidmessage);
        }
コード例 #11
0
        public void UpdatepasswordValid()
        {
            Actions.UpdatePasswordValid();
            EditProfile editProfile = new EditProfile();

            Assert.AreEqual(editProfile.SuccessMessage.Text, Config.UpdatePasswordDetails.UpdatePasswordValid.validmessage);
        }
コード例 #12
0
        public IActionResult Update()
        {
            if (HttpContext.Session.GetString(SessionKeyID) != null && HttpContext.Session.GetString(SessionKeyID) != "")
            {
                EditProfile data = new EditProfile();
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(BaseAPI + "Profile/");
                    ProfileInputModel filter = new ProfileInputModel();
                    filter.UserID = Guid.Parse(HttpContext.Session.GetString(SessionKeyID).ToString());
                    var responseTask = client.PostAsJsonAsync <ProfileInputModel>("GetProfile", filter);
                    responseTask.Wait();

                    var result = responseTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        var content = result.Content.ReadAsStringAsync();
                        ProfileResponseModel resutl = Newtonsoft.Json.JsonConvert.DeserializeObject <ProfileResponseModel>(content.Result);
                        data.val = resutl.data;
                    }
                    else                     //web api sent error response
                    {
                        //log response status here..
                        ModelState.AddModelError(string.Empty, "Terjadi kesalahan server. Hubungi admin.");
                    }
                }
                return(View(data));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Terjadi kesalahan server. Hubungi admin.");
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,Password")] EditProfile editProfile)
        {
            if (id != editProfile.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(editProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EditProfileExists(editProfile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(editProfile));
        }
コード例 #14
0
        /// <summary>
        /// EDIT profile of current USER
        /// </summary>
        /// <returns>view</returns>
        public async Task <IActionResult> EditProfile()
        {
            //ERROR if something went wrong
            if (TempData["Errors"] != null)
            {
                ViewBag.Errors = TempData["Errors"].ToString();
            }

            EditProfile profile = new EditProfile();
            AccountUser user    = new AccountUser();

            //EDIT any filed
            if (User.Identity.IsAuthenticated)
            {
                user = await userManager.GetUserAsync(User);

                profile.UserProfileVM          = new EidtUserProfileViewModel();
                profile.UserProfileVM.AboutMe  = user.AboutMe;
                profile.UserProfileVM.FName    = user.FirstName;
                profile.UserProfileVM.LName    = user.LastName;
                profile.UserProfileVM.Gender   = user.Gender;
                profile.UserProfileVM.DOB      = user.DOB;
                profile.UserProfileVM.Email    = user.Email;
                profile.UserProfileVM.UserName = user.UserName;

                profile.SQVM                       = new SecurityQuestionViewModel();
                profile.SQVM.QuestionId            = user.SecurityQuestion;
                profile.SQVM.Answer                = user.Answer;
                profile.SQVM.SecurityQuestionsList = new SecurityQuestions().GetSecurityQuestion();

                profile.RSVM = new ResetPasswordViewModel();
            }
            return(View(profile));
        }
コード例 #15
0
        public Task <EditProfile> GetEditProfile(int UserID)
        {
            return(Task.Run(() =>
            {
                using (MIUEntities db = new MIUEntities())
                {
                    try
                    {
                        User data = db.Users.Where(x => x.IsDelete != true && x.ID == UserID).SingleOrDefault();
                        EditProfile info = new EditProfile();
                        BatchInfo batchInfo = new BatchInfo();
                        CourseInfo courseInfo = new CourseInfo();
                        if (data != null)
                        {
                            PropertyCopier <User, EditProfile> .Copy(data, info);
                            if (data.DOB != null)
                            {
                                info.DOB = data.DOB.Value.Date;
                            }
                            if (!string.IsNullOrEmpty(data.ProfilePicture))
                            {
                                info.FileName = MIUFileServer.GetFileUrl("ProfileImages", data.ProfilePicture);
                            }
                        }
                        ;

                        return info;
                    }
                    catch (Exception)
                    {
                        return null;
                    }
                }
            }));
        }
コード例 #16
0
        public async Task <HttpResponseMessage> GetEditProfile(int UserID)
        {
            try
            {
                ProfileDAL  dal  = new ProfileDAL();
                EditProfile data = await dal.GetEditProfile(UserID);

                if (data != null)
                {
                    return(Request.CreateResponse <EditProfile>(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
コード例 #17
0
        public async Task <HttpResponseMessage> EditProfile(EditProfile editProfile)
        {
            try
            {
                ProfileDAL   dal      = new ProfileDAL();
                JsonResponse response = await dal.EditProfile(editProfile);

                if (response != null && response.Flag)
                {
                    return(Request.CreateResponse <JsonResponse>(HttpStatusCode.OK, response));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
コード例 #18
0
        public ActionResult EditProfile()
        {
            EditProfile model = _unityContainer.Resolve <EditProfile>();

            model.Ready();
            return(View(new EcardModelItem <EditProfile>(model)));
        }
コード例 #19
0
ファイル: ProfileService.cs プロジェクト: 24RMS42/SIDE
        public async Task <ServiceResult> GetProfileDetails(string userId)
        {
            var userDb = await DbManager.UserRepository.GetUser(userId);

            var instrumentDb = await DbManager.InstrumentRepository.GetInstrument(userId);

            if (userDb != null)
            {
                //var basicInfo = AutoMapper.Mapper.Map<CertificateBasicInfo>(certificateDb);
                var user         = userDb;
                var instrument   = instrumentDb ?? new Instrument();
                var userLogoPath = await DbManager.UserRepository.GetUserLogoImageWithPath(user);

                var editProfile = new EditProfile
                {
                    User         = user,
                    Instrument   = instrument,
                    UserLogoPath = userLogoPath
                };

                return(new SuccessServiceResult {
                    ResultObject = editProfile
                });
            }


            return(new FalseServiceResult("Response is null"));
        }
コード例 #20
0
        public string UserDetailsUpdate(EditProfile Info)
        {
            string Result = string.Empty;

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    string     query = @" Update admin.Users set Email=@Email, Password=@Password where UID=@UID";
                    SqlCommand com   = new SqlCommand(query, con);
                    com.Parameters.AddWithValue("@Email", Info.UserDetails.Email);
                    com.Parameters.AddWithValue("@Password", Info.UserDetails.Password);
                    con.Open();
                    if (com.ExecuteNonQuery() > 0)
                    {
                        Result = " User Profile Updated ";
                    }
                    else
                    {
                        Result = "Failed!";
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
            }
            return(Result);
        }
コード例 #21
0
        public ActionResult UpdateProfile(EditProfile data)
        {
            string userID = HttpContext.Session.GetString(SessionKeyID);
            EditProfileInputModel dataProfile = new EditProfileInputModel();

            dataProfile          = data.input;
            dataProfile.EmailPIC = dataProfile.UserName;
            dataProfile.UserID   = Guid.Parse(HttpContext.Session.GetString(SessionKeyID).ToString());
            JsonConvert.SerializeObject(dataProfile);
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseAPI + "Profile/");
                //HTTP POST
                var postTask = client.PostAsJsonAsync <EditProfileInputModel>("EditProfile", dataProfile);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            ModelState.AddModelError(string.Empty, "Terjadi kesalahan. Mohon hubungi admin.");
            return(RedirectToAction("Update", "Profile"));
        }
コード例 #22
0
        public void SetProfile(EditProfile editProfileModel)
        {
            if (this.contactProfileProvider.Contact == null)
            {
                return;
            }
            var personalInfo = this.contactProfileProvider.PersonalInfo;

            if (!string.IsNullOrEmpty(editProfileModel.FirstName))
            {
                personalInfo.FirstName = editProfileModel.FirstName;
            }

            if (!string.IsNullOrEmpty(editProfileModel.LastName))
            {
                personalInfo.Surname = editProfileModel.LastName;
            }

            if (!string.IsNullOrEmpty(editProfileModel.Gender))
            {
                personalInfo.Gender = editProfileModel.Gender;
            }

            this.SetTag(InterestsTagName, editProfileModel.Interest ?? string.Empty);
            this.SetPreferredPhoneNumber(editProfileModel.PhoneNumber);
            this.SetPreferredEmail(Context.User.Profile.Email);
            this.contactProfileProvider.Flush();
        }
コード例 #23
0
        public void EditProfileValid()
        {
            Actions.EditProfileValid();
            EditProfile editProfile = new EditProfile();

            Assert.AreEqual(editProfile.SuccessMessage.Text, Config.EditProfileDetails.ValidEditProfileDetails.success);
        }
コード例 #24
0
        public async Task <IActionResult> UpdateProfile(EditProfile obj)
        {
            EidtUserProfileViewModel model = obj.UserProfileVM;

            if (ModelState.IsValid)
            {
                AccountUser user = new AccountUser();

                user = await userManager.FindByIdAsync(model.Id);

                if (user != null)
                {
                    user.FirstName = model.FName;
                    user.LastName  = model.LName;
                    user.Gender    = model.Gender;
                    user.AboutMe   = model.AboutMe;
                    user.DOB       = model.DOB;

                    var res = await userManager.UpdateAsync(user);

                    if (res.Succeeded)
                    {
                        toastNotification.AddSuccessToastMessage("Profile Update successfully");
                    }
                    else
                    {
                        toastNotification.AddErrorToastMessage("Some issue to update Profile");
                        ModelState.AddModelError(String.Empty, "Error");
                    }
                }
            }

            return(RedirectToAction("EditUser", new RouteValueDictionary(
                                        new { controller = "Admin", action = "EditUser", UserId = model.Id })));
        }
コード例 #25
0
        public async Task <IActionResult> UpdateSQ(EditProfile obj)
        {
            SecurityQuestionViewModel model = obj.SQVM;

            if (ModelState.IsValid)
            {
                AccountUser user = new AccountUser();
                //IF user is correct and inputs are correct proceed to update
                if (User.Identity.IsAuthenticated)
                {
                    user = await userManager.GetUserAsync(User);

                    if (user != null)
                    {
                        user.SecurityQuestion = model.QuestionId;
                        user.Answer           = model.Answer;

                        var res = await userManager.UpdateAsync(user);

                        if (res.Succeeded)
                        {
                            toastNotification.AddSuccessToastMessage("Security Question Update Successfully.");
                        }
                        //GIVE an error if something is wrong
                        else
                        {
                            toastNotification.AddSuccessToastMessage("Some issue to updating Security Question.");
                            ModelState.AddModelError(String.Empty, "Error");
                        }
                    }
                }
            }

            return(RedirectToAction("EditProfile"));
        }
コード例 #26
0
        private void editProfileBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form next = new EditProfile();

            next.ShowDialog();
            this.Close();
        }
コード例 #27
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        objBEL      = new StudentBEL();
        objBEL.pass = TextBox11.Text;
        objDAL      = new EditProfile();

        objDAL.EditStudPassword(TextBox11.Text, objBEL);
    }
コード例 #28
0
    protected void Button7_Click(object sender, EventArgs e)
    {
        objBEL       = new TeacherBEL();
        objBEL.uname = TextBox16.Text;
        objDAL       = new EditProfile();

        objDAL.EditTeacherUsername(TextBox17.Text, objBEL);
    }
コード例 #29
0
    protected void Button7_Click(object sender, EventArgs e)
    {
        objBEL        = new StudentBEL();
        objBEL.usernm = TextBox16.Text;
        objDAL        = new EditProfile();

        objDAL.EditStudUsername(TextBox17.Text, objBEL);
    }
コード例 #30
0
        private void eDITPROFILEToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DisposeAllButThis();
            EditProfile EP = new EditProfile(lbshwuser.Text);

            EP.MdiParent = this;
            EP.Show();
        }
コード例 #31
0
ファイル: AccountController.cs プロジェクト: nathanmarlor/DSU
        /// <summary>
        /// GET edit profile
        /// </summary>
        /// <returns>Action</returns>
        public ActionResult EditProfile()
        {
            if (string.IsNullOrEmpty(userName))
            {
                return View("LogOn");
            }

            var user = memberDataAccess.GetUser(userName);

            EditProfile editProfile = new EditProfile()
                {
                    UserName = user.UserName,
                    Email = user.Email,
                    ProfilePicturePath = user.ProfilePicture
                };

            return View(editProfile);
        }
コード例 #32
0
ファイル: AccountController.cs プロジェクト: nathanmarlor/DSU
        public ActionResult EditProfile(EditProfile model)
        {
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(userName))
                {
                    return View("LogOn");
                }

                log.Debug("Updating profile for user: {0}", userName);

                var user = new User { UserName = userName, Email = model.Email };

                if (!string.IsNullOrWhiteSpace(model.Password))
                {
                    user.Password = hash.HashString(model.Password);
                }

                user.ProfilePicture = this.SaveImage(model.ProfilePicture);

                model.UserName = user.UserName;

                try
                {
                    memberDataAccess.UpdateUser(user);
                }
                catch (MemberDatabaseException e)
                {
                    log.Warn(e, "An error occurred whilst trying to register user: {0}", model.UserName);
                    ModelState.AddModelError("System", "An error occurred whilst attempting to update your profile - please try again later");
                    return View(model);
                }
            }

            return PartialView("EditProfileSuccess");
        }
コード例 #33
0
ファイル: Welcome.cs プロジェクト: francescajohnson/IPIMS_9
 private void editProfileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     EditProfile formEditP = new EditProfile();
     formEditP.Visible = true;
 }