protected override void ValidateRequest() { base.ValidateRequest(); if (IsUpdate) { CheckPublicDemo(Row.UserId); if (Row.IsAssigned(fld.Password) && !Row.Password.IsEmptyOrNull()) { password = Row.Password = ValidatePassword(Old.Username, Row.Password, false); } if (Row.Username != Old.Username) { Row.Username = MySaveHandler.ValidateUsername(this.Connection, Row.Username, Old.UserId.Value); } if (Row.DisplayName != Old.DisplayName) { Row.DisplayName = ValidateDisplayName(this.Connection, Row.DisplayName, Old.UserId.Value); } } if (IsCreate) { this.Row.Username = ValidateUsername(this.Connection, this.Row.Username, null); this.Row.DisplayName = ValidateDisplayName(this.Connection, this.Row.DisplayName, null); password = ValidatePassword(Row.Username, Row.Password, true); } }
protected override void ValidateRequest() { base.ValidateRequest(); if (IsUpdate) { var user = (UserDefinition)Authorization.UserDefinition; if (Old.TenantId != user.TenantId) Authorization.ValidatePermission(PermissionKeys.Tenants); CheckPublicDemo(Row.UserId); if (Row.IsAssigned(fld.Password) && !Row.Password.IsEmptyOrNull()) password = Row.Password = ValidatePassword(Old.Username, Row.Password, false); if (Row.Username != Old.Username) Row.Username = MySaveHandler.ValidateUsername(this.Connection, Row.Username, Old.UserId.Value); if (Row.DisplayName != Old.DisplayName) Row.DisplayName = ValidateDisplayName(this.Connection, Row.DisplayName, Old.UserId.Value); } if (IsCreate) { this.Row.Username = ValidateUsername(this.Connection, this.Row.Username, null); this.Row.DisplayName = ValidateDisplayName(this.Connection, this.Row.DisplayName, null); password = ValidatePassword(Row.Username, Row.Password, true); } }
public SaveResponse Create(IUnitOfWork uow, SaveRequest <MyRow> request) { var res = new MySaveHandler().Process(uow, request, SaveRequestType.Create); if (res.Error == null) { new OnInsert().UpdateCashInHand(uow, request.Entity.SaleDate, request.Entity.CashAmount, 0); } return(res); }