예제 #1
0
        public void Update(WorkerDTO item)
        {
            var worker = entities.Workers.FirstOrDefault(s => s.id == item.id);
            if (worker != null)
            {

                worker.lastName = item.lastName;
                worker.firstName = item.firstName;
                worker.password = item.password;
                entities.SaveChanges();



            }
        }
예제 #2
0
        public void LoginHelperWorkerSuccessfullLoginTest()
        {
            var mockCustomerService = new Mock<ICustomerDTOService>();
            var mockWorkerService = new Mock<IWorkerDTOService>();
            string login = "******";
            string password = "******";

            WorkerDTO w = new WorkerDTO() {login = login,password = SecurePasswordHasher.Hash(password)};

            mockCustomerService.Setup(s => s.Get("test")).Returns(Task.FromResult((CustomerDTO)null));
            mockWorkerService.Setup(s => s.Get(login)).Returns(Task.FromResult(w));

            string msg;
            var result = AccountHelper.ValidateLogin(login, password, mockCustomerService.Object, mockWorkerService.Object, out msg);

            Assert.IsTrue(result != null);
            Assert.IsTrue(msg == string.Empty);
        }
예제 #3
0
 public CarEditViewModel(CarDTO c,WorkerDTO w)
 {
     this.w = w;
     GetStations(c);
     Brand = c.brand;
     Model = c.model;
     Colour = c.colour;
     ProductionDate = c.productionDate;
     Price = c.price;
     IsEfficient = c.isEfficient;
     Id = c.Id;
 }
예제 #4
0
 public async Task<bool> Put(WorkerDTO item)
 {
     return await this.Put<WorkerDTO, bool>("PUT", item);
 }
예제 #5
0
 public StationAddViewModel(WorkerDTO w)
     {
     this.w = w;
     }
예제 #6
0
        public StationEditView(StationDTO s,WorkerDTO w)
        {
            InitializeComponent();
            DataContext = new StationEditViewModel(s,w);

        }
예제 #7
0
 public CarAddView(WorkerDTO w)
 {
     InitializeComponent();
     DataContext = new CarAddViewModel(w);
     cmbColors.ItemsSource = typeof(Colors).GetProperties();
 }
예제 #8
0
 public CarEditView(CarDTO c,WorkerDTO w)
 {
     InitializeComponent();
     DataContext = new CarEditViewModel(c,w);
 }
예제 #9
0
        public void ChangePasswordAdminInCorrectPasswordTest()
        {
            var mockCustomerService = new Mock<ICustomerDTOService>();
            var mockWorkerService = new Mock<IWorkerDTOService>();
            string login = "******";
            string password = "******";
            CustomerDTO customer = new CustomerDTO() { userName = login, password = SecurePasswordHasher.Hash(password) };
            WorkerDTO worker = new WorkerDTO() { login = login, password = SecurePasswordHasher.Hash(password+password) };

            mockCustomerService.Setup(s => s.Get(login)).Returns(Task.FromResult(customer));
            mockCustomerService.Setup(s => s.Put(customer)).Returns(Task.FromResult(true));

            mockWorkerService.Setup(s => s.Get(login)).Returns(Task.FromResult(worker));
            mockWorkerService.Setup(s => s.Put(worker)).Returns(Task.FromResult(true));

            Claim c = new Claim(ClaimTypes.Role, Roles.AdminRole);
            string msg;
            var result = AccountHelper.ValidateChangePassword(c, login, password, password + password,
                mockCustomerService.Object, mockWorkerService.Object, out msg);

            Assert.IsTrue(!result);
            Assert.IsTrue(msg != string.Empty);
            Assert.IsTrue(msg==Messages.IncorrectPassword);
        }
예제 #10
0
        public WorkerPanelViewModel(WorkerDTO w)
        {
            Messenger.Default.Register<FireRefresh>
            (
                 this,
                 (action) => Refresh()
            );
            _logInInfo = w.login.ToString();
            this.w = w;

            SearchProductionDate = new DateTime(2000, 1, 1);
            SearchPrice = 10000;
        }
예제 #11
0
 public StationEditViewModel(StationDTO e,WorkerDTO  w)
 {
     City = e.city;
     Street = e.street;
     ZipCode = e.zipCode;
     StreetNo = e.streetNumer.ToString();
     selected = e;
     this.w = w;
 }
예제 #12
0
 public StationAddView(WorkerDTO w)
 {
     InitializeComponent();
     DataContext = new StationAddViewModel(w);
 }
예제 #13
0
 public CarAddViewModel(WorkerDTO w)
 {
     this.w = w;
     GetStations();
     ProductionDate = new DateTime(2000, 01, 01);
     GetUniqueBrands();
 }