コード例 #1
0
 public ComponentView(Component source)
 {
     if (source == null)
     {
         return;
     }
     Id                       = source.Id;
     AircaraftId              = source.AircaraftId;
     PartNumber               = source.PartNumber;
     ManufactureDate          = source.ManufactureDate.Value;
     IsBaseComponent          = source.IsBaseComponent;
     LLPMark                  = source.LLPMark;
     LLPCategories            = source.LLPCategories;
     _threshold               = new Threshold();
     Warranty                 = Lifelength.ConvertFromByteArray(source.Warranty);
     WarrantyNotify           = Lifelength.ConvertFromByteArray(source.WarrantyNotify);
     LifeLimit                = Lifelength.ConvertFromByteArray(source.LifeLimit);
     LifeLimitNotify          = Lifelength.ConvertFromByteArray(source.LifeLimitNotify);
     ActualStateRecords       = source.ActualStateRecords?.Select(i => new ActualStateRecordView(i)).ToList();
     TransferRecords          = source.TransferRecords?.Select(i => new TransferRecordView(i)).ToList();
     ChangeLLPCategoryRecords = source.ChangeLLPCategoryRecords?.Select(i => new ComponentLLPCategoryChangeRecordView(i)).ToList();
     ComponentDirectives      = source.ComponentDirectives?.Select(i => new ComponentDirectiveView(i)).ToList();
     LLPData                  = source.LLPData?.Select(i => new ComponentLLPCategoryDataView(i)).ToList();
     AverageUtilization       = AverageUtilization.ConvertFromByteArray(source.AverageUtilization);
 }
コード例 #2
0
 /// <summary>
 /// Переводит объкт баззы данных в ToAverageUtilization
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public static AverageUtilization ToAverageUtilization(object o)
 {
     if (o == null || o == DBNull.Value)
     {
         return(new AverageUtilization(0, 0, UtilizationInterval.Dayly));
     }
     return(AverageUtilization.ConvertFromByteArray((byte[])o));
 }