public UserRepository() { this.architectHandler = new ArchitectHandler(); this.clientHandler = new ClientHandler(); this.designerHandler = new DesignerHandler(); this.adminHandler = new AdminHandler(); }
public MainWindow() { InitializeComponent(); loginHandler = new LoginHandler(); adminHandler = new AdminHandler(); companyHandler = new CompanyHandler(); }
public bool UpdatePassword(dynamic obj) { string id = obj.id; string newpwd = obj.newpwd; return(AdminHandler.UpdatePassword(Guid.Parse(id), newpwd)); }
public void AttachEventHandlers(ModuleRegistry registry) { AdminHandler.Instance.OnLoadAdminPage += new AdminHandler.AdminRequestHandler(AdminHandler_OnLoadAdminPage); WebEvents.AddFormProcessor(new WebEvents.FormPostAction(null, null, "page-edit-button", "Save Page", SavePage)); WebEvents.Instance.OnLoadRequestedPath += new WebEvents.RequestedPathEventHandler(WebEvents_OnLoadRequestedPath); AdminHandler.AddPagePreprocessor("PageEdit", PreEditPage); }
public MainPage() { this.InitializeComponent(); lunchPlanHandler = new LunchPlanHandler(); mealHandler = new MealHandler(); dbHandler = new DBHandler(); messageHandler = new MessageHandler(); adminHandler = new AdminHandler(); iPHandler = new IPHandler(); model = dbHandler.Model; CmbBoxWeekNumbers.ItemsSource = Enumerable.Range(1, 52); CmbBoxWeekNumbers.SelectedIndex = GetIso8601WeekOfYear(DateTime.Now) - 1; ShowSelectedLunchPlan(GetIso8601WeekOfYear(DateTime.Now)); BtnDeleteDish.IsHitTestVisible = false; BtnDeleteDish.Opacity = 0.4; try { ListViewDatabaseDishes.ItemsSource = model.Meals.OrderByDescending(m => m.TimesChosen); LoadMessage(); } catch (ArgumentNullException e) { Debug.Write(e); } }
public AdministratorView(IntPtr handle) : base(handle) { baseHandler = new BaseHandler(this); adminHandler = new AdminHandler(this); segueName = ""; segueType = ""; segueLocation = ""; segueHours = ""; segueList = ""; segueAvailable = ""; segueMaxNumber = ""; segueFName = ""; segueLName = ""; segueCity = ""; segueAddress = ""; segueState = ""; segueCountry = ""; wasActivityName = false; wasActivity = false; timer = new Timer(10); timer.Enabled = true; timer.Start(); timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); NSEvent.AddLocalMonitorForEventsMatchingMask(NSEventMask.KeyDown, KeyboardEventHandler); }
public AdminPageViewModel() { _employees = new ObservableCollection <Employees>(); _worktimeEventDetails = new ObservableCollection <WorktimeEventDetails>(); _handler = new AdminHandler(this); _handlerCal = _handler; _handlerCal.LoadCalenderDetailsAsync(); _employeeVisibility = Visibility.Collapsed; }
public CreateActivity(IntPtr handle) : base(handle) { baseHandler = new BaseHandler(this); adminHandler = new AdminHandler(this); segueName = ""; segueType = ""; segueLocation = ""; segueHours = ""; segueAvailable = ""; segueMaxNumber = ""; }
public UpdateDeleteAccount(IntPtr handle) : base(handle) { baseHandler = new BaseHandler(this); adminHandler = new AdminHandler(this); segueFName = ""; segueLName = ""; segueCity = ""; segueAddress = ""; segueState = ""; segueCountry = ""; }
public void UpdatePassword() { Guid userid = Guid.Parse("86ecdaa6-9c84-41a1-aef8-f41e2cedf079"); string password = "******"; string passwordhash = CommonHelper.CreateMD5(password); string newpassword = "******"; string newpasswordhash = CommonHelper.CreateMD5(newpassword); Assert.IsTrue(AdminHandler.UpdatePassword(userid, newpasswordhash)); }
public void LoginTest() { //Arrange AdminHandler adminHandler = new AdminHandler(); string username = "******"; string password = "******"; //Act adminHandler.Login(username, password); Assert.Fail(); }
public Connection(Socket socket, MessageHandler messageHandler = null, AdminHandler adminHandler = null, BaseHandler baseHandler = null, UserHandler userHandler = null) { this.socket = socket; this.adminHandler = adminHandler ?? new AdminHandler(); this.baseHandler = baseHandler ?? new BaseHandler(); this.userHandler = userHandler ?? new UserHandler(); this.messageHandler = new MessageHandler(); Console.WriteLine($"Connected to client: {socket.RemoteEndPoint}"); Task.Run(() => Execute(socket)); }
public void AddAdmin() { Admin admin = new Admin(); admin.UserName = "******"; admin.PhoneNumber = "13810308263"; string password = "******"; admin.PasswordHash = CommonHelper.CreateMD5(password); admin.RoleId = 1; Assert.IsTrue(AdminHandler.AddAdmin(admin)); }
public override void ViewDidLoad() { adminHandler = new AdminHandler(this); segueName = ""; segueType = ""; segueLocation = ""; segueHours = ""; segueList = ""; segueAvailable = ""; segueMaxNumber = ""; wasActivityName = false; wasActivity = false; }
public TokenInfo Login([FromBody] LoginRequest loginRequest) { TokenInfo tokenInfo = new TokenInfo(); if (loginRequest != null) { string phone = loginRequest.PhoneNumber; string password = loginRequest.PasswordHash; DataSet ds = AdminHandler.LogAttempt(phone, password); JObject loginResult = CommonHandler.TransferObjFromDS(ds); if (loginResult != null) { AuthInfo authInfo = JsonConvert.DeserializeObject <AuthInfo>(loginResult.ToString()); authInfo.ExpiryDateTime = DateTime.Now.AddDays(1); const string secretKey = "JRestaurant";//口令加密秘钥 try { byte[] key = Encoding.UTF8.GetBytes(secretKey); IJwtAlgorithm algorithm = new HMACSHA256Algorithm(); //加密方式 IJsonSerializer serializer = new JsonNetSerializer(); //序列化Json IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder(); //base64加解密 IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder); //JWT编码 var token = encoder.Encode(authInfo, key); //生成令牌 //口令信息 tokenInfo.Success = true; tokenInfo.Token = token; tokenInfo.Message = "OK"; } catch (Exception ex) { tokenInfo.Success = false; tokenInfo.Message = ex.Message.ToString(); } } else { tokenInfo.Success = false; tokenInfo.Message = "用户密码错误"; } } else { tokenInfo.Success = false; tokenInfo.Message = "用户信息为空"; } return(tokenInfo); }
public void LoginAttemp() { string phone = "13810308263"; string password = "******"; string passwordhash = CommonHelper.CreateMD5(password); DataSet ds = AdminHandler.LogAttempt(phone, passwordhash); Assert.IsTrue(ds.Tables.Count > 0); if (ds.Tables.Count > 0) { JObject obj = CommonHelper.ParseFromDataSet(ds); string id = obj.GetValue("Id").ToString(); AdminHandler.UpdateLastLoginTime(Guid.Parse(id)); } }
public void TestCaseReverse() { BaseHandler baseHandler = new BaseHandler(messageControllerMock.Object, messageMock.Object); AdminHandler adminHandler = new AdminHandler(messageControllerMock.Object, messageMock.Object); adminHandler.createAccount(user.email, user.password, user.firstName, user.lastName, user.country, user.address, user.city, user.state, "dragost", "2"); expectedMessage = new Message { userContent = user, Content = "updated" }; serverMock.Setup(x => x.handleAsync(It.IsAny <Message>())).Returns(expectedMessage); baseHandler.handle(expectedMessage); Assert.That(expectedMessage.userContent != null); }
private void BtnLogin_Click(object sender, RoutedEventArgs e) { AdminHandler adminHandler = new AdminHandler(); UnionHandler unionHandler = new UnionHandler(); LoginWindow loginWindow = new LoginWindow(); if (loginWindow.ShowDialog() == true) { try { currentAdmin = adminHandler.Login(loginWindow.TBoxUsername.Text, loginWindow.TBoxPassword.Text); currentUnion = unionHandler.Login(loginWindow.TBoxUsername.Text, loginWindow.TBoxPassword.Text); if (currentAdmin != null || currentUnion != null) { if (currentAdmin != null) { TBlockCurrentUser.Text = currentAdmin.FirstName + " " + currentAdmin.LastName; TabAdmin.IsEnabled = true; } else if (currentUnion != null) { TBlockCurrentUser.Text = currentUnion.Email; TabAdmin.IsEnabled = false; } else { TabAdmin.IsEnabled = false; TabUnion.IsSelected = true; } } else { TBlockCurrentUser.Text = "Ingen bruger fundet."; } } catch (ArgumentException error) { MessageBox.Show(error.Message, error.GetType().ToString()); } } }
/* check delete user operation */ public void DeleteUserCase() { //aarange AdminHandler adminHandler = new AdminHandler(messageControllerMock.Object, messageMock.Object); BaseHandler baseHandler = new BaseHandler(messageControllerMock.Object, messageMock.Object); expectedMessage = new Message { messageType = MessageType.DELETE_ACCOUNT, Content = "deleted" }; serverMock.Setup(x => x.handleAsync(It.IsAny <Message>())).Returns(expectedMessage); baseHandler.handle(expectedMessage); //act adminHandler.deleteAccount("*****@*****.**"); //asert Assert.That(expectedMessage.Content.CompareTo("deleted") == 0); }
public void TestCaseReverse() { BaseHandler baseHandler = new BaseHandler(messageControllerMock.Object, messageMock.Object); AdminHandler adminHandler = new AdminHandler(messageControllerMock.Object, messageMock.Object); adminHandler.createActivity(activity); expectedMessage = new Message { messageType = MessageType.CREATE_ACTIVITY, Content = "updated", activityContent = activity }; serverMock.Setup(x => x.handleAsync(It.IsAny <Message>())).Returns(expectedMessage); baseHandler.handle(expectedMessage); Assert.That(expectedMessage.Content.CompareTo("created") != 0); }
public void TestCase3() { BaseHandler baseHandler = new BaseHandler(messageControllerMock.Object, messageMock.Object); UserHandler userHandler = new UserHandler(messageControllerMock.Object, messageMock.Object); AdminHandler adminHandler = new AdminHandler(messageControllerMock.Object, messageMock.Object); adminHandler.createAccount(user.email, user.password, user.firstName, user.lastName, user.country, user.address, user.city, user.state, "denisaurcan", "0"); // no more subs userHandler.register("2", "denisaurcan", "Gadget's Go Coaster", null); expectedMessage = new Message { Content = "max", }; serverMock.Setup(x => x.handleAsync(It.IsAny <Message>())).Returns(expectedMessage); baseHandler.handle(expectedMessage); Assert.That(expectedMessage.Content.CompareTo("max") == 0); }
static void Main(string[] args) { Handler guestHandler = new GuestHandler(null); Handler userHandler = new UserHandler(guestHandler); Handler handler = new AdminHandler(userHandler); User admin = new User() { Position = "Admin" }; User user = new User() { Position = "User" }; User guest = new User() { Position = "Guest" }; handler.Handle(admin); handler.Handle(user); handler.Handle(guest); }
public GenericCommandResult CreateAdmin( [FromServices] AdminHandler handler, [FromBody] CreateAdminCommand command) { return((GenericCommandResult)handler.Handle(command)); }
static void Main(string[] args) { ActivitiesHandler activitiesHandler = new ActivitiesHandler(); AdminHandler adminHandler = new AdminHandler(); ClosedDaysHandler closedDaysHandler = new ClosedDaysHandler(); CompanyHandler companyHandler = new CompanyHandler(); DBHandler dBHandler = new DBHandler(); HallHandler hallHandler = new HallHandler(); LoginHandler loginHandler = new LoginHandler(); OngoingBookingsHandler ongoingBookingsHandler = new OngoingBookingsHandler(); OpeningHoursHandler openingHoursHandler = new OpeningHoursHandler(); SectionsHandler sectionsHandler = new SectionsHandler(); SingleBookingsHandler singleBookingsHandler = new SingleBookingsHandler(); StatisticsHandler statisticsHandler = new StatisticsHandler(); Hall hall = new Hall() { Name = "Klarup Sportshal", Address = "Gammelvej 23, 6900 Ølby", AmountOfSections = 6 }; hallHandler.AddHall(hall); OpeningHour openingHourMonday = new OpeningHour() { NameOfDay = "Monday", OpeningTime = DateTime.ParseExact("00/01/01 9:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourTuesday = new OpeningHour() { NameOfDay = "Tuesday", OpeningTime = DateTime.ParseExact("00/01/01 8:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourWednesday = new OpeningHour() { NameOfDay = "Wednesday", OpeningTime = DateTime.ParseExact("00/01/01 5:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 8:30:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourThursday = new OpeningHour() { NameOfDay = "Thursday", OpeningTime = DateTime.ParseExact("00/01/01 9:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourFriday = new OpeningHour() { NameOfDay = "Friday", OpeningTime = DateTime.ParseExact("00/01/01 6:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 3:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourSaturday = new OpeningHour() { NameOfDay = "Saturday", OpeningTime = DateTime.ParseExact("00/01/01 1:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 10:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourSunday = new OpeningHour() { NameOfDay = "Sunday", OpeningTime = DateTime.ParseExact("00/01/01 5:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 1:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; openingHoursHandler.AddOpeningHour(openingHourMonday); openingHoursHandler.AddOpeningHour(openingHourTuesday); openingHoursHandler.AddOpeningHour(openingHourWednesday); openingHoursHandler.AddOpeningHour(openingHourThursday); openingHoursHandler.AddOpeningHour(openingHourFriday); openingHoursHandler.AddOpeningHour(openingHourSaturday); openingHoursHandler.AddOpeningHour(openingHourSunday); Admin admin = new Admin() { Name = "Emil Lynge", Email = "*****@*****.**", Password = "******", HallId = 1 }; adminHandler.AddAdmin(admin); Activity activity = new Activity() { Name = "Håndboldtræning", SectionsRequired = 3, }; Activity activity2 = new Activity() { Name = "Håndboldkamp", SectionsRequired = 6, }; Activity activity3 = new Activity() { Name = "Badmintonbane", SectionsRequired = 1, }; Activity activity4 = new Activity() { Name = "Badmintonkamp", SectionsRequired = 3, }; Activity activity5 = new Activity() { Name = "Volleyballtræning", SectionsRequired = 3, }; Activity activity6 = new Activity() { Name = "Volleyballkamp", SectionsRequired = 3, }; Activity activity7 = new Activity() { Name = "Floorballtræning", SectionsRequired = 1, }; Activity activity8 = new Activity() { Name = "Floorballkamp", SectionsRequired = 3, }; activitiesHandler.AddActivity(activity); activitiesHandler.AddActivity(activity2); activitiesHandler.AddActivity(activity3); activitiesHandler.AddActivity(activity4); activitiesHandler.AddActivity(activity5); activitiesHandler.AddActivity(activity6); activitiesHandler.AddActivity(activity7); activitiesHandler.AddActivity(activity8); Console.ReadLine(); //Company company = new Company() //{ // Name = "AspIT", // Address = "Carl Gustavsgade 2, Høje Taastrup", // PhoneNumber = "22332244", // Email = "*****@*****.**", // Password = "******" //}; //Company company2 = new Company() //{ // Name = "FreelanceLynge", // Address = "Egegade 999, Kbh", // PhoneNumber = "23242526", // Email = "*****@*****.**", // Password = "******" //}; //companyHandler.AddCompany(company); //companyHandler.AddCompany(company2); }
public override void ViewDidLoad() { base.ViewDidLoad(); baseHandler = new BaseHandler(this); adminHandler = new AdminHandler(this); }
public async Task <ActionResult <IEnumerable <RegisteredUser> > > GetAll() { return(await AdminHandler.GetAllAdmin()); }
public int GetTotalCount() { return(AdminHandler.GetTotalCount()); }
public MessageHandler(BaseHandler baseHandler = null, AdminHandler adminHandler = null, UserHandler userHandler = null) { this.baseHandler = baseHandler ?? new BaseHandler(); this.adminHandler = adminHandler ?? new AdminHandler(); this.userHandler = userHandler ?? new UserHandler(); }
public static List <User> getAllUsers() { return(AdminHandler.getAllUsers()); }
internal static void deleteUserByIndex(int index) { AdminHandler.deleteUsersByIndex(index); }