public CompanyFacade(IServiceProvider serviceProvider, DealTrackingDbContext dbContext)
 {
     this.DbContext       = dbContext;
     this.DbSet           = this.DbContext.Set <Company>();
     this.IdentityService = serviceProvider.GetService <IdentityService>();
     this.CompanyLogic    = serviceProvider.GetService <CompanyLogic>();
 }
        public void EditCompany_ShouldEditRecord()
        {
            // Arrange
            var context = this.GetDbContext();

            this.PopulateData(context);

            // Act
            var service    = new CompanyLogic(context, mapper);
            var newCompany = new CompanyDTO
            {
                Id           = 5,
                Name         = "Lidivo3 Edited",
                Description  = "Grocery store3",
                Headquarters = "Sofia3",
                Employees    = new List <EmployeeDTO>()
            };

            service.EditCompany(newCompany);
            var company = context.Companies.Find(5);

            // Assert
            Assert.NotNull(company);
            Assert.Equal("Lidivo3 Edited", company.Name);
        }
Esempio n. 3
0
        public void DeleteEntityTestCase()
        {
            Company company = new Company();
            var companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Delete(company);
        }
Esempio n. 4
0
        public void TryToDeleteAlreadyDeletedEntity()
        {
            Company company = new Company() { Excluded = true };
            var companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Delete(company);
        }
Esempio n. 5
0
 public Service1()
 {
     _userLogic     = new UserLogic();
     _companyLogic  = new CompanyLogic();
     _keyRatioLogic = new KeyRatioLogic();
     _saveFileLogic = new SaveFileLogic();
 }
Esempio n. 6
0
 public ReallyPaidModel(CarServiceDbContext context, IEmailSender emailSender)
 {
     _workSheetLogic = new WorkSheetLogic(context);
     _emailLogic     = new EmailLogic(context, emailSender);
     _userLogic      = new UserLogic(context);
     _companyLogic   = new CompanyLogic(context);
 }
Esempio n. 7
0
        public void TryToSaveNullEntity()
        {
            Company company      = null;
            var     companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Save(company);
        }
Esempio n. 8
0
        public void DeleteEntityTestCase()
        {
            Company company      = new Company();
            var     companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Delete(company);
        }
Esempio n. 9
0
 public ProfileController()
 {
     userLogic               = new UtilisateurLogic();
     companyLogic            = new CompanyLogic();
     roleLogic               = new RoleLogic();
     passwordResetTokenLogic = new PasswordResetTokenLogic();
     notificationLogic       = new NotificationLogic();
 }
 public UtilisateurController()
 {
     userLogic    = new UtilisateurLogic();
     companyLogic = new CompanyLogic();
     roleLogic    = new RoleLogic();
     notifLogic   = new NotificationLogic();
     mailLogic    = new MailLogic();
 }
Esempio n. 11
0
 public void ErrorWhileTryToUpdateNewEntity()
 {
     Company company = new Company();
     var target = new CompanyLogic(new StubICompanyDao()
         {
             UpdateCompany = (x) => { throw new DatabaseOperationException(); }
         });
     target.Update(company);
 }
Esempio n. 12
0
 public void ErrorWhileTryToSaveEntityTest()
 {
     Company company = new Company();
     var companyLogic = new CompanyLogic(new StubICompanyDao()
     {
         SaveCompany = (x) => { throw new DatabaseOperationException(); }
     });
     companyLogic.Save(company);
 }
Esempio n. 13
0
        public void TryToDeleteAlreadyDeletedEntity()
        {
            Company company = new Company()
            {
                Excluded = true
            };
            var companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Delete(company);
        }
Esempio n. 14
0
        public void ErrorWhileTryToUpdateNewEntity()
        {
            Company company = new Company();
            var     target  = new CompanyLogic(new StubICompanyDao()
            {
                UpdateCompany = (x) => { throw new DatabaseOperationException(); }
            });

            target.Update(company);
        }
Esempio n. 15
0
        public void ErrorWhileTryToSaveEntityTest()
        {
            Company company      = new Company();
            var     companyLogic = new CompanyLogic(new StubICompanyDao()
            {
                SaveCompany = (x) => { throw new DatabaseOperationException(); }
            });

            companyLogic.Save(company);
        }
Esempio n. 16
0
        public void ErrorWhileTryToDeleteEntity()
        {
            Company company      = new Company();
            var     companyLogic = new CompanyLogic(new StubICompanyDao()
            {
                UpdateCompany = (x) => { throw new DatabaseOperationException(); }
            });

            companyLogic.Delete(company);
        }
Esempio n. 17
0
        public void ErrorWhileTryToDeleteEntity()
        {
            Company company = new Company();
            var companyLogic = new CompanyLogic(new StubICompanyDao()
            {
                UpdateCompany = (x) => { throw new DatabaseOperationException(); }
            });

            companyLogic.Delete(company);
        }
Esempio n. 18
0
        public void TryToSaveAlreadySavedEntity()
        {
            Company company      = new Company();
            var     companyLogic = new CompanyLogic(new StubICompanyDao()
            {
                VerifyIfAlreadyRegistredCompany = (x) => company
            });

            companyLogic.Save(company);
        }
Esempio n. 19
0
 public void SaveEntityTestCase()
 {
     Company company = null;
     var target = new CompanyLogic(new StubICompanyDao()
     {
         SaveCompany = x => company = x
     });
     target.Save(new Company());
     Assert.IsNotNull(company, "O metodo salvar nao executou a operacao de salvar do repositorio.");
     Assert.AreEqual(company, new Company(), "O metodo salvar nao salvou a mesma entidade informada.");
 }
Esempio n. 20
0
        public void SaveEntityTestCase()
        {
            Company company = null;
            var     target  = new CompanyLogic(new StubICompanyDao()
            {
                SaveCompany = x => company = x
            });

            target.Save(new Company());
            Assert.IsNotNull(company, "O metodo salvar nao executou a operacao de salvar do repositorio.");
            Assert.AreEqual(company, new Company(), "O metodo salvar nao salvou a mesma entidade informada.");
        }
Esempio n. 21
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            //CompanyProfilePoco companyProfilePoco = companyLogic.GetJobDescription(id);
            //CompanyDescriptionPoco companyDescriptionPoco = new CompanyDescriptionPoco();

            //compProfilePoco[0] = companyProfilePoco;
            //companyProfileLogic.Delete(compProfilePoco);
            CompanyLogic companyLogic = new CompanyLogic();

            companyLogic.DeleteJobDescription(id);
            return(RedirectToAction("Index"));
        }
Esempio n. 22
0
        public void UpdateEntityTestCase()
        {
            Company company = new Company();
            var     target  = new CompanyLogic(new StubICompanyDao()
            {
                UpdateCompany = (x) => { company = x; }
            }
                                               );

            target.Update(new Company());
            Assert.IsNotNull(company, "O método salvar não executou a operacao de atualizar entidade no repositorio.");
        }
Esempio n. 23
0
        public void GetCompany_ShouldReturnCorrectRecord_WhenNotExistingIdIsPassed()
        {
            // Arrange
            var context = this.GetDbContext();

            this.PopulateData(context);

            // Act
            var service = new CompanyLogic(context, mapper);
            var company = service.GetCompany(10);

            // Assert
            Assert.Null(company);
        }
Esempio n. 24
0
        private void LoadCompanys()
        {
            var companyData = new CompanyLogic().GetCompanys().Select(n => new Company()
            {
                Id = n.Id, Name = n.Name
            });

            companies.AddRange(companyData);
            companySelect.DataSource    = companies;
            companySelect.ValueMember   = "Id";
            companySelect.DisplayMember = "Name";

            line_Company.DataSource    = companies;
            line_Company.ValueMember   = "Id";
            line_Company.DisplayMember = "Name";
        }
Esempio n. 25
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Service = await CompanyLogic.GetServiceByIdAsync(id.Value);

            if (Service == null)
            {
                return(NotFound());
            }

            return(Page());
        }
Esempio n. 26
0
 public CarController()
 {
     companyLogic         = new CompanyLogic();
     carLogic             = new CarLogic();
     carModelLogic        = new CarModelLogic();
     carMakeLogic         = new CarMakeLogic();
     bookingLogic         = new BookingLogic();
     requestBookingLogic  = new RequestBookingLogic();
     eventLogic           = new EventLogic();
     addressLogic         = new AdressLogic();
     utilisateurLogic     = new UtilisateurLogic();
     statusLogic          = new StatusLogic();
     stopOverLogic        = new StopOverLogic();
     stopOverAddressLogic = new StopOverAddressLogic();
     notificationLogic    = new NotificationLogic();
 }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(CompanyName.Text) || string.IsNullOrEmpty(Phone.Text))
            {
                errM.Message = "All Feilds mark with asterisk(*) Are Required";
                errM.Show();
            }
            else
            {
                var id = new CompanyLogic().GetCompanyInfo().Id;
                CompanyLogic.UpdateCompanyInfo(CompanyName.Text, Phone.Text, Address.Text, Terms.Text,
                                               id.ToString());
                sm.Message = "Company Details saved successfully";
                sm.Show();

                Hide();
            }
        }
Esempio n. 28
0
        public void DeleteCompany_ShouldDeleteRecord_WhenExistingIdIsPassed()
        {
            // Arrange
            var context = this.GetDbContext();

            this.PopulateData(context);

            // Act
            var service    = new CompanyLogic(context, mapper);
            var oldCompany = context.Companies.Find(5);

            service.DeleteCompany(oldCompany.Id);

            var company = context.Companies.Find(5);

            // Assert
            Assert.NotNull(oldCompany);
            Assert.False(oldCompany.IsActive);
        }
Esempio n. 29
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            WorkerUser workerUser = await UserLogic.GetWorkerUserAsync(User);

            Service = await CompanyLogic.GetServiceByIdAsync(Service.Id);

            foreach (var work in Service.Works)
            {
                work.StateId = 6;
                await WorkSheetLogic.ModifyWorkAsync(work);
            }

            await _emailLogic.SendStatusChangeEmailAsync(Service);

            return(RedirectToPage("./Index"));
        }
Esempio n. 30
0
        public void DeleteCompany_ShouldDeleteRecord_WhenNotExistingIdIsPassed()
        {
            // Arrange
            var context = this.GetDbContext();

            this.PopulateData(context);
            Exception exception = null;

            // Act
            var service    = new CompanyLogic(context, mapper);
            var oldCompany = context.Companies.Find(50);

            try
            {
                service.DeleteCompany(oldCompany.Id);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            // Assert
            Assert.NotNull(exception);
        }
Esempio n. 31
0
 public IndexModel(CarServiceDbContext context)
 {
     _userLogic    = new UserLogic(context);
     _companyLogic = new CompanyLogic(context);
 }
Esempio n. 32
0
        public void TryToUpdateNullEntity()
        {
            var target = new CompanyLogic(new StubICompanyDao());

            target.Update(null);
        }
Esempio n. 33
0
        public async Task OnGetAsync()
        {
            var userId = await UserLogic.GetCompanyUserAsync(User);

            Services = await CompanyLogic.GetServicesByCompanyIdAsync(userId);
        }
Esempio n. 34
0
 private void Set_Load(object sender, EventArgs e)
 {
     companyLogic = new CompanyLogic();
     iniExistCompanyNames();
 }
Esempio n. 35
0
 public void TryToUpdateNullEntity()
 {
     var target = new CompanyLogic(new StubICompanyDao());
     target.Update(null);
 }
Esempio n. 36
0
 public void UpdateEntityTestCase()
 {
     Company company = new Company();
     var target = new CompanyLogic(new StubICompanyDao()
         {
             UpdateCompany = (x) => { company = x; }
         }
     );
     target.Update(new Company());
     Assert.IsNotNull(company, "O método salvar não executou a operacao de atualizar entidade no repositorio.");
 }
Esempio n. 37
0
        public void TryToDeleteNullEntity()
        {
            Company company = null;
            var companyLogic = new CompanyLogic(new StubICompanyDao());

            companyLogic.Delete(company);
        }
Esempio n. 38
0
 public void TryToSaveAlreadySavedEntity()
 {
     Company company = new Company();
     var companyLogic = new CompanyLogic(new StubICompanyDao()
     {
         VerifyIfAlreadyRegistredCompany = (x) => company
     });
     companyLogic.Save(company);
 }
Esempio n. 39
0
 public TestController(CompanyLogic logic, IWebHostEnvironment env, IConfiguration configuration)
 {
     _logic         = logic;
     _env           = env;
     _configuration = configuration;
 }
Esempio n. 40
0
 public CompanyController(IRepository <int, CatalogsDTO, bool> repository)
 {
     companyLogic = new CompanyLogic(repository);
 }