コード例 #1
0
        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);
        }
コード例 #2
0
 private void UpdateFields(tUser user)
 {
     txtUserId.Text = user.ID;
     txtPassword.Text = "**********";
     txtNotes.Text = user.Notes;
 }
コード例 #3
0
        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;
        }
コード例 #4
0
 public static bool AddUser(tUser userToAdd)
 {
     return SecurityAdminDataProvider.InsertUser(userToAdd);
 }