/// <summary> /// Performs the password validation rules. If validation fails an exception is raised from the /// ValidateUserPassword method. If validation succeeds, but the password was changed /// to an empty string that result is returned, which will be displayed to the UI. /// </summary> /// <param name="form">The change password form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void btnSave_OnClick(IUserChangePassword form, EventArgs args) { string newPassword = form.txtNewPassword.Text; if (newPassword.Equals(form.txtConfirmPassword.Text)) { IUser user = (IUser)form.usrUser.LookupResultValue; if (user.ValidateUserPassword(newPassword)) { Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>(); user.SavePassword(newPassword); form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty; if (newPassword.Length == 0) { ds.ShowMessage(form.GetResource("PasswordBlank").ToString()); } else { ds.ShowMessage(form.GetResource("PasswordChanged").ToString()); } ds.CloseEventHappened(form, null); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } } } else { throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString()); } }
public static void btnInsert_OnClick(IAccountingSystems form, EventArgs args) { Sage.Platform.WebPortal.Services.IWebDialogService DialogService = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>(true); DialogService.SetSpecs(550, 885, "AddEditAccountingSystem", form.GetResource("AddEndPoint_Caption").ToString()); DialogService.EntityType = typeof(IAppIdMapping); DialogService.EntityID = "Insert"; DialogService.ShowDialog(); }
/// <summary> /// Invokes the Quick Insert Account view. /// </summary> /// <param name="form">The Insert Sales Order form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void btnAddNewAccount_OnClickStep(IInsertSalesOrder form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.Services.IWebDialogService dialogService = smartpart.DialogService; if (dialogService != null) { dialogService.SetSpecs(20, 20, 300, 800, "QuickInsertAccountContact", "", true); dialogService.EntityType = typeof(IContact); dialogService.ShowDialog(); } }
public static void lueAddUser_OnChangeStep(IOthersAccessToUserCal form, EventArgs args) { IUser user = form.CurrentEntity as IUser; IUser userwantingaccess = form.lueAddUser.LookupResultValue as IUser; if (!user.UserCalendarExists(userwantingaccess)) { user.AddUserCalendar(userwantingaccess); Sage.Platform.WebPortal.Services.IWebDialogService dialogService = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>(); dialogService.SetSpecs(235, 420, "EditCalPermissions"); dialogService.EntityType = typeof(Sage.Entity.Interfaces.IUserCalendar); dialogService.CompositeKeyNames = "UserId, CalUserId"; dialogService.EntityID = string.Format("{0},{1}", userwantingaccess.Id, user.Id); dialogService.ShowDialog(); } //else //throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_CalendarAccessAlreadyExists").ToString()); }
/// <summary> /// Performs the password validation rules. If validation fails an exception is raised from the /// ValidateUserPassword method. If validation succeeds, but the password was changed /// to an empty string that result is returned, which will be displayed to the UI. /// </summary> /// <param name="form">The change password form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void btnSave_OnClick(IUserChangePassword form, EventArgs args) { string newPassword = form.txtNewPassword.Text; if (newPassword.Equals(form.txtConfirmPassword.Text)) { IUser user = (IUser)form.CurrentEntity; if (user.ValidateUserPassword(newPassword)) { Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>(); user.SavePassword(newPassword); var slxUserService = (ISlxUserService)ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>(true); var currentUser = slxUserService.GetUser(); if (user.UserName == currentUser.UserName) { var data = (Sage.SalesLogix.SLXDataService)ApplicationContext.Current.Services.Get <IDataService>(true); var auth = (Sage.SalesLogix.Web.SLXWebAuthenticationProvider)data.AuthenticationProvider; auth.AuthenticateWithContext(currentUser.UserName, newPassword); } form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty; if (newPassword.Length == 0) { ds.ShowMessage(form.GetResource("PasswordBlank").ToString()); } else { ds.ShowMessage(form.GetResource("PasswordChanged").ToString()); } ds.CloseEventHappened(form, null); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } } } else { throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString()); } }