Пример #1
0
 public Contact CreateObject(Contact contact, ICityLocationService _citylocationService)
 {
     contact.Errors = new Dictionary <String, String>();
     if (!isValid(_validator.VCreateObject(contact, this, _citylocationService)))
     {
         contact.MasterCode = _repository.GetLastMasterCode(contact.OfficeId) + 1;
         contact.AgentCode  = (contact.IsAgent) ? (_repository.GetLastAgentCode(contact.OfficeId) + 1) : contact.AgentCode;
         if (contact.IsConsignee == true)
         {
             contact.ConsigneeCode = _repository.GetLastConsigneeCode(contact.OfficeId) + 1;
         }
         if (contact.IsDepo == true)
         {
             contact.DepoCode = _repository.GetLastDepoCode(contact.OfficeId) + 1;
         }
         if (contact.IsEMKL == true)
         {
             contact.EMKLCode = _repository.GetLastEMKLCode(contact.OfficeId) + 1;
         }
         if (contact.IsIATA == true)
         {
             contact.IATACode = _repository.GetLastIATACode(contact.OfficeId) + 1;
         }
         if (contact.IsShipper == true)
         {
             contact.ShipperCode = _repository.GetLastShipperCode(contact.OfficeId) + 1;
         }
         if (contact.IsSSLine == true)
         {
             contact.SSLineCode = _repository.GetLastSSLineCode(contact.OfficeId) + 1;
         }
         contact = _repository.CreateObject(contact);
     }
     return(contact);
 }
Пример #2
0
 public Airport UpdateObject(Airport airport, ICityLocationService _citylocationservice)
 {
     if (!isValid(_validator.VUpdateObject(airport, this, _citylocationservice)))
     {
         airport = _repository.UpdateObject(airport);
     }
     return(airport);
 }
Пример #3
0
 public Port UpdateObject(Port port, ICityLocationService _citylocationService)
 {
     if (!isValid(_validator.VUpdateObject(port, this, _citylocationService)))
     {
         port = _repository.UpdateObject(port);
     }
     return(port);
 }
Пример #4
0
 public Airport CreateObject(Airport airport, ICityLocationService _citylocationservice)
 {
     airport.Errors = new Dictionary <String, String>();
     if (!isValid(_validator.VCreateObject(airport, this, _citylocationservice)))
     {
         airport.MasterCode = _repository.GetLastMasterCode(airport.OfficeId) + 1;
         airport            = _repository.CreateObject(airport);
     }
     return(airport);
 }
Пример #5
0
 public CityLocation VName(CityLocation citylocation, ICityLocationService _citylocationService)
 {
     if (String.IsNullOrEmpty(citylocation.Name) || citylocation.Name.Trim() == "")
     {
         citylocation.Errors.Add("Name", "Tidak boleh kosong");
     }
     else if (_citylocationService.IsNameDuplicated(citylocation))
     {
         citylocation.Errors.Add("Name", "Tidak boleh diduplikasi");
     }
     return(citylocation);
 }
Пример #6
0
        public CityLocation VObject(CityLocation citylocation, ICityLocationService _citylocationService)
        {
            CityLocation oldcitylocation = _citylocationService.GetObjectById(citylocation.Id);

            if (oldcitylocation == null)
            {
                citylocation.Errors.Add("Generic", "Invalid Data For Update");
            }
            else if (!VOffice(citylocation.OfficeId, oldcitylocation.OfficeId))
            {
                citylocation.Errors.Add("Generic", "Invalid Data For Update");
            }
            return(citylocation);
        }
Пример #7
0
        public Airport VCityLocation(Airport airport, ICityLocationService _citylocationservice)
        {
            CityLocation citylocation = _citylocationservice.GetObjectById(airport.CityLocationId);

            if (citylocation == null)
            {
                airport.Errors.Add("City", "Tidak boleh kosong");
            }
            else if (VOffice(airport.OfficeId, citylocation.OfficeId))
            {
                airport.Errors.Add("City", "Invalid City");
            }
            return(airport);
        }
Пример #8
0
        public Contact VCity(Contact contact, ICityLocationService _citylocationService)
        {
            CityLocation citylocation = _citylocationService.GetObjectById(contact.CityId);

            if (citylocation == null)
            {
                contact.Errors.Add("City", "Tidak boleh kosong");
            }
            else if (!VOffice(citylocation.OfficeId, contact.OfficeId))
            {
                citylocation.Errors.Add("Country", "Invalid Country");
            }
            return(contact);
        }
Пример #9
0
 public CityLocation VCreateObject(CityLocation citylocation, ICityLocationService _citylocationService, ICountryLocationService _countrylocationservice)
 {
     VName(citylocation, _citylocationService);
     if (!isValid(citylocation))
     {
         return(citylocation);
     }
     VAbbrevation(citylocation);
     if (!isValid(citylocation))
     {
         return(citylocation);
     }
     VCountryLocation(citylocation, _countrylocationservice);
     if (!isValid(citylocation))
     {
         return(citylocation);
     }
     return(citylocation);
 }
Пример #10
0
 public Port VCreateObject(Port port, IPortService _portService, ICityLocationService _citylocationservice)
 {
     VName(port, _portService);
     if (!isValid(port))
     {
         return(port);
     }
     VAbbrevation(port, _portService);
     if (!isValid(port))
     {
         return(port);
     }
     VCityLocation(port, _citylocationservice);
     if (!isValid(port))
     {
         return(port);
     }
     return(port);
 }
Пример #11
0
 public Contact UpdateObject(Contact contact, ICityLocationService _citylocationService)
 {
     if (!isValid(_validator.VUpdateObject(contact, this, _citylocationService)))
     {
         if (contact.IsAgent == true && contact.AgentCode == null)
         {
             contact.AgentCode = _repository.GetLastAgentCode(contact.OfficeId) + 1;
         }
         if (contact.IsConsignee == true && contact.ConsigneeCode == null)
         {
             contact.ConsigneeCode = _repository.GetLastConsigneeCode(contact.OfficeId) + 1;
         }
         if (contact.IsDepo == true && contact.DepoCode == null)
         {
             contact.DepoCode = _repository.GetLastDepoCode(contact.OfficeId) + 1;
         }
         if (contact.IsEMKL == true && contact.EMKLCode == null)
         {
             contact.EMKLCode = _repository.GetLastEMKLCode(contact.OfficeId) + 1;
         }
         if (contact.IsIATA == true && contact.IATACode == null)
         {
             contact.IATACode = _repository.GetLastIATACode(contact.OfficeId) + 1;
         }
         if (contact.IsShipper == true && contact.ShipperCode == null)
         {
             contact.ShipperCode = _repository.GetLastShipperCode(contact.OfficeId) + 1;
         }
         if (contact.IsSSLine == true && contact.SSLineCode == null)
         {
             contact.SSLineCode = _repository.GetLastSSLineCode(contact.OfficeId) + 1;
         }
         contact = _repository.UpdateObject(contact);
     }
     return(contact);
 }
Пример #12
0
 public ShipmentOrder VOBL(ShipmentOrder shipmentorder, IShipmentOrderService _shipmentorderService, IContactService _contactService, ICityLocationService _cityService)
 {
     if (shipmentorder.OBLStatus != "P")
     {
         if (shipmentorder.OBLCollectId == null)
         {
             shipmentorder.Errors.Add("Generic", "Invalid Freight Collect At");
         }
         else if (_cityService.GetObjectById(shipmentorder.OBLCollectId.Value) == null)
         {
             shipmentorder.Errors.Add("Generic", "Invalid Freight Collect At");
         }
     }
     return(shipmentorder);
 }
Пример #13
0
 public Airport VUpdateObject(Airport airport, IAirportService _airportService, ICityLocationService _citylocationservice)
 {
     VObject(airport, _airportService);
     if (!isValid(airport))
     {
         return(airport);
     }
     VName(airport, _airportService);
     if (!isValid(airport))
     {
         return(airport);
     }
     VAbbrevation(airport);
     if (!isValid(airport))
     {
         return(airport);
     }
     VCityLocation(airport, _citylocationservice);
     if (!isValid(airport))
     {
         return(airport);
     }
     return(airport);
 }
Пример #14
0
 public Contact VCreateObject(Contact contact, IContactService _contactService, ICityLocationService _citylocationService)
 {
     VName(contact, _contactService);
     if (!isValid(contact))
     {
         return(contact);
     }
     VStatus(contact);
     if (!isValid(contact))
     {
         return(contact);
     }
     VCity(contact, _citylocationService);
     if (!isValid(contact))
     {
         return(contact);
     }
     VAddress(contact);
     if (!isValid(contact))
     {
         return(contact);
     }
     VType(contact);
     if (!isValid(contact))
     {
         return(contact);
     }
     return(contact);
 }