예제 #1
0
		public ActionResult SaveCompanyStatus(ClientCompanyStatusViewModel viewModel, string companyId)
		{
			if (ModelState.IsValid)
			{
				_clientCompaniesListService.SaveStatus(viewModel, companyId);
				CommitProviderInstance.Commit();
			}

			return Json(new { });
		}
예제 #2
0
		public ClientCompanyStatusViewModel GetCompanyStatus(string clientCompany)
		{
			var company = _clientCompanyManagement.FindById(clientCompany);

			var result = new ClientCompanyStatusViewModel();

			if (company != null)
			{
				result = new ClientCompanyStatusViewModel(company);
			}

			return result;
		}
예제 #3
0
		public void SaveStatus(ClientCompanyStatusViewModel statusViewModel, string clientCompany)
		{
			var company = _clientCompanyManagement.FindById(clientCompany);

			if (company != null)
			{
				if (company.Status == ClientCompanyStatus.Active && statusViewModel.Status == ClientCompanyStatus.Inactive)
				{
					if (company.Branches != null)
					{
						foreach (var branch in company.Branches)
						{
							branch.Status = ClientCompanyBrancheStatus.Disabled;
						}
					}
					foreach (var companyUser in _clientUserManager.GetClienUsers(query => query.Where(u => u.Company.CompanyName == company.CompanyName)))
					{
						companyUser.Status = ClientUserStatus.Inactive;
					}
				}
				statusViewModel.FillModel(company);
			}
		}