public ProviderMaintenanceProfile FirstProviderMaintenanceProfile()
        {
            var firstProviderMaintenanceProfile = new ProviderMaintenanceProfile {

                 MaintenanceProvider = new MaintenanceProvider()
            ,
                 MaintenanceCompanyLookUp = new MaintenanceCompanyLookUp()
            ,
                 MaintenanceCompany = new MaintenanceCompany()
            ,
                 MaintenanceCompanySpecialization = new MaintenanceCompanySpecialization()
            ,
                 MaintenanceCustomService = new MaintenanceCustomService()
            ,
                 MaintenanceExterior = new MaintenanceExterior()
            ,
                 MaintenanceInterior = new MaintenanceInterior()
            ,
                 MaintenanceNewConstruction = new MaintenanceNewConstruction()
            ,
                 MaintenanceRepair = new MaintenanceRepair()
            ,
                 MaintenanceUtility = new MaintenanceUtility()

             };

            return firstProviderMaintenanceProfile;
        }
        public PartialViewResult _Coverage(int id)
        {
            if (id != 0)
            {
                const int providerrole = 2;
                var lookUp =
                    UnitofWork.MaintenanceCompanyLookUpRepository.FindBy(x => x.Role == providerrole && x.UserId == id).FirstOrDefault();
                if (lookUp != null)
                {
                    int companyId = lookUp.CompanyId;

                    var mp = new ProviderMaintenanceProfile
                    {
                        MaintenanceCompanyLookUp = UnitofWork.MaintenanceCompanyLookUpRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceCompany = UnitofWork.MaintenanceCompanyRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceCompanySpecialization = UnitofWork.MaintenanceCompanySpecializationRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceCustomService = UnitofWork.MaintenanceCustomServiceRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceExterior = UnitofWork.MaintenanceExteriorRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceInterior = UnitofWork.MaintenanceInteriorRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceNewConstruction = UnitofWork.MaintenanceNewConstructionRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceRepair = UnitofWork.MaintenanceRepairRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault(),
                        MaintenanceUtility = UnitofWork.MaintenanceUtilityRepository.FindBy(x => x.CompanyId == companyId).FirstOrDefault()
                    };
                    return PartialView(mp);
                }
            }
            return null;
        }
 public ActionResult CompleteProfile(ProviderMaintenanceProfile s)
 {
     if (ModelState.IsValid)
     {
         UserHelper.ProviderPrivateProfileHelper.CompleteProviderProfile(s);
         return RedirectToAction("Index");
     }
     return View(s);
 }
        //****************************************************Account********************************************//
        /// <summary>
        /// Account Tab
        /// TODO  Complete:
        ///     -1-Delete All associated records
        /// </summary>
        public ActionResult CompleteProfile()
        {
            var providerId = UserHelper.GetProviderId();

            const int providerrole = 2;
            var lookUp =
                UnitofWork.MaintenanceCompanyLookUpRepository.FirstOrDefault(x => x.Role == providerrole && x.UserId == providerId);
            if (lookUp != null)
            {
                int companyId = lookUp.CompanyId;

                var mp = new ProviderMaintenanceProfile
                    {
                        MaintenanceProvider = UnitofWork.MaintenanceProviderRepository.FirstOrDefault(x => x.MaintenanceProviderId == providerId),
                        MaintenanceCompanyLookUp = UnitofWork.MaintenanceCompanyLookUpRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceCompany = UnitofWork.MaintenanceCompanyRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceCompanySpecialization = UnitofWork.MaintenanceCompanySpecializationRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceCustomService = UnitofWork.MaintenanceCustomServiceRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceExterior = UnitofWork.MaintenanceExteriorRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceInterior = UnitofWork.MaintenanceInteriorRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceNewConstruction = UnitofWork.MaintenanceNewConstructionRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceRepair = UnitofWork.MaintenanceRepairRepository.FirstOrDefault(x => x.CompanyId == companyId),
                        MaintenanceUtility = UnitofWork.MaintenanceUtilityRepository.FirstOrDefault(x => x.CompanyId == companyId)
                    };

                return View(mp);
            }

            return null;
        }
 public void CompleteProviderProfile(ProviderMaintenanceProfile s)
 {
     ProviderPrivateProfileHelper.CompleteProviderProfile(s);
 }
 public void CompleteProviderProfile(ProviderMaintenanceProfile s)
 {
     s.MaintenanceCompanySpecialization.Currency = UserHelper.GetCurrencyValue(s.MaintenanceCompanySpecialization.CurrencyID);
     UnitofWork.MaintenanceProviderRepository.Edit(s.MaintenanceProvider);
     UnitofWork.MaintenanceCompanyRepository.Edit(s.MaintenanceCompany);
     UnitofWork.MaintenanceCompanyLookUpRepository.Edit(s.MaintenanceCompanyLookUp);
     UnitofWork.MaintenanceCompanySpecializationRepository.Edit(s.MaintenanceCompanySpecialization);
     UpdateProviderProfileCompletion(CalculateNewProviderProfileCompletionPercentage(s.MaintenanceCompany));
     UpdateproviderProfile(s.MaintenanceProvider, s.MaintenanceCompany);
     UpdateProviderZoneList(s.MaintenanceCompany.Zip, s.MaintenanceCompany.City);
     UnitofWork.Save();
 }