示例#1
0
 public static void ToEntity(DT.Downtime source, Downtime target)
 {
     if ((source != null) && (target != null))
     {
         target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate;
     }
 }
示例#2
0
 public Guid AddDowntime(DT.Downtime dto)
 {
     using (var db = CreateContext()) {
         var entity = Convert.ToEntity(dto);
         db.Downtimes.InsertOnSubmit(entity);
         db.SubmitChanges();
         return(entity.DowntimeId);
     }
 }
示例#3
0
        public static Downtime ToEntity(DT.Downtime source)
        {
            if (source == null)
            {
                return(null);
            }
            var entity = new Downtime(); ToEntity(source, entity);

            return(entity);
        }
示例#4
0
 public void UpdateDowntime(DT.Downtime dto)
 {
     using (var db = CreateContext()) {
         var entity = db.Downtimes.FirstOrDefault(x => x.DowntimeId == dto.Id);
         if (entity == null)
         {
             db.Downtimes.InsertOnSubmit(Convert.ToEntity(dto));
         }
         else
         {
             Convert.ToEntity(dto, entity);
         }
         db.SubmitChanges();
     }
 }