Beispiel #1
0
        private void CreateChangeLog()
        {
            var objectContext = ((IObjectContextAdapter)this).ObjectContext;
            var changeSet     = objectContext.ObjectStateManager.GetObjectStateEntries(EntityState.Modified | EntityState.Added | EntityState.Deleted);

            foreach (ObjectStateEntry objectStateEntry in changeSet)
            {
                BaseDao baseDao = objectStateEntry.Entity as BaseDao;
                if (baseDao == null || baseDao.ChangeLog == null)
                {
                    continue;
                }

                foreach (UnitOfWorkItem unitOfWorkItem in baseDao.ChangeLog)
                {
                    string typeName     = baseDao.GetType().FullName;
                    var    domainObject = DomainObjects.First(d => d.EntityType == typeName);

                    ChangeLog.Add(new ChangeLogDao
                    {
                        Id           = Guid.NewGuid(),
                        DomainObject = domainObject,
                        ObjectId     = baseDao.Id,
                        OldValue     = unitOfWorkItem.OldVaue == null ? null : unitOfWorkItem.OldVaue.ToString(),
                        NewValue     = unitOfWorkItem.NewValue == null ? null : unitOfWorkItem.NewValue.ToString(),
                        Property     = unitOfWorkItem.PropertyName,
                        ChangedAt    = unitOfWorkItem.TimeStamp,
                        ChangedBy    = CurrentUserId,
                        CreatedAt    = unitOfWorkItem.TimeStamp,
                        CreatedBy    = CurrentUserId
                    });
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="route">Route to send.</param>
 /// <param name="deviceID">Device ID route belong to.</param>
 /// <param name="plannedDate">Route planned date.</param>
 public Route(DomainObjects.Route route, long deviceID, DateTime plannedDate)
 {
     Name = route.Name;
     Color = _SerializeColor(route.Color);
     DeviceID = deviceID;
     Driver = route.Driver.Name;
     DriverSpecialty = _SerializeNames(route.Driver.Specialties);
     PlannedDate = plannedDate;
     Shape = route.Path;
     Vehicle = route.Vehicle.Name;
     VehicleSpecialty = _SerializeNames(route.Vehicle.Specialties);
 }
 partial void DeleteSetSong(DomainObjects.SetSong instance);
 partial void UpdateSetSong(DomainObjects.SetSong instance);
 partial void InsertSetSong(DomainObjects.SetSong instance);
 partial void DeleteShow(DomainObjects.Show instance);
 partial void UpdateShow(DomainObjects.Show instance);
Beispiel #8
0
        //================================================================================
        private void validateVesselInCompanyExistance(DomainObjects.VesselInCompany vesselInCompany, Company introducer, ICompanyDomainService companyDomainService)
        {
            var vessels = companyDomainService.GetCompanyVessels(introducer.Id);

            if (vessels.Count(v => v.Id == vesselInCompany.Id) != 1)
                throw new BusinessRuleException("", "The vessel is not assigned to company.");
        }
 /// <summary>
 /// Geocodes address and returns array of found candidates.
 /// </summary>
 /// <param name="address">Address to geocode.</param>
 /// <param name="includeDisabledLocators">Is need to add candidates from disabled locators.</param>
 /// <returns>Returns array of found address candidates.</returns>
 public abstract AddressCandidate[] GeocodeCandidates(
     DomainObjects.Address address, bool includeDisabledLocators);
 partial void UpdateSet(DomainObjects.Set instance);
 partial void InsertSet(DomainObjects.Set instance);
 public void AddNewAddress(DomainObjects.CustomerAddress customerAddress)
 {
     _addressRepostory.Create(customerAddress);
 }
Beispiel #13
0
 /// <summary>
 /// Convert an EPG Collector DVB-S2 rolloff value to a BDA value.
 /// </summary>
 /// <param name="rollOff">The EPG Collector rolloff value.</param>
 /// <returns>The BDA rolloff value.</returns>
 public static RollOff GetNativeRollOff(DomainObjects.RollOff rollOff)
 {
     switch (rollOff)
     {
         case DomainObjects.RollOff.NotDefined:
             return (RollOff.NotDefined);
         case DomainObjects.RollOff.NotSet:
             return (RollOff.NotSet);
         case DomainObjects.RollOff.RollOff20:
             return (RollOff.Twenty);
         case DomainObjects.RollOff.RollOff25:
             return (RollOff.TwentyFive);
         default:
             return (RollOff.NotSet);
     }
 }
Beispiel #14
0
 /// <summary>
 /// Convert an EPG Collector DVB-S2 pilot value to a BDA value.
 /// </summary>
 /// <param name="pilot">The EPG Collector pilot value.</param>
 /// <returns>The BDA pilot value.</returns>
 public static Pilot GetNativePilot(DomainObjects.Pilot pilot)
 {
     switch (pilot)
     {
         case DomainObjects.Pilot.NotDefined:
             return (Pilot.NotDefined);
         case DomainObjects.Pilot.NotSet:
             return (Pilot.NotSet);
         case DomainObjects.Pilot.Off:
             return (Pilot.Off);
         case DomainObjects.Pilot.On:
             return (Pilot.On);
         default:
             return (Pilot.NotSet);
     }
 }
 partial void DeleteSet(DomainObjects.Set instance);
 /// <summary>
 /// Geocodes an address and returns the best candidate.
 /// </summary>
 /// <param name="address">Address to geocode.</param>
 /// <returns>Returns address candidate with max score.</returns>
 public abstract AddressCandidate Geocode(DomainObjects.Address address);
 partial void InsertShow(DomainObjects.Show instance);
 /// <summary>
 /// Geocodes array of addresses.
 /// </summary>
 /// <param name="addresses">Array of addresses.</param>
 /// <returns>Returns array of best candidates for each input address.</returns>
 public abstract AddressCandidate[] BatchGeocode(DomainObjects.Address[] addresses);
Beispiel #19
0
 //================================================================================
 private void validateGoodUnitInCompany(Company company, DomainObjects.Good good, GoodUnit unit)
 {
     if (!(good.CompanyId == company.Id && good.GoodUnits.Count(gu => gu.Id == unit.Id) == 1))
         throw new BusinessRuleException("", string.Format("Selected Good '{0}' and Unit is not defined for Company.", good.Name));
 }