public LoginModel LetMeIn(LoginModel model) { string message = "Invalid username/password"; model.UserID = 0; AAContext context = new AAContext(); User user = context.AsQueryable <User>() .Where(x => x.Username == model.Username.Trim() && x.Password == model.Password.Trim()) .FirstOrDefault(); if (user != null) { if (user.ID > 0) { message = ""; model.UserID = user.ID; model.RoleID = user.RoleID; model.Username = user.Username; model.FullName = string.Format("{0}, {1} {2}", user.LastName, user.FirstName, user.MiddleName); model.Email = user.Email; model.RoleName = user.Role.Name; } } model.Message = message; return(model); }
public void ExecuteSp() { var sp = "sp_CreateRole"; AAContext context = new AAContext(); context.ExecuteTSQL("exec sp_CreateRole 'test','testonly'"); }
public void GetTableColumnTestInt() { AAContext context = new AAContext(); string notExpected = string.Empty; string actual = string.Empty; actual = context.GetColumn <string>("select CAST(ID AS VARCHAR(10)) from [user]"); Assert.AreNotEqual(notExpected, actual); }
public void GetTableColumnTest() { AAContext context = new AAContext(); string notExpected = string.Empty; string actual = string.Empty; actual = context.GetColumn <string>("select username from [user]"); Assert.AreNotEqual(notExpected, actual); }
public void GenerateEntity() { AAContext context = new AAContext(); string notExpected = string.Empty; var user = new TestUser(); string a = ""; var users = context.GetList <TestUser>("select u.Active,u.Username,u.Password,RoleName=r.Name from [User] u inner join [Role] r on r.ID=u.RoleID"); //ctx. //context.GetColumn( "select u.Username,u.Password,r.Name from [User] u inner join [Role] r on r.ID=u.RoleID" ); foreach (var u in users) { a += u.Username + ":" + u.RoleName + ":" + u.Active + ","; } Assert.AreNotEqual(notExpected, a); }
public void InsertUserTest() { User user = new User() { Username = "******", Password = "******", FirstName = "banbanboi", LastName = "banbanboi", MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@gmail.com", "mcnielv"), SSS = "3242332432", TIN = "23432432", RoleID = 1, DateCreated = DateTime.Now, DateModified = DateTime.Now }; AAContext context = new AAContext(); context.Add <User>(user); context.SaveChanges(); }
public void InsertAircraft() { Aircraft aircraft = new Aircraft() { Name = "AC1" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), Description = "AC1" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), DateCreated = DateTime.Now, DateModified = DateTime.Now }; AAContext context = new AAContext(); context.Add <Aircraft>(aircraft); context.SaveChanges(); aircraft = new Aircraft() { Name = "AC2" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), Description = "AC2" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <Aircraft>(aircraft); context.SaveChanges(); aircraft = new Aircraft() { Name = "AC3" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), Description = "AC3" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <Aircraft>(aircraft); context.SaveChanges(); }
public DestinationService() { _context = new AAContext(); }
public CalendarService() { _context = new AAContext(); _regService = new RegistrationService(); _userService = new UserService(); }
public ReportService() { _context = new AAContext(); }
public RegistrationService() { _context = new AAContext(); }
public AircraftTypeService() { _context = new AAContext(); }
public RoleService() { _context = new AAContext(); }
public void InsertACRegistration() { DateTime datenow = DateTime.Now; Registration reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 1, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; AAContext context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 3, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 2, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 3, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 3, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 7, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 7, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 8, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 9, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); reg = new Registration() { Name = "Reg-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 4), AircraftID = 9, Description = "Test Registration Only", DateCreated = datenow, DateModified = datenow }; context = new AAContext(); context.Add <Registration>(reg); context.SaveChanges(); }
public void AttachTest() { string username = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5); User user = new User() { Username = username, Password = "******", FirstName = username, LastName = username, MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@email.com", username), SSS = "3242332432", TIN = "23432432", RoleID = 1, DateCreated = DateTime.Now, DateModified = DateTime.Now }; AAContext context = new AAContext(); context.Add <User>(user); context.SaveChanges(); user = new User() { Username = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), Password = "******", FirstName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), LastName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@email.com", username), SSS = "3242332432", TIN = "23432432", RoleID = 6, DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <User>(user); context.SaveChanges(); user = new User() { Username = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), Password = "******", FirstName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), LastName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@email.com", username), SSS = "3242332432", TIN = "23432432", RoleID = 6, DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <User>(user); context.SaveChanges(); user = new User() { Username = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), Password = "******", FirstName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), LastName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@email.com", username), SSS = "3242332432", TIN = "23432432", RoleID = 5, DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <User>(user); context.SaveChanges(); user = new User() { Username = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), Password = "******", FirstName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), LastName = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), MiddleName = "A", Address = "adress 1", Phone = "1234324", Email = string.Format("{0}@email.com", username), SSS = "3242332432", TIN = "23432432", RoleID = 4, DateCreated = DateTime.Now, DateModified = DateTime.Now }; context = new AAContext(); context.Add <User>(user); context.SaveChanges(); }
public LogsService() { _context = new AAContext(); }
public UserService() { _context = new AAContext(); }