Exemple #1
0
        public IEnumerable <AppDataContract> GetApps(AppFilterDataContract filter)
        {
            var appFilter = filter.ToAppFilter();
            var appsQuery = AppBiz.GetApps(appFilter)
                            .Page(appFilter);

            if (filter.Include128X128Icon && !filter.Include256X256Icon)
            {
                return(appsQuery.Select(app => new AppDataContract()
                {
                    Guid = app.Guid,
                    Name = app.Name,
                    Icon128X128 = app.Icon128X128,
                    Price = app.Price
                }).ToList());
            }
            else
            {
                return(appsQuery.Select(app => new AppDataContract()
                {
                    Guid = app.Guid,
                    Name = app.Name,
                    Price = app.Price
                }).ToList());
            }
        }
Exemple #2
0
        public AppDataContract GetAppDetail(AppFilterDataContract filter, bool includeAppLatestVersion = false)
        {
            Expression <Func <App, bool> > predicate = (a => a.Guid == filter.AppGuid);
            App app;

            if (!filter.Include128X128Icon && !filter.Include256X256Icon)
            {
                app = AppBiz.GetAppWithoutIcons(predicate);
            }
            else if (filter.Include128X128Icon && !filter.Include256X256Icon)
            {
                app = AppBiz.GetAppWith128X128Icon(predicate);
            }
            else if (!filter.Include128X128Icon && filter.Include256X256Icon)
            {
                app = AppBiz.GetAppWith256X256Icon(predicate);
            }
            else
            {
                app = AppBiz.GetAppWithIcons(predicate);
            }

            var appDc = app.ToAppDataContract();

            if (!includeAppLatestVersion)
            {
                return(appDc);
            }
            appDc.LatestVersion = app.AppVersions.OrderByDescending(appVersion => appVersion.PublishDate).First().ToAppVersionDataContract();
            return(appDc);
        }
Exemple #3
0
 public IEnumerable <AppVersionDataContract> GetAppsLatestVersionInfo(IEnumerable <Guid> appGuids)
 {
     return(AppBiz.GetAppsLatestVersion(appGuids).Select(appVersion => new AppVersionDataContract()
     {
         AppGuid = appVersion.App.Guid,
         Version = appVersion.Version,
         PublishDate = appVersion.PublishDate,
     }).ToList());
 }
Exemple #4
0
 public AppDomainService()
 {
     _context       = new WindowsStoreContext();
     AppBiz         = new AppBiz(_context);
     PlatformBiz    = new PlatformBiz(_context);
     AppCategoryBiz = new AppCategoryBiz(_context);
     AppVersionBiz  = new AppVersionBiz(_context);
     ScreenshotBiz  = new ScreenshotBiz(_context);
 }
Exemple #5
0
        public void SetUp()
        {
            #region Initial fake data of constructor

            _configContext = new ConfigContext
            {
                McpDb              = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;",
                UploadPath         = "C:/AppOs",
                ImageEndPoint      = "http://*****:*****@$ "{AppContext.BaseDirectory.Substring(0, AppContext.BaseDirectory.IndexOf(" Wistron.AppStore.Web "))}\{@" Wistron.AppStore.Web \ Wistron.AppStore.Web \ wwwroot\unittest "}";
Exemple #6
0
        public void UpdateAppSpecification(AppSpecificationDataContract appSpecification)
        {
            AppBiz.UpdatePartially(appSpecification.ToApp()
                                   , a => a.Name
                                   , a => a.Price
                                   , a => a.AppCategoryId
                                   , a => a.Description);

            _context.SaveChanges();
        }
Exemple #7
0
        public ScreenshotDataContract GetAppScreenshot(ScreenshotFilterDataContract filter)
        {
            var bytes = AppBiz.GetAppScreenshot(filter.AppGuid, filter.ScreenshotType, filter.ScreenshotSize, filter.ScreenshotIndex);

            return(new ScreenshotDataContract()
            {
                Original = filter.ScreenshotSize == ScreenshotSize.Original ? bytes : null,
                Thumbnail = filter.ScreenshotSize == ScreenshotSize.Thumbnail ? bytes : null,
            });
        }
Exemple #8
0
        public AppVersionDataContract RegisterAppVersion(AppVersionDataContract appVersionDataContract)
        {
            var result = AppVersionBiz.Create(appVersionDataContract.ToAppVersion()).ToAppVersionDataContract();
            var app    = AppBiz.Single(a => a.Id == appVersionDataContract.AppId);

            app.State = AppState.Published;
            AppBiz.UpdatePartially(app, a => a.State);
            _context.SaveChanges();
            return(result);
        }
Exemple #9
0
        public void RegisterAppIcon(AppIconDataContract appIconDataContract)
        {
            var app = appIconDataContract.ToApp();

            if (appIconDataContract.Icon128X128 == null)
            {
                app.Icon128X128 = ImageConverter.ResizeByteArrayImage(appIconDataContract.Icon256X256, 128, 128);
            }

            AppBiz.UpdatePartially(appIconDataContract.ToApp(), a => a.Icon128X128, a => a.Icon256X256);
            _context.SaveChanges();
        }
Exemple #10
0
        public AppSpecificationDataContract RegisterAppSpecification(AppSpecificationDataContract appSpecificationDataContract, int developerId)
        {
            var app = appSpecificationDataContract.ToApp();

            // set app intial state
            app.State       = AppState.Incomplete;
            app.Guid        = Guid.NewGuid();
            app.DeveloperId = developerId;
            // register app
            var savedApp = AppBiz.Create(app);

            _context.SaveChanges();

            return(savedApp.ToAppSpecificationDataContract());
        }
Exemple #11
0
        public IEnumerable <AppDataContract> GetRandomApps(AppFilterDataContract filter)
        {
            var appFilter = filter.ToAppFilter();
            var apps      = AppBiz
                            .GetApps(appFilter)
                            .OrderBy(app => Guid.NewGuid())
                            .Take(filter.PageSize)
                            .Select(app => new AppDataContract()
            {
                Guid        = app.Guid,
                Name        = app.Name,
                Icon128X128 = app.Icon128X128,
                Price       = app.Price
            }).ToList();

            return(apps);
        }
Exemple #12
0
        public void RegisterAppPlatformSpecification(AppPlatformSpecificationDataContract appPlatformSpecificationDataContract)
        {
            // update CpuArchitecture
            AppBiz.UpdatePartially(appPlatformSpecificationDataContract.ToApp(), a => a.CpuArchitectureFlags);


            // update AppPlatformCategories
            // fetch app
            var app = _context.Apps.Include("Platforms").Single(a => a.Id == appPlatformSpecificationDataContract.AppId);

            var oldPlatforms = app.Platforms.ToList();

            //var person = PersonBiz.Single(p => p.Id == userId);
            //var role = RoleBiz.Single(r => r.Name == roleName);

            //person.Roles.Add(role);
            // remove all app platforms
            foreach (var platform in oldPlatforms)
            {
                app.Platforms.Remove(platform);
            }

            // fetch all platforms
            // var platformCategories = _context.Platforms.ToList();

            var newPlatforms =
                PlatformBiz.Where(p => appPlatformSpecificationDataContract.PlatformCategories.Contains(p.Id));

            // add platforms that exist in list into appPltforms
            foreach (var platform in newPlatforms)
            {
                app.Platforms.Add(platform);
            }

            _context.SaveChanges();
        }
        public void SetUp()
        {
            #region Initial fake data of constructor

            _configContext = new ConfigContext
            {
                McpDb              = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;",
                UploadPath         = "C:/AppOs",
                ImageEndPoint      = "http://*****:*****@gmail.com",
                Category         = "wistron_app",
                DescriptionCh    = "Test",
                DescriptionEn    = "Test",
                AppOpen          = true,
                AppUserGroup     = "",
                AppUserGroupName = ""
            };

            _inSideOrOutSideApp = new List <InSideOrOutSideApp>
            {
                new InSideOrOutSideApp
                {
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc1",
                    AppName    = "Test AppName1",
                    CompanyApp = "Inside App",
                    IsTopCount = 1
                },
                new InSideOrOutSideApp
                {
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc2",
                    AppName    = "Test AppName2",
                    CompanyApp = "Inside App",
                    IsTopCount = 1
                },
                new InSideOrOutSideApp
                {
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc3",
                    AppName    = "Test AppName3",
                    CompanyApp = "Outside App",
                    IsTopCount = 1
                },
                new InSideOrOutSideApp
                {
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc4",
                    AppName    = "Test AppName4",
                    CompanyApp = "Outside App",
                    IsTopCount = 1
                },
            };

            _wisApp = new WisAppList
            {
                AppName       = "Test AppName",
                AppNameEn     = "Test AppName",
                Development   = "MCP Developer",
                Email         = "*****@*****.**",
                Category      = "wistron_app",
                DescriptionCh = "Test",
                DescriptionEn = "Test",
                AppUserGroup  = "1,2"
            };

            _wisDefineGroups = new List <WisDefineGroup>
            {
                new WisDefineGroup
                {
                    GroupID        = "1",
                    GroupName      = "ePaper",
                    SelectGroup    = "1",
                    GroupInclude   = "",
                    SelectAccount  = "2",
                    AccountInclude = "9012016,9303064"
                },
                new WisDefineGroup
                {
                    GroupID        = "2",
                    GroupName      = "WistronArk",
                    SelectGroup    = "1",
                    GroupInclude   = "8177818",
                    SelectAccount  = "1",
                    AccountInclude = "10610056,10704054"
                }
            };

            #endregion

            //fake service
            _appListService    = Substitute.For <IAppListService>();
            _uploadFileService = Substitute.For <IUploadFileService>();
            _authService       = Substitute.For <IAuthService>();

            _targetObj = new AppBiz(_configContext, _appListService, _uploadFileService, _mapper, _authService);
        }
Exemple #14
0
        public void SetUp()
        {
            #region Initial fake data of constructor

            _configContext = new ConfigContext
            {
                McpDb              = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;",
                UploadPath         = "C:/AppOs",
                ImageEndPoint      = "http://*****:*****@gmail.com",
                Category       = "wistron App",
                DescriptionCh  = "App說明-中文",
                DescriptionEn  = "App說明-英文",
                LastUpdateUser = "******",
                LastUpdateDT   = DateTime.Now,
                CreateDT       = DateTime.Now,
                IsTop          = true,
                CompanyApp     = true,
                Delflag        = false,
                AppOpen        = true,
                AppUserGroup   = "1, 2"
            };

            _wisAppOs = new List <WisAppOs>
            {
                //以下為 IOS
                // Status 為啟用
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.1",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = true,
                    DescriptionCh  = "版本更新 1.0.1",
                    DescriptionEn  = "The version is update 1.0.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                // Status 為不啟用
                new WisAppOs
                {
                    AppOSID        = 3,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.0",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 1.0.0",
                    DescriptionEn  = "The version is update 1.0.0",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },

                //以下為 Android
                //Status 為啟用
                new WisAppOs
                {
                    AppOSID        = 8,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 2,
                    Version        = "1.0.1",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "Portal 2.0_20201021(Dev 0.2.2).apk",
                    Status         = true,
                    DescriptionCh  = "版本更新 1.0.1",
                    DescriptionEn  = "The version is update 1.0.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                    WebDownFlag    = true,
                },
                //Status 為不啟用
                new WisAppOs
                {
                    AppOSID        = 9,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 2,
                    Version        = "1.0.0",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "Portal 2.0_20201021(Dev 0.2.2).apk",
                    Status         = false,
                    DescriptionCh  = "版本更新 1.0.0",
                    DescriptionEn  = "The version is update 1.0.0",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                    WebDownFlag    = true,
                }
            };

            _wisAppPhoto = new List <WisAppPhoto>
            {
                new WisAppPhoto
                {
                    AppPhotoID = 22,
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOS      = 1,
                    FileNumber = 5,
                    FileName   = "024abd90fb4c49149156aff2d5fd99ac.png",
                    FilePath   = "PortalApp2.0/Android/Images/024abd90fb4c49149156aff2d5fd99ac.png",
                    PhotoType  = 1 // 1= Icon 圖片 2 = 一般圖片
                },
                new WisAppPhoto
                {
                    AppPhotoID = 23,
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOS      = 2,
                    FileNumber = 5,
                    FileName   = "398ce584d4304c518c0cf17128fd2001.png",
                    FilePath   = "PortalApp2.0/IOS/Images/398ce584d4304c518c0cf17128fd2001.png",
                    PhotoType  = 1
                }
            };

            _wisDefineGroup = new List <WisDefineGroup>
            {
                new WisDefineGroup
                {
                    GroupID        = "1",
                    GroupName      = "WZS All users",
                    SelectGroup    = "1",
                    GroupInclude   = "A33,A13,A10",
                    SelectAccount  = "1",
                    AccountInclude = "10609123,200503036,2008L0323"
                },
                new WisDefineGroup
                {
                    GroupID        = "2",
                    GroupName      = "ML10-Dept",
                    SelectGroup    = "2",
                    GroupInclude   = "ML1500,ML1400,ML1100",
                    SelectAccount  = "1",
                    AccountInclude = ""
                }
            };

            _wisAppOsOthers = new List <WisAppOsOther>
            {
                new WisAppOsOther
                {
                    AppOtherID     = 88,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOsID        = 2,
                    Site           = "WKS",
                    OSType         = 1,
                    Version        = "1.0.1",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now
                }
            };

            _iosWisAppOsOthers = new List <WisAppOsOther>();

            _androidWisAppOsOthers = new List <WisAppOsOther>();

            _appOsInfo = new AppOsInfo
            {
                AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                AppOSID       = 2,
                OSType        = DeviceType.Ios,
                AppName       = "Test AppName",
                AppNameEn     = "Test AppName",
                PackageName   = "com.wistron.portalapp.dev",
                Version       = "1,0.1",
                FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                Status        = true,
                WebDownFlag   = true,
                DescriptionCh = "版本更新 1.0.1",
                DescriptionEn = "The version is update 1.0.1",
                CreateDT      = DateTime.Now,
                LastUpdateDT  = DateTime.Now,
                AppOsHistory  = new List <AppOsInfo>
                {
                    new AppOsInfo
                    {
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID       = 3,
                        OSType        = 1,
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        PackageName   = "com.wistron.portalapp.dev",
                        Version       = "1,0.0",
                        FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                        FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                        Status        = false,
                        WebDownFlag   = true,
                        DescriptionCh = "版本更新 1.0.0",
                        DescriptionEn = "The version is update 1.0.0",
                        CreateDT      = DateTime.Now,
                        LastUpdateDT  = DateTime.Now,
                    },
                    new AppOsInfo
                    {
                        AppID         = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOSID       = 2,
                        OSType        = 1,
                        AppName       = "Test AppName",
                        AppNameEn     = "Test AppName",
                        PackageName   = "com.wistron.portalapp.dev",
                        Version       = "1,0.1",
                        FileName      = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                        FilePath      = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                        Status        = true,
                        WebDownFlag   = true,
                        DescriptionCh = "版本更新 1.0.1",
                        DescriptionEn = "The version is update 1.0.1",
                        CreateDT      = DateTime.Now,
                        LastUpdateDT  = DateTime.Now,
                    }
                },
                Photo = new List <AppPhotoContent>
                {
                    new AppPhotoContent
                    {
                        AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                        AppOS      = 1,
                        FileNumber = 5,
                        FileName   = "024abd90fb4c49149156aff2d5fd99ac.png",
                        FilePath   = "PortalApp2.0/Android/Images/024abd90fb4c49149156aff2d5fd99ac.png",
                        PhotoType  = 1  // 1= Icon 圖片 2 = 一般圖片
                    }
                }
            };

            #endregion

            //fake service
            _appListService    = Substitute.For <IAppListService>();
            _uploadFileService = Substitute.For <IUploadFileService>();
            _authService       = Substitute.For <IAuthService>();

            _targetObj = new AppBiz(_configContext, _appListService, _uploadFileService, _mapper, _authService);
        }
Exemple #15
0
        public IEnumerable <AppDetailDataContract> GetDeveloperApps(int developerId)
        {
            var result =
                (from a in AppBiz.GetAll(a => a.AppVersions, a => a.Platforms, a => a.AppCategory, a => a.Ratings)
                 where a.DeveloperId == developerId
                 select new
            {
                AppId = a.Id,
                a.Guid,
                a.AppCategory.AppType,
                CategoryId = a.AppCategoryId,
                a.Description,
                a.Name,
                a.State,
                a.Price,
                a.Icon128X128,
                a.Icon256X256,
                a.CpuArchitectureFlags,
                PlatformCategories = a.Platforms.Select(p => p.Id),
                DownloadsCount =
                    a.AppVersions.Any(v => v.AppId == a.Id)
                             ? a.AppVersions.Where(v => v.AppId == a.Id).Sum(v => v.Downloads)
                             : 0,
                CommentsCount = a.Ratings.Count(r => r.AppId == a.Id),
                LastVersion = a.AppVersions.OrderByDescending(v => v.PublishDate).FirstOrDefault(),
                MobileScreenshotsCount = a.Screenshots.Count(sc => sc.AppId == a.Id && sc.Type == ScreenshotType.Mobile),
                DesktopScreenshotsCount = a.Screenshots.Count(sc => sc.AppId == a.Id && sc.Type == ScreenshotType.Mobile)
            }).ToList();

            var dataContractResult = (from a in result
                                      select new AppDetailDataContract
            {
                AppSpecificationDataContract =
                    new AppSpecificationDataContract
                {
                    AppId = a.AppId,
                    Guid = a.Guid,
                    AppType = a.AppType,
                    CategoryId = a.CategoryId,
                    Description = a.Description,
                    Name = a.Name,
                    Price = a.Price,
                    State = a.State,
                    DownloadsCount = a.DownloadsCount,
                    CommentsCount = a.CommentsCount,
                    MobileScreenshotsCount = a.MobileScreenshotsCount,
                    DesktopScreenshotsCount = a.DesktopScreenshotsCount
                },
                AppIconDataContract =
                    new AppIconDataContract
                {
                    AppId = a.AppId,
                    Icon128X128 = a.Icon128X128,
                    Icon256X256 = a.Icon256X256
                },
                AppPlatformSpecificationDataContract = new AppPlatformSpecificationDataContract
                {
                    AppId = a.AppId,
                    CpuArchitectureFlags = a.CpuArchitectureFlags,
                    PlatformCategories = a.PlatformCategories
                },
                AppVersionDataContract = a.LastVersion?.ToAppVersionDataContract()
            }).ToList();


            foreach (var item in dataContractResult.Where(item => item.AppVersionDataContract != null))
            {
                item.AppVersionDataContract.CpuArchitectureFlags =
                    item.AppPlatformSpecificationDataContract.CpuArchitectureFlags;
                item.AppVersionDataContract.HasArmPackage = ExistPackage(item.AppSpecificationDataContract.Guid,
                                                                         CpuArchitecture.Arm);
                item.AppVersionDataContract.HasX64Package = ExistPackage(item.AppSpecificationDataContract.Guid,
                                                                         CpuArchitecture.X64);
                item.AppVersionDataContract.HasX86Package = ExistPackage(item.AppSpecificationDataContract.Guid,
                                                                         CpuArchitecture.X86);
            }

            return(dataContractResult);
        }
Exemple #16
0
 public byte[] GetAppIcon128(Guid appGuid)
 {
     return(AppBiz.Where(a => a.Guid == appGuid).Select(a => a.Icon128X128).Single());
 }
Exemple #17
0
 public void RegisterApp(AppDataContract appDataContract)
 {
     AppBiz.Create(appDataContract.ToApp());
     _context.SaveChanges();
 }
Exemple #18
0
 public bool ExistsAppName(string appName, int appId)
 {
     return(AppBiz.Any(app => app.Name == appName && app.Id != appId));
 }
Exemple #19
0
 public void RegisterUploadedAppExtraInformation(int appId, int platformId)
 {
     AppBiz.AssociatePlatformToApp(appId, platformId);
     _context.SaveChanges();
 }
Exemple #20
0
 public MemberController(AppBiz appBiz, ConfigContext configContext)
 {
     _appBiz        = appBiz;
     _configContext = configContext;
 }
        public void SetUp()
        {
            #region Initial fake data of constructor

            _configContext = new ConfigContext
            {
                McpDb              = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;",
                UploadPath         = "C:/AppOs",
                ImageEndPoint      = "http://localhost:53322/app",
                IosDownloadAddress = "itms-services://?action=download-manifest&url="
            };

            _appList = new List <AppListItem>
            {
                new AppListItem {
                    AppID       = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOSID     = "22",
                    Status      = true,
                    CompanyApp  = true,
                    IsTop       = true,
                    AppName     = "Test AppName",
                    PackageName = "com.wistron.portalapp.dev",
                    Development = "MCP development",
                    CreateDT    = DateTime.Now,
                    OSType      = "IOS",
                    Version     = "1.0.0",
                    FileName    = "Portal 2.0_20201022(Dev 0.2.3).apk",
                    FilePath    = "ITSM/IOS/Install/23eb89786e364260ae789d0ec433d724.plist"
                }
            };

            _appListItem = new AppListItem
            {
                AppID       = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                AppOSID     = "22",
                Status      = false,
                CompanyApp  = true,
                IsTop       = true,
                AppName     = "Test AppName",
                PackageName = "com.wistron.portalapp.dev",
                Development = "MCP development",
                CreateDT    = DateTime.Now,
                OSType      = "IOS",
                Version     = "1.0.0",
                FileName    = "Portal 2.0_20201022(Dev 0.2.3).apk",
                FilePath    = "ITSM/IOS/Install/23eb89786e364260ae789d0ec433d724.plist"
            };

            _alreadyEnabled = new WisAppOs
            {
                AppID   = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                AppOSID = 22,
                OSType  = 1
            };

            //fake service
            _appListService    = Substitute.For <IAppListService>();
            _uploadFileService = Substitute.For <IUploadFileService>();
            _mapper            = Substitute.For <IMapper>();
            _authService       = Substitute.For <IAuthService>();

            #endregion

            _targetObj = new AppBiz(_configContext, _appListService, _uploadFileService, _mapper, _authService);
        }
Exemple #22
0
 public string GetAppScreenshotFilePath(Guid appGuid, ScreenshotType screenshotType, ScreenshotSize screenshotSize, int screenshotIndex)
 {
     return(AppBiz.GetAppScreenshotFilePath(appGuid, screenshotType, screenshotSize, screenshotIndex));
 }
Exemple #23
0
 public void IncrementAppLatestVersionDownloads(Guid guid, int incerementValue = 1)
 {
     AppBiz.IncrementAppLatestVersionDownloads(guid, incerementValue);
     _context.SaveChanges();
 }
Exemple #24
0
        public void SetUp()
        {
            #region Initial fake data of constructor

            _configContext = new ConfigContext
            {
                McpDb              = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;",
                UploadPath         = "C:/AppOs",
                ImageEndPoint      = "http://*****:*****@gmail.com",
                Category       = "wistron App",
                DescriptionCh  = "App說明-中文",
                DescriptionEn  = "App說明-英文",
                LastUpdateUser = "******",
                LastUpdateDT   = DateTime.Now,
                CreateDT       = DateTime.Now,
                IsTop          = true,
                CompanyApp     = true,
                Delflag        = false,
                AppOpen        = true,
                AppUserGroup   = null
            };

            _wisAppOs = new List <WisAppOs>
            {
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.0",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = true,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.1",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.2",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.3",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.4",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 2,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 1,
                    Version        = "1.0.5",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "PortalApp2.0/IOS/Install/0.2.1-ef04db152ccd4d1893998ec1f07fcc06.ipa",
                    Status         = false,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist",
                    WebDownFlag    = true,
                },
                new WisAppOs
                {
                    AppOSID        = 3,
                    AppID          = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    OSType         = 2,
                    Version        = "1.0.1",
                    PackageName    = "com.wistron.portalapp.dev",
                    FileName       = "Portal 2.0_20201021(Dev 0.2.2).apk",
                    Status         = true,
                    DescriptionCh  = "版本更新 0.2.1",
                    DescriptionEn  = "The version is update 0.2.1",
                    LastUpdateUser = "******",
                    LastUpdateDT   = DateTime.Now,
                    CreateDT       = DateTime.Now,
                    DelFlag        = false,
                    FilePath       = "PortalApp2.0/Android/Install/0.2.2-9e5f0b8dd1bf467096272cb1c41cca1d.apk",
                    WebDownFlag    = true,
                }
            };

            _wisAppPhoto = new List <WisAppPhoto>
            {
                new WisAppPhoto
                {
                    AppPhotoID = 22,
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOS      = 1,
                    FileNumber = 5,
                    FileName   = "024abd90fb4c49149156aff2d5fd99ac.png",
                    FilePath   = "PortalApp2.0/Android/Images/024abd90fb4c49149156aff2d5fd99ac.png",
                    PhotoType  = 1 // 1= Icon 圖片 2 = 一般圖片
                },
                new WisAppPhoto
                {
                    AppPhotoID = 23,
                    AppID      = "4beedc78-0d31-496e-bb9c-81a79c9c6bc6",
                    AppOS      = 2,
                    FileNumber = 5,
                    FileName   = "398ce584d4304c518c0cf17128fd2001.png",
                    FilePath   = "PortalApp2.0/IOS/Images/398ce584d4304c518c0cf17128fd2001.png",
                    PhotoType  = 1
                }
            };

            _downloadUrlList = new List <DownloadUrlList>
            {
                new DownloadUrlList {
                    Site = "WHQ", Url = "http://localhost:53322/app/PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist"
                },
                new DownloadUrlList {
                    Site = "WKS", Url = "http://10.66.20.108:8087/app/PortalApp2.0/IOS/Install/b2fcbfb55f5e4aa4a75a40e5ea09b514.plist"
                }
            };

            #endregion

            //fake service
            _appListService    = Substitute.For <IAppListService>();
            _uploadFileService = Substitute.For <IUploadFileService>();
            _authService       = Substitute.For <IAuthService>();

            _targetObj = new AppBiz(_configContext, _appListService, _uploadFileService, _mapper, _authService);
        }
Exemple #25
0
 public AdminController(AppBiz appBiz, ConfigContext configContext)
 {
     _appBiz        = appBiz;
     _configContext = configContext;
 }