Beispiel #1
0
        public BE.ListingViewModel GetListingByFacilityGuid(Guid facilityGuid)
        {
            DA.FacilityGateway facilityGateway = new DA.FacilityGateway();
            DA.Facility facility = facilityGateway.GetByPK(facilityGuid);

            // Validation of client.
            if (null == facility)
                return null;
            if (Guid.Empty == facility.CityStateZipGuid)
                return null;
            if (Guid.Empty == facility.ListingTypeGuid)
                return null;

            DA.CityStateZipGateway cityGateway = new DA.CityStateZipGateway();
            DA.CityStateZip cityStateZip = cityGateway.GetByPK(facility.CityStateZipGuid);

            // Validation of city state zip.
            if (null == cityStateZip)
                return null;

            DA.ListingTypeGateway listingGateway = new DA.ListingTypeGateway();
            DA.ListingType listingType = listingGateway.GetByPK(facility.ListingTypeGuid);

            // Validation of paymentInfo.
            if (null == listingType)
                return null;

            BE.ListingViewModel listing = EntityConversion.BuildListingViewModel(facility, cityStateZip, listingType);
            return listing;
        }
Beispiel #2
0
 public List<BE.CityStateZip> GetCityStateZipsNotForFacility(Guid facilityGuid)
 {
     List<BE.CityStateZip> result = new List<BE.CityStateZip>();
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     result = gateway.GetAllNotForFacility(facilityGuid).ToBusinessEntitiesList();
     return result;
 }
Beispiel #3
0
        public BE.AccountViewModel GetByEmail(string email)
        {
            DA.ClientGateway clientGateway = new DA.ClientGateway();
            DA.Client client = clientGateway.GetByEmail(email);

            // Validation of client.
            if (null == client)
                return null;
            if (Guid.Empty == client.CityStateZipGuid)
                return null;
            if (Guid.Empty == client.PaymentInfoGuid)
                return null;

            DA.CityStateZipGateway cityGateway = new DA.CityStateZipGateway();
            DA.CityStateZip cityStateZip = cityGateway.GetByPK(client.CityStateZipGuid);

            // Validation of city state zip.
            if (null == cityStateZip)
                return null;

            DA.PaymentInfoGateway paymentGateway = new DA.PaymentInfoGateway();
            DA.PaymentInfo paymentInfo = paymentGateway.GetByPK(client.PaymentInfoGuid);

            // Validation of paymentInfo.
            if (null == paymentInfo)
                return null;

            BE.AccountViewModel account = EntityConversion.BuildAccountViewModel(client, cityStateZip, paymentInfo);
            return account;
        }
Beispiel #4
0
 public BE.CityStateZip GetCityStateZipByCityStateZipGuid(Guid cityStateZipGuid)
 {
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     BE.CityStateZip result = new BE.CityStateZip();
     result = gateway.GetByPK(cityStateZipGuid).ToBusinessEntity();
     return result;
 }
Beispiel #5
0
 public List<BE.CityStateZip> GetAllCityStateZipWithUndefined()
 {
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     List<BE.CityStateZip> result = new List<BE.CityStateZip>();
     result = gateway.GetAllWithUndefined().ToBusinessEntitiesList();
     return result;
 }
Beispiel #6
0
 //@@NEW
 public BE.CityStateZip GetCityStateZipCodeByZipCode(string zipCode)
 {
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     DA.CityStateZip result = gateway.GetByZipCode(zipCode);
     if (null != result)
         return result.ToBusinessEntity();
     else
         return null;
 }
Beispiel #7
0
        public IQueryable<BE.AccountViewModel> GetAll()
        {
            DA.ClientGateway clientGateway = new DA.ClientGateway();
            List<DA.Client> clients = clientGateway.GetClientList();
            List<BE.AccountViewModel> accountList = new List<BE.AccountViewModel>();
            foreach (var client in clients)
            {
                //Validation of client.
                if (null == client)
                    return null;
                if (Guid.Empty == client.CityStateZipGuid)
                    return null;
                if (Guid.Empty == client.PaymentInfoGuid)
                    return null;

                DA.CityStateZipGateway cityGateway = new DA.CityStateZipGateway();
                DA.CityStateZip cityStateZip = cityGateway.GetByPK(client.CityStateZipGuid);

                // Validation of city state zip.
                if (null == cityStateZip)
                    return null;

                DA.PaymentInfoGateway paymentGateway = new DA.PaymentInfoGateway();
                DA.PaymentInfo paymentInfo = paymentGateway.GetByPK(client.PaymentInfoGuid);

                // Validation of paymentInfo.
                if (null == paymentInfo)
                    return null;

                //Full Account of Client
                BE.AccountViewModel account = EntityConversion.BuildAccountViewModel(client, cityStateZip, paymentInfo);
                accountList.Add(account);
            }

            return accountList.AsQueryable();
        }
Beispiel #8
0
        public BE.CityStateZip InsertCityStateZip(BE.CityStateZip entity)
        {
            //@@NEW
            // Check if a CityStateZip already exists with this ZipCode.
            BE.CityStateZip existingEntity = GetCityStateZipCodeByZipCode(entity.ZipCode);
            DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
            if (null != existingEntity)
            {// existing entity - problematic if first entry contains wrong city/state
                if (!existingEntity.Equals(entity))
                {// argument entity contains different city/state => update with these values
                    //// entity comes without guid from UI
                    entity.CityStateZipGuid = existingEntity.CityStateZipGuid;
                    gateway.Update(entity.ToDataEntity());
                    // should return new value
                    existingEntity = this.GetCityStateZipCodeByZipCode(entity.ZipCode);
                }

                return existingEntity;
            }

            //@@NEW - removed try/catch. insert returns DA entity (with new data). this method now returns an entity.
            DA.CityStateZip result = gateway.Insert(entity.ToDataEntity());
            return result.ToBusinessEntity();
        }
Beispiel #9
0
 public void DeleteCityStateZip(BE.CityStateZip entity)
 {
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     gateway.Delete(entity.CityStateZipGuid);
 }
Beispiel #10
0
 public void UpdateCityStateZip(BE.CityStateZip entity)
 {
     DA.CityStateZipGateway gateway = new DA.CityStateZipGateway();
     gateway.Update(entity.ToDataEntity());
 }