Пример #1
0
		public CompanyBranchInfo GetBrokerCompanyBranchInfoForOrder(int orderId)
		{
			var order = _orderManager.GetOrderById(orderId);

			var brokerCompanyBranchInfo = new CompanyBranchInfo();


			if (order.CreatedByClientUser != null && order.CreatedByClientUser.Branch != null && order.CreatedByClientUser.Company.Profile.IsBroker)
			{
				if (order.ClientCompanyBrancheId.HasValue && order.CreatedByClientUser.Branch.Id == order.ClientCompanyBrancheId.Value)
					return brokerCompanyBranchInfo;

				brokerCompanyBranchInfo.Phone = order.CreatedByClientUser.Branch.BranchPhone;
				brokerCompanyBranchInfo.BranchName = order.CreatedByClientUser.Branch.Name;
				brokerCompanyBranchInfo.CompanyName = order.CreatedByClientUser.Company.CompanyName;

				if (order.CreatedByClientUser.Branch.Address != null)
				{
					brokerCompanyBranchInfo.City = order.CreatedByClientUser.Branch.Address.City;
					brokerCompanyBranchInfo.State = order.CreatedByClientUser.Branch.Address.State;
					brokerCompanyBranchInfo.StreetAddress = order.CreatedByClientUser.Branch.Address.Street;
					brokerCompanyBranchInfo.StreetAddress2 = order.CreatedByClientUser.Branch.Address.Street2;
					brokerCompanyBranchInfo.ZIP = order.CreatedByClientUser.Branch.Address.ZIP;
				}
			}

			return brokerCompanyBranchInfo;
		}
Пример #2
0
		public CompanyBranchInfo GetClientCompanyBranchInfoForOrder(int orderId)
		{
			var order = _orderManager.GetOrderById(orderId);

			var clientCompanyBranchInfo = new CompanyBranchInfo();

			if (order.CreatedByClientUser != null && order.CreatedByClientUser.Branch != null)
			{
				ClientCompanyBranche clientBranch;
				if (order.CreatedByClientUser.Company.Profile.IsBroker && order.ClientCompanyBranche != null)
				{
					clientBranch = order.ClientCompanyBranche;
					clientCompanyBranchInfo.CompanyName = order.ClientCompany.CompanyName;
				}
				else
				{
					clientBranch = order.CreatedByClientUser.Branch;
					clientCompanyBranchInfo.CompanyName = order.CreatedByClientUser.Company.CompanyName;
				}

				clientCompanyBranchInfo.Phone = clientBranch.BranchPhone;
				clientCompanyBranchInfo.BranchName = clientBranch.Name;

				if (clientBranch.Address != null)
				{
					clientCompanyBranchInfo.City = clientBranch.Address.City;
					clientCompanyBranchInfo.State = clientBranch.Address.State;
					clientCompanyBranchInfo.StreetAddress = clientBranch.Address.Street;
					clientCompanyBranchInfo.StreetAddress2 = clientBranch.Address.Street2;
					clientCompanyBranchInfo.ZIP = clientBranch.Address.ZIP;
				}
			}

			return clientCompanyBranchInfo;
		}