public void AddUserTest() { //arrange var userToAdd = new tUser { ID = "Shahin", Password = "******", LanguageCode = "US", FontName = "Test", FontSize = 12, Notes = "Test", Theme = "Default" }; // act var result= SecurityAdminService.AddUser(userToAdd); // assert Assert.IsTrue(result); }
private void UpdateFields(tUser user) { txtUserId.Text = user.ID; txtPassword.Text = "**********"; txtNotes.Text = user.Notes; }
public static bool InsertUser(tUser userToInsert) { try { using (IDbConnection connection = Helper.DbConnectionHelper.GetConnection()) { string sql = "INSERT INTO [OfficeFinancial].[dbo].[tUser]([ID],[Password],[Notes] ,[LanguageCode] ,[Theme] ,[FontName] ,[FontSize])"; sql += " VALUES(@ID,@Password, @Notes,@LanguageCode, @Theme,@FontName ,@FontSize)"; connection.Execute(sql, userToInsert); } } catch (SqlException ex) { //LoggerHelper.Write(TraceEventType.Error, "Error in InsertUser. " + ex, // new string[] { Constants.LOGGING_CATEGORY_DEV, Constants.LOGGING_CATEGORY_PRODUCTION }); throw; } catch (InvalidOperationException ex) { //LoggerHelper.Write(TraceEventType.Error, "Error in InsertUser. " + ex, // new string[] { Constants.LOGGING_CATEGORY_DEV, Constants.LOGGING_CATEGORY_PRODUCTION }); throw; } return true; }
public static bool AddUser(tUser userToAdd) { return SecurityAdminDataProvider.InsertUser(userToAdd); }