public UserManagementCore(DBManager dbManager) { _db = dbManager.NewTableConnection <DetailedUser>("User"); if (!_db.Exists("Username", "admin")) { _db.Add(GetNewAdmin()); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtDataBaseName.Text) || string.IsNullOrWhiteSpace(txtDataBaseName.Text)) { DxErrorProvider1.SetError(txtDataBaseName, "The Table name is empty"); } else { DxErrorProvider1.Clear(); if (db == null) { Table TableNew = new Table { TableId = dv.Tables.Count + 1, TableName = txtTableName.Text, Description = txtDescription.Text }; TableManager.Add(dv, TableNew); if (eventTableChanged != null) { eventTableChanged(TableNew); } Close(); } else { db.TableId = short.Parse(txtTableId.Text); db.TableName = txtTableName.Text; db.Description = txtDescription.Text; TableManager.Update(dv, db); if (eventTableChanged != null) { eventTableChanged(db); } Close(); } } } catch (Exception ex) { EventscadaException?.Invoke(GetType().Name, ex.Message); } }
public void StoreUser(User user, string password) { CheckLoginStatus(); if (_db.Exists("Username", user.Username)) { throw new ArgumentException($"Username '{ user.Username }' already exists."); } var newUser = new DetailedUser { Username = user.Username, Name = user.Name, LastName = user.LastName, DateCreated = DateTime.Now }; PasswordValidationHelper.ValidatePassword(password); newUser.SetPassword(password); _db.Add(newUser); }
public void AddToCollection(Author author) { _authorCollection.Add(author); }
public void AddToCollection(Book book) { _bookCollection.Add(GetDbModel(book)); }
public int AddTable(TableEntity tableEntity) { TableManager mgr = new TableManager(); return(mgr.Add(tableEntity)); }