public ActionResult Edit(int id, bool wantClose) { var convInOut = convInOutRepo.GetOne(id); this.convInOutRepo.CurrentUserName = HttpContext.User.Identity.Name; try { UpdateModel(convInOut); convInOutRepo.DoSave(convInOut, false); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id = id })); } return(RedirectToAction("Index2")); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doEdit(convInOut)); }
public ActionResult Delete(int id) { ConveyanceInOut convInOut = convInOutRepo.GetOne(id); if (convInOut != null) { try { //Delete the record convInOutRepo.DoDelete(convInOut); new RecordDeletedEvent("ConveyanceInOut", convInOut.Id, 0, convInOut.Code, convInOut.Conveyance.Name, null).Raise(); TempData.AddInfo(Resources.Messages.DeleteSuccess + " (" + convInOut.Code + "-" + convInOut.Conveyance.Name + ")"); } catch (Exception ex) { TempData.AddError(ex.ExMessage()); return(RedirectToAction("Edit", new { id = id })); } } else { TempData.AddError(Resources.Messages.NotFoundData); } return(RedirectToAction("Index2")); }
public ActionResult Insert(Staying90Day stay, bool wantClose) { //Staying90Day stay = new Staying90Day(); this.stayRepo.CurrentUserName = HttpContext.User.Identity.Name; try { stayRepo.DoNewRecord(stay); UpdateModel(stay); stayRepo.DoSave(stay, true); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id = stay.Id })); } return(RedirectToAction("Index2")); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doInsert(stay)); }
public ActionResult Insert(ConveyanceInOut convInOut, bool wantClose) { //ConveyanceInOut convInOut = new ConveyanceInOut(); this.convInOutRepo.CurrentUserName = HttpContext.User.Identity.Name; try { convInOutRepo.DoNewRecord(convInOut); UpdateModel(convInOut); convInOutRepo.DoSave(convInOut, true); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id = convInOut.Id })); } return(RedirectToAction("Index2")); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doInsert(convInOut)); }
public ActionResult Delete(int id, int addRemoveType) { AddRemoveCrew addRemoveCrew = addRemoveCrewRepo.GetOne(id, addRemoveType); if (addRemoveCrew != null) { try { //Delete the record addRemoveCrewRepo.DoDelete(addRemoveCrew); new RecordDeletedEvent("AddRemoveCrew", addRemoveCrew.Id, 0, addRemoveCrew.Code, addRemoveCrew.Alien.Name.FullName, null).Raise(); TempData.AddInfo(Resources.Messages.DeleteSuccess + " (" + addRemoveCrew.Code + "-" + addRemoveCrew.Alien.Name.FullName + ")"); } catch (Exception ex) { TempData.AddError(ex.ExMessage()); return(RedirectToAction("Edit", new { id, addRemoveType })); } } else { TempData.AddError(Resources.Messages.NotFoundData); } return(RedirectToAction("Index2", new { addRemoveType })); }
public ActionResult Delete(int id) { Staying90Day stay = stayRepo.GetOne(id); if (stay != null) { try { //Delete the record stayRepo.DoDelete(stay); new RecordDeletedEvent("Staying90Day", stay.Id, 0, stay.Code, stay.Alien.Name.FullName, null).Raise(); TempData.AddInfo(Resources.Messages.DeleteSuccess + " (" + stay.Code + "-" + stay.Alien.Name.FullName + ")"); } catch (Exception ex) { TempData.AddError(ex.ExMessage()); return(RedirectToAction("Edit", new { id = id })); } } else { TempData.AddError(Resources.Messages.NotFoundData); } return(RedirectToAction("Index2")); }
public ActionResult Delete(int id) { VisaDetail visa = visaRepo.GetOne(id); if (visa != null) { try { //Delete the record visaRepo.DoDelete(visa); new RecordDeletedEvent("VisaDetail", visa.Id, 0, visa.Code, visa.Alien.Name.FullName, null).Raise(); TempData.AddInfo(Resources.Messages.DeleteSuccess + " (" + visa.Code + "-" + visa.Alien.Name.FullName + ")"); } catch (Exception ex) { TempData.AddError(ex.ExMessage()); return(RedirectToAction("Edit", new { id = id })); } } else { TempData.AddError(Resources.Messages.NotFoundData); } return(RedirectToAction("Index2")); }
public ActionResult Edit(int id, bool wantClose, int addRemoveType) { var addRemoveCrew = addRemoveCrewRepo.GetOne(id, addRemoveType); this.addRemoveCrewRepo.CurrentUserName = HttpContext.User.Identity.Name; try { UpdateModel(addRemoveCrew); addRemoveCrewRepo.DoSave(addRemoveCrew, false, addRemoveType); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id, addRemoveType })); } return(RedirectToAction("Index2", new { addRemoveType })); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doEdit(addRemoveCrew, addRemoveType)); }
public ActionResult Delete(int id) { Endorse endorse = endorseRepo.GetOne(id); if (endorse != null) { try { //Delete the record endorseRepo.DoDelete(endorse); new RecordDeletedEvent("Endorse", endorse.Id, 0, endorse.Code, endorse.Alien.Name.FullName, null).Raise(); TempData.AddInfo(Resources.Messages.DeleteSuccess + " (" + endorse.Code + "-" + endorse.Alien.Name.FullName + ")"); } catch (Exception ex) { TempData.AddError(ex.ExMessage()); return(RedirectToAction("Edit", new { id = id })); } } else { TempData.AddError(Resources.Messages.NotFoundData); } return(RedirectToAction("Index2")); }
public ActionResult Insert(VisaDetail visa, bool wantClose) { //VisaDetail visa = new VisaDetail(); this.visaRepo.CurrentUserName = HttpContext.User.Identity.Name; try { visaRepo.DoNewRecord(visa); UpdateModel(visa); visaRepo.DoSave(visa, true); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id = visa.Id })); } return(RedirectToAction("Index2")); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doInsert(visa)); }
public ActionResult Insert(Endorse endorse, bool wantClose) { //Endorse endorse = new Endorse(); this.endorseRepo.CurrentUserName = HttpContext.User.Identity.Name; try { endorseRepo.DoNewRecord(endorse); UpdateModel(endorse); endorseRepo.DoSave(endorse, true); TempData.AddInfo(Resources.Messages.SaveSuccess); if (!wantClose) { return(RedirectToAction("Edit", new { id = endorse.Id })); } return(RedirectToAction("Index2")); } catch (RulesException ex) { ex.CopyTo(ModelState); TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } catch (Exception ex) { TempData.AddWarning(Resources.Messages.SaveError + ex.ExMessage()); } return(doInsert(endorse)); }
public RedirectToRouteResult Details(Guid id, string email, string comments) { var user = _userService.Get(id); user.Email = email; user.Comment = comments; _userService.Update(user); TempData.AddInfo(Resources.Messages.SaveSuccess); return(RedirectToAction("Details", new { id })); }
public RedirectToRouteResult ResetPasswordWithAnswer(Guid id, string answer) { var user = _userService.Get(id); var newPassword = _passwordService.ResetPassword(user, answer); var body = string.Format(ResetPasswordBody, new string[] { user.UserName, newPassword, Request.Url.GetLeftPart(UriPartial.Authority) }); _smtpClient.Send(new MailMessage(ResetPasswordFromAddress, user.Email, ResetPasswordSubject, body)); TempData.AddInfo(Resources.Messages.ActionSuccess); return(RedirectToAction("Password", new { id })); }
public RedirectToRouteResult SetPassword(Guid id, string password) { var user = _userService.Get(id); try { _passwordService.ChangePassword(user, password); var body = string.Format(ResetPasswordBody, new string[] { user.UserName, password, Request.Url.GetLeftPart(UriPartial.Authority) }); _smtpClient.Send(new MailMessage(ResetPasswordFromAddress, user.Email, ResetPasswordSubject, body)); TempData.AddInfo(Resources.Messages.ActionSuccess); } catch (Exception ex) { TempData.AddError(Resources.Messages.SaveError + ex.ExMessage()); } return(RedirectToAction("Password", new { id })); }
public RedirectToRouteResult UsersProfiles(Guid id, string Profile_FirstName, string Profile_LastName, string Profile_Position, string Profile_Phone, string Profile_Fax, string Profile_Culture, int Profile_PageSize, int Profile_MainScreenHeight) { var user = _userService.Get(id); ProfileCommon profile = ProfileCommon.GetProfile(user.UserName); if (ModelState.IsValid) { try { profile.FirstName = Profile_FirstName; profile.LastName = Profile_LastName; profile.Position = Profile_Position; profile.Phone = Profile_Phone; profile.Fax = Profile_Fax; profile.Culture = Profile_Culture == "-" ? "" : Profile_Culture.Trim(); profile.PageSize = Profile_PageSize; profile.MainScreenHeight = Profile_MainScreenHeight; profile.Save(); TempData.AddInfo(Resources.Messages.SaveSuccess); if (user.UserName == HttpContext.User.Identity.Name) { //Globals.ReadProfileToGlobals(user.UserName, true); ProfileRepository.ClearCurrentProfile(); } return(RedirectToAction("UsersProfiles", new { id })); } catch (Exception ex) { TempData.AddError(Resources.Messages.SaveError + ex.ExMessage()); } } return(RedirectToAction("UsersProfiles", new { id })); }