public void AddNewTeam(string userId)
 {
     try
     {
         var company = _officeManagementService.GetCompanyByUserId(userId);
         _officeManagementService.AddNewTeam(new Team
         {
             Name    = this.Name,
             Count   = this.Count,
             Company = company
         });
         Notification = new NotificationModel("Success !!", "Teams Added Successfully", NotificationType.Success);
     }
     catch (Exception)
     {
         Notification = new NotificationModel("Failed !!", "Failed to Add Team", NotificationType.Fail);
         throw;
     }
 }
Exemple #2
0
        public IActionResult Index()
        {
            var userId  = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var company = _officeManagementService.GetCompanyByUserId(userId);
            var companyWithChildTable = _officeManagementService.GetCompany(company.Id);

            ViewBag.ServicesCount = companyWithChildTable.Services.Count();
            ViewBag.ProductsCount = companyWithChildTable.Products.Count();
            ViewBag.ProjectsCount = companyWithChildTable.Projects.Count();
            return(View());
        }
        public void AddTechnologyAreaOfOperation(string userId)
        {
            try
            {
                this.company          = _officeService.GetCompanyByUserId(userId);
                this.TechnologyInfos  = new List <TechnologyInfo>();
                this.AreaOfOperations = new List <AreaOfOperation>();

                if (TechnologyList != null)
                {
                    foreach (var item in TechnologyList)
                    {
                        TechnologyInfo technologyInfo = new TechnologyInfo()
                        {
                            Name      = item,
                            CompanyId = this.company.Id
                        };
                        this.TechnologyInfos.Add(technologyInfo);
                    }
                    _officeService.AddTechnologyInfos(this.TechnologyInfos);
                }
                if (AreaOfOperationsList != null)
                {
                    foreach (var item in AreaOfOperationsList)
                    {
                        AreaOfOperation areaOfOperation = new AreaOfOperation()
                        {
                            Name      = item,
                            CompanyId = this.company.Id
                        };
                        this.AreaOfOperations.Add(areaOfOperation);
                    }
                    _officeService.AddAreaOfOperations(this.AreaOfOperations);
                }
            }
            catch (Exception)
            {
                Notification = new NotificationModel("Failed !!", "Error in Area Of Operation or Technology Info", NotificationType.Fail);
                throw;
            }
        }
 public void AddNewProject(string uniqueFileName, string userId)
 {
     try
     {
         var company = _officeManagementService.GetCompanyByUserId(userId);
         _projectManagementService.AddNewProject(new Project
         {
             Name        = this.Name,
             Description = this.Description,
             DemoAccount = this.DemoAccount,
             ImageUrl    = uniqueFileName,
             CompanyId   = company.Id
         });
         Notification = new NotificationModel("success", "Project Added Successfully", NotificationType.Success);
     }
     catch (Exception)
     {
         Notification = new NotificationModel("Failed", "Failed to Project Add", NotificationType.Fail);
     }
 }
 public void AddNewService(string uniqueFileName, string userId)
 {
     try
     {
         var company = _officeManagementService.GetCompanyByUserId(userId);
         _companyServiceManagement.AddNewCompanyService(new CompanyService
         {
             Name        = this.Name,
             Description = this.Description,
             PricingRate = this.PricingRate,
             ImageUrl    = uniqueFileName,
             CompanyId   = company.Id
         });
         Notification = new NotificationModel("Success", "Company Service Added Successfully", NotificationType.Success);
     }
     catch (Exception e)
     {
         Notification = new NotificationModel("Failed", "Failed to Add Company Service", NotificationType.Fail);
         throw e;
     }
 }
 public void AddNewProduct(string uniqueFilePath, string userId)
 {
     try
     {
         var company  = _officeManagementService.GetCompanyByUserId(userId);
         var category = _categoryService.GetCategoryByName(this.Category.Name);
         _productService.AddNewProduct(new Product
         {
             Name            = this.Name,
             Description     = this.Description,
             ProductFeatures = this.ProductFeatures,
             ImageUrl        = uniqueFilePath,
             CompanyId       = company.Id,
             Categories      = new List <ProductCategory>()
             {
                 new ProductCategory {
                     CategoryId = category.Id
                 }
             }
         });
         Notification = new NotificationModel("Success!", "Product Successfully Created", NotificationType.Success);
     }
     catch (InvalidOperationException)
     {
         Notification = new NotificationModel(
             "Failed!",
             "Failed to create Product, please provide valid name",
             NotificationType.Fail);
     }
     catch (Exception)
     {
         Notification = new NotificationModel(
             "Failed!",
             "Failed to create Product, please try again",
             NotificationType.Fail);
     }
 }
 public Company GetCompany(string userId)
 {
     return(_officeManagementService.GetCompanyByUserId(userId));
 }