Пример #1
0
 public void TestMethod1()
 {
     try
     {
         var repo  = new ProductSuiteRepo();
         var uow   = new PDSDBUnitOfWork();
         var suite = new ProductSuite
         {
             Id         = 0,
             UniqueId   = Guid.NewGuid(),
             Name       = "Product Suite 1",
             CategoryId = 1,
             UpdatedOn  = DateTime.Now,
             CreatedOn  = DateTime.Now,
             //Versions = new List<ProductVersion>
             //{
             //    new ProductVersion { Id = 0,
             //                         StartDate = DateTime.Today,
             //                         EndDate   =DateTime.Today.AddDays(7)
             //    }   ,
             //    new ProductVersion { Id = 0,
             //                         StartDate = DateTime.Today.AddDays(8),
             //                         EndDate   =DateTime.Today.AddDays(14)
             //    }
             //}
         };
         repo.Add(suite);
         uow.SaveChanges();
     }
     catch (Exception ex)
     {
     }
 }
Пример #2
0
        private ProductSuite GetProductSuite(Kernel32.OSVERSIONINFOEX osVersion)
        {
            ProductSuite suite = (ProductSuite)osVersion.SuiteMask;

            // Query system metrics to detect other sku data...
            if (SystemMetrics.GetSystemMetric(SystemMetric.TabletPC) != 0)
            {
                suite |= ProductSuite.TabletPC;
            }

            if (SystemMetrics.GetSystemMetric(SystemMetric.MediaCenter) != 0)
            {
                suite |= ProductSuite.MediaCenter;
            }

            if (SystemMetrics.GetSystemMetric(SystemMetric.StarterEdition) != 0)
            {
                suite |= ProductSuite.StarterEdition;
            }

            if (SystemMetrics.GetSystemMetric(SystemMetric.ServerR2) != 0)
            {
                suite |= ProductSuite.ServerR2;
            }

            return(suite);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        private SystemInformation()
        {
            osVersionInfo    = GetOSVersion();
            product          = GetProduct(osVersionInfo);
            productSuite     = GetProductSuite(osVersionInfo);
            vistaProductType = GetVistaProductType(osVersionInfo);

            // calculate the build revision number by examining the file version of kernel32.dll
            // Environment.SpecialFolder.System
            string kernel32Path = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\kernel32.dll";

            kernel32Version = FileVersionInfo.GetVersionInfo(kernel32Path);
        }
Пример #4
0
        public static ProductSuiteDto ToDto(this ProductSuite suite)
        {
            suite.Versions?.ForEach(v => v.SuiteId = suite.Id);



            var dto = new ProductSuiteDto
            {
                CategoryId = suite.CategoryId,
                UniqueId   = suite.UniqueId,
                Name       = suite.Name,
                Versions   = suite.Versions?.Select(v => v.ToDto()).ToList()
            };

            ((IData)suite).ToDto((IDataDto)dto);
            return(dto);
        }
Пример #5
0
        public static ProductSuite ToDomain(this ProductSuiteDto suite, ProductSuite originalsuite = null)
        {
            suite.Versions?.ForEach(v => v.SuiteId = suite.Id);

            if (originalsuite != null && originalsuite.UniqueId == suite.UniqueId)
            {
                originalsuite.Name       = suite.Name;
                originalsuite.CategoryId = suite.CategoryId;

                originalsuite.Versions
                    = suite.Versions?.Select(v => v.ToDomain(originalsuite?.Versions.FirstOrDefault(ov => ov.UniqueId == v.UniqueId))).ToList();

                //foreach (var version in suite.Versions ?? Enumerable.Empty<ProductVersionDto>())
                //{
                //    var original = originalsuite.Versions.SingleOrDefault(l => l.Id == version.Id);
                //    if (original != null)
                //    {
                //        var updatedOriginal = version.ToDomain(original);
                //        var index = originalsuite.Versions.IndexOf(original);
                //        originalsuite.Versions[index] = updatedOriginal;
                //    }
                //    else
                //    {
                //        var Domainlayout = version.ToDomain();
                //        originalsuite.Versions.Add(Domainlayout);
                //    }

                //}

                ((IDataDto)suite).ToDomain((IData)originalsuite);
                return(originalsuite);
            }

            var data = new ProductSuite
            {
                UniqueId   = suite.UniqueId,
                Name       = suite.Name,
                CategoryId = suite.CategoryId,
                Versions   = suite.Versions?.Select(v => v.ToDomain()).ToList(),
            };

            ((IDataDto)suite).ToDomain((IData)data);
            return(data);
        }
Пример #6
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current <see cref="T:System.Object"/>.</returns>
 public override int GetHashCode()
 {
     return(Architecture.GetHashCode()
            ^ Bootable.GetHashCode()
            ^ CustomizedInfo.GetHashCode()
            ^ DefaultLanguageIndex
            ^ (String.IsNullOrEmpty(EditionId) ? 0 : EditionId.GetHashCode())
            ^ (String.IsNullOrEmpty(Hal) ? 0 : Hal.GetHashCode())
            ^ (String.IsNullOrEmpty(ImageDescription) ? 0 : ImageDescription.GetHashCode())
            ^ ImageIndex.GetHashCode()
            ^ ImageType.GetHashCode()
            ^ (String.IsNullOrEmpty(InstallationType) ? 0 : InstallationType.GetHashCode())
            ^ Languages.GetHashCode()
            ^ (String.IsNullOrEmpty(ProductName) ? 0 : ProductName.GetHashCode())
            ^ (String.IsNullOrEmpty(ProductSuite) ? 0 : ProductSuite.GetHashCode())
            ^ (String.IsNullOrEmpty(ProductType) ? 0 : ProductType.GetHashCode())
            ^ ProductVersion.GetHashCode()
            ^ SpLevel.GetHashCode()
            ^ (String.IsNullOrEmpty(SystemRoot) ? 0 : SystemRoot.GetHashCode()));
 }