public int EditCatalog(CatalogData objDoCatalog) { int retValue; try { System.Data.SqlClient.SqlParameter[] obj = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@System_Code", objDoCatalog.SystemCode), new System.Data.SqlClient.SqlParameter("@System_Description", objDoCatalog.System_Description), new System.Data.SqlClient.SqlParameter("@System_Particulars", objDoCatalog.System_Particulars), new System.Data.SqlClient.SqlParameter("@Maker", objDoCatalog.Maker), new System.Data.SqlClient.SqlParameter("@Functions", objDoCatalog.Functions), new System.Data.SqlClient.SqlParameter("@Set_Instaled", objDoCatalog.Set_Installed), new System.Data.SqlClient.SqlParameter("@Module_Type", objDoCatalog.Model_Type), new System.Data.SqlClient.SqlParameter("@Preference_Supplier", objDoCatalog.Preferred_Supplier), new System.Data.SqlClient.SqlParameter("@Link", objDoCatalog.Link), new System.Data.SqlClient.SqlParameter("@Vessel_Code", objDoCatalog.VesselCode), new System.Data.SqlClient.SqlParameter("@Modified_By", objDoCatalog.CurrentUser) }; retValue = SqlHelper.ExecuteNonQuery(_internalConnection, CommandType.StoredProcedure, "[PURC_SP_upd_INV_SYSTEMS_LIBRARY]", obj); } catch (Exception ex) { retValue = 0; } return(retValue); }
/// <summary> /// Распарсить. /// </summary> /// <param name="source">Источник.</param> /// <returns>Результат.</returns> public IBoardPostCollectionEtag Parse(CatalogData source) { var posts = source.Entity.Threads.OrderBy(p => p.Number.TryParseWithDefault()); var result = new BoardPostCollection() { EntityType = PostStoreEntityType.Catalog, Etag = source.Etag, Info = GetEntityModel(source.Entity, source.Link), Link = source.Link, ParentLink = source.Link?.GetBoardLink(), Posts = posts.WithCounter(1).Select(p => _postsParser.Parse(new BoardPost2WithParentLink() { Counter = p.Key, ParentLink = new ThreadLink() { Board = source.Link.Board, Engine = source.Link.Engine, OpPostNum = p.Value.Number.TryParseWithDefault() }, Post = p.Value, EntityType = PostStoreEntityType.CatalogPost, LoadedTime = source.LoadedTime, })).ToList() }; return(result); }
private async Task <CatalogData> GetCurrentCatalogAsync() { try { using (var response = await _s3Client.GetObjectAsync(Utilites.BUCKET, CATALOG_KEY)) using (var reader = new StreamReader(response.ResponseStream)) { var content = await reader.ReadToEndAsync(); CatalogData data = new CatalogData(); data.Items = JsonConvert.DeserializeObject <List <TagCloudCatalogItem> >(content); return(data); } } catch (AmazonS3Exception e) { if (e.StatusCode == System.Net.HttpStatusCode.NotFound) { return(new CatalogData { Items = new List <TagCloudCatalogItem>() }); } throw; } }
public int SaveCatalog(CatalogData objDOCatalog) { try { System.Data.SqlClient.SqlParameter[] obj = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@SYSTEM_DESCRIPTION", objDOCatalog.System_Description), new System.Data.SqlClient.SqlParameter("@SYSTEM_PARTICULARS", objDOCatalog.System_Particulars), new System.Data.SqlClient.SqlParameter("@MAKER", objDOCatalog.Maker), new System.Data.SqlClient.SqlParameter("@FUNCTIONS", objDOCatalog.Functions), new System.Data.SqlClient.SqlParameter("@SET_INSTALED", objDOCatalog.Set_Installed), new System.Data.SqlClient.SqlParameter("@MODULE_TYPE", objDOCatalog.Model_Type), new System.Data.SqlClient.SqlParameter("@PREFERENCE_SUPPLIER", objDOCatalog.Preferred_Supplier), new System.Data.SqlClient.SqlParameter("@Link", objDOCatalog.Link), new System.Data.SqlClient.SqlParameter("@Vessel_Code", objDOCatalog.VesselCode), new System.Data.SqlClient.SqlParameter("@Created_By", objDOCatalog.CurrentUser), new System.Data.SqlClient.SqlParameter("@updsqlDeptCatalog", objDOCatalog.updateQuery), new System.Data.SqlClient.SqlParameter("@ReturnID", DbType.Int32) }; obj[11].Direction = ParameterDirection.ReturnValue; int result = SqlHelper.ExecuteNonQuery(_internalConnection, CommandType.StoredProcedure, "[PURC_SP_Ins_INV_SYSTEMS_LIBRARY]", obj); Int32 ReqturnId = Convert.ToInt32(obj[11].Value); return(ReqturnId); } catch (Exception ex) { throw ex; } }
private void makeColumns(CatalogData cd) { DataGridViewTextBoxColumn TextColumn; for (int i = 0; i < cd.ColNames.Length; i++) { if (cd.ColNames[i].StartsWith(CatalogData.COLOR_MARKER))//в породах { //colorExist = i; ColorPickerColumn colColorPick = new ColorPickerColumn(); colColorPick.Name = cd.ColNames[i]; dataGridView1.Columns.Add(colColorPick); } else if (cd.ColNames[i].StartsWith(CatalogData.IMAGE_MARKER))//в продукции { //imageExist = i; DataGridViewImageColumn colImage = new DataGridViewImageColumn(); colImage.Name = cd.ColNames[i]; dataGridView1.Columns.Add(colImage); } else if (cd.ColNames[i].StartsWith(CatalogData.BOOL_MARKER)) { DataGridViewCheckBoxColumn colBool = new DataGridViewCheckBoxColumn(); colBool.Name = cd.ColNames[i]; dataGridView1.Columns.Add(colBool); } else if (cd.ColNames[i].StartsWith(CatalogData.VACAFTER_MARKER)) { DataGridViewComboBoxColumn colCB = new DataGridViewComboBoxColumn(); colCB.Name = cd.ColNames[i]; dataGridView1.Columns.Add(colCB); } else { TextColumn = new DataGridViewTextBoxColumn(); TextColumn.Name = cd.ColNames[i]; dataGridView1.Columns.Add(TextColumn); } } //if (_catType == CatalogType.VACCINES) //todo по возможности для вакцин сделать отдельную форму //{ // dataGridView1.Columns[D1].Width = 30; // dataGridView1.Columns[D1].ReadOnly = true; // this.Width += 170; //} /// Далее добавляется одна невидимая ячейка, в коротой содержится ID записи TextColumn = new DataGridViewTextBoxColumn(); TextColumn.Name = "id"; TextColumn.ValueType = typeof(int); TextColumn.Visible = false; TextColumn.Width = 0; dataGridView1.Columns.Add(TextColumn); _hiddenId = dataGridView1.Columns.Count - 1; dataGridView1.Columns[_hiddenId - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
protected void Awake() { colliders = new List <Collider>(this.GetComponentsInChildren <Collider>()); Vector3 collidersCentroid = Vector3.zero; foreach (Collider collider in colliders) { if (!whooshPoint) { if (collider is CapsuleCollider) { collidersCentroid += collider.transform.TransformPoint((collider as CapsuleCollider).center); } else if (collider is SphereCollider) { collidersCentroid += collider.transform.TransformPoint((collider as SphereCollider).center); } else if (collider is BoxCollider) { collidersCentroid += collider.transform.TransformPoint((collider as BoxCollider).center); } else if (collider is MeshCollider) { collidersCentroid += (collider as MeshCollider).transform.position; } } // For compatibility with old prefab if (collider.material.name.Contains("Blade_")) { collider.material = CatalogData.GetPrefab <PhysicMaterial>("PhysicMaterials", "Blade"); } else if (collider.material.name.Contains("WoodHard")) { collider.material = CatalogData.GetPrefab <PhysicMaterial>("PhysicMaterials", "Wood"); } else if (collider.material.name.Contains("ShieldWood")) { collider.material = CatalogData.GetPrefab <PhysicMaterial>("PhysicMaterials", "Wood"); } else if (collider.material.name.Contains("ShieldMetal")) { collider.material = CatalogData.GetPrefab <PhysicMaterial>("PhysicMaterials", "Metal"); } } if (!whooshPoint) { whooshPoint = new GameObject("WhooshPoint").transform; whooshPoint.SetParentOrigin(this.transform); whooshPoint.position = collidersCentroid / colliders.Count; } data = new ColliderGroupData(); data.id = "Default"; }
private void HandleCatalogControls(List <FormFieldConfiguration> controlsConfig, Dictionary <string, object> formData) { controlsConfig.ForEach(control => { if (formData[control.Name] is JObject) { CatalogData catalogData = JsonConvert.DeserializeObject <CatalogData>(formData[control.Name].ToString()); formData[control.Name] = catalogData.Code; } }); }
private async Task <bool> SaveCatalogDataAsync(CatalogData data) { var request = new PutObjectRequest { BucketName = Utilites.BUCKET, Key = CATALOG_KEY, ContentBody = JsonConvert.SerializeObject(data.Items) }; await _s3Client.PutObjectAsync(request); return(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Aplicacao.Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); myList = FindViewById <ListView>(Aplicacao.Resource.Id.listView); myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.menuItem1: { CatalogData.categoria = 0; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } case Resource.Id.menuItem2: { CatalogData.categoria = 5; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } case Resource.Id.menuItem3: { CatalogData.categoria = 3; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } case Resource.Id.menuItem4: { CatalogData.categoria = 4; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } case Resource.Id.menuItem5: { CatalogData.categoria = 2; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } case Resource.Id.menuItem6: { CatalogData.categoria = 1; myList.Adapter = new CustomListAdpter(CatalogData.PopuleModel()); return(true); } } return(base.OnOptionsItemSelected(item)); }
public DeadReasonChangeForm(int id, string name, string curReason) { InitializeComponent(); label1.Text = name; cbOldReason.Items.Add(curReason); cbOldReason.SelectedIndex = 0; dr = Engine.get().db().getDeadReasons().Get(); foreach (CatalogData.Row row in dr.Rows) { if (row.data[0] != curReason) { cbNewReason.Items.Add(row.data[0]); } } }
public async Task <IActionResult> Add([FromBody] CatalogData catalogData) { if (ModelState.IsValid) { Catalog catalog = catalogData.Catalog; catalog.CreatedAt = DateTime.Now; catalog.UpdateAt = DateTime.Now; _catalogRepo.AddCatalog(catalog); await _catalogRepo.SaveAll(); return(Ok(catalog)); } return(BadRequest(ModelState)); }
public int DeleteCatalog(CatalogData objDOCatalog) { try { System.Data.SqlClient.SqlParameter[] sqlpram = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@ID", objDOCatalog.CatalogID), new System.Data.SqlClient.SqlParameter("@Deleted_By", objDOCatalog.CurrentUser) }; SqlHelper.ExecuteNonQuery(_internalConnection, CommandType.StoredProcedure, "[PURC_SP_del_INV_Systems_Library]", sqlpram); return(0); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Edit(long id, [FromBody] CatalogData catalogData) { if (ModelState.IsValid) { Catalog catalog = await _catalogRepo.GetCatalog(id); // MAPPER catalog.Name = catalogData.Name; catalog.ShortDescription = catalogData.ShortDescription; catalog.Description = catalogData.Description; catalog.Visibility = catalogData.Visibility; catalog.UpdateAt = DateTime.Now; _catalogRepo.EditCatalog(catalog); await _catalogRepo.SaveAll(); return(Ok(catalog)); } return(BadRequest(ModelState)); }
public GetCatalogsResponse Any(GetAllCatalogs request) { var catalogs = new GetCatalogsResponse() { Status = (int)Status.Ok, ReasonPhrase = Status.Ok.ToName() }; if (acDomain.CatalogSet != null) { foreach (var item in acDomain.CatalogSet) { var serializableCatalog = new CatalogData() { ParentCode = item.Parent.Code, Name = item.Name, Code = item.Code }; catalogs.Catalogs.Add(serializableCatalog); } } return(catalogs); }
/// <summary> /// Заполнение каталога данными /// </summary> /// <param name="update"></param> private void fillTable(bool update) { btDeleteImage.Visible = btNewImage.Visible = false; _manual = false; //ds.Clear(); updateCatalogs(); CatalogData cd = _catalog.Get(); //int colorExist=-1,imageExist = -1, boolExist=-1; //чтобы удалить слово #color# if (!update) { makeColumns(cd); } //if (_catType == CatalogType.VACCINES)//todo получается громоздко //{ // (dataGridView1.Columns[D5] as DataGridViewComboBoxColumn).Items.Clear(); // (dataGridView1.Columns[D5] as DataGridViewComboBoxColumn).Items.Add("Рождения"); // for (int i = 0; i < cd.Rows.Length; i++) // (dataGridView1.Columns[D5] as DataGridViewComboBoxColumn).Items.Add(cd.Rows[i].data[D1] + ":" + cd.Rows[i].data[D2]); //} string value; Color lclColor = SystemColors.ButtonFace; int res; dataGridView1.Rows.Clear(); for (int i = 0; i < cd.Rows.Length; i++) { int rownumber = dataGridView1.Rows.Add(); for (int j = 0; j < cd.ColNames.Length; j++) //заполнение столбцов { if (cd.ColNames[j].StartsWith(CatalogData.COLOR_MARKER)) { value = cd.Rows[i].data[j]; if (int.TryParse(value, System.Globalization.NumberStyles.HexNumber, null, out res)) { lclColor = Color.FromArgb(res); } else { lclColor = Color.FromName(value); } dataGridView1.Rows[rownumber].Cells[j].Value = lclColor; } else if (cd.ColNames[j].StartsWith(CatalogData.IMAGE_MARKER)) { if (cd.Rows[i].data[j].Length == 0) { continue; } MemoryStream ms = new MemoryStream(Convert.FromBase64String(cd.Rows[i].data[j])); Image img = Image.FromStream(ms); dataGridView1.Rows[rownumber].Cells[j].Value = img; dataGridView1.Rows[rownumber].Height = img.Height; } else if (cd.ColNames[j].StartsWith(CatalogData.BOOL_MARKER)) { dataGridView1.Rows[rownumber].Cells[j].Value = cd.Rows[i].data[j] == "1"; } //else if (cd.ColNames[j].StartsWith(CatalogData.VACAFTER_MARKER)) //{ // int ind = 0; // int.TryParse(cd.Rows[i].data[j],out ind); // dataGridView1.Rows[rownumber].Cells[j].Value = (dataGridView1.Rows[rownumber].Cells[j] as DataGridViewComboBoxCell).Items[ind]; //} else { dataGridView1.Rows[rownumber].Cells[j].Value = cd.Rows[i].data[j]; } } dataGridView1.Rows[rownumber].Cells[cd.ColNames.Length].Value = cd.Rows[i].key; } if (_catType == CatalogType.DEAD) { dataGridView1.Rows[0].ReadOnly = //на убой dataGridView1.Rows[1].ReadOnly = //продажа племенного поголовья dataGridView1.Rows[2].ReadOnly = //падеж при подсчете dataGridView1.Rows[3].ReadOnly = true; //падеж } ///убираем маркеры foreach (DataGridViewColumn col in dataGridView1.Columns) { if (col.Name.StartsWith(CatalogData.COLOR_MARKER)) { col.Name = col.Name.Remove(0, CatalogData.COLOR_MARKER.Length); } if (col.Name.StartsWith(CatalogData.IMAGE_MARKER)) { col.Name = col.Name.Remove(0, CatalogData.IMAGE_MARKER.Length); } if (col.Name.StartsWith(CatalogData.BOOL_MARKER)) { col.Name = col.Name.Remove(0, CatalogData.BOOL_MARKER.Length); } if (col.Name.StartsWith(CatalogData.VACAFTER_MARKER)) { col.Name = col.Name.Remove(0, CatalogData.VACAFTER_MARKER.Length); } } /*if (colorExist != -1) * dataGridView1.Columns[colorExist].Name = dataGridView1.Columns[colorExist].Name.Remove(0, CatalogData.COLOR_MARKER.Length); * if (imageExist != -1) * dataGridView1.Columns[imageExist].Name = dataGridView1.Columns[imageExist].Name.Remove(0, CatalogData.IMAGE_MARKER.Length); * if (boolExist != -1) * dataGridView1.Columns[boolExist].Name = dataGridView1.Columns[boolExist].Name.Remove(0, CatalogData.BOOL_MARKER.Length);*/ _manual = true; }
//------------------------------------------------------------------------------- #region navigationHelper_LoadState //------------------------------------------------------------------------------- // /// <summary> /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを /// 再作成する場合は、保存状態も指定されます。 /// </summary> /// <param name="sender"> /// イベントのソース (通常、<see cref="NavigationHelper"/>)> /// </param> /// <param name="e">このページが最初に要求されたときに /// <see cref="Frame.Navigate(Type, Object)"/> に渡されたナビゲーション パラメーターと、 /// 前のセッションでこのページによって保存された状態の辞書を提供する /// セッション。ページに初めてアクセスするとき、状態は null になります。</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { //var param = e.NavigationParameter as Tuple<CatalogData, CheckList>; //_catalogData = (param != null) ? param.Item1 : null; //_checkList = (param != null) ? param.Item2 : null; _catalogData = await CatalogData.OpenCatalogData(); var info = await _catalogData.GetComiketInfo(); _checkList = new CheckList(info.comiketNo); if (await CheckList.CheckExistCheckList()) { await _checkList.OpenCheckList(await CheckList.OpenExistCheckList(), _catalogData.GetDayIndex, _catalogData.GetCircleFromId); } //_checkList.PropertyChanged += CheckList_PropertyChanged; if (_catalogData != null) { var names = await _catalogData.GetMapNames(); if (names.Length >= 3) { this.defaultViewModel["MapName1"] = _mapName1 = names[0]; this.defaultViewModel["MapName2"] = _mapName2 = names[1]; this.defaultViewModel["MapName3"] = _mapName3 = names[2]; } var maps = await _catalogData.GetAllMaps(); this.defaultViewModel["MapImage1_E123"] = maps[0]; this.defaultViewModel["MapImage1_E456"] = maps[1]; this.defaultViewModel["MapImage1_W"] = maps[2]; this.defaultViewModel["MapImage2_E123"] = maps[3]; this.defaultViewModel["MapImage2_E456"] = maps[4]; this.defaultViewModel["MapImage2_W"] = maps[5]; this.defaultViewModel["MapImage3_E123"] = maps[6]; this.defaultViewModel["MapImage3_E456"] = maps[7]; this.defaultViewModel["MapImage3_W"] = maps[8]; this.defaultViewModel["MapWidth_E123"] = maps[0].PixelWidth; this.defaultViewModel["MapHeight_E123"] = maps[0].PixelHeight; this.defaultViewModel["MapWidth_E456"] = maps[1].PixelWidth; this.defaultViewModel["MapHeight_E456"] = maps[1].PixelHeight; this.defaultViewModel["MapWidth_W"] = maps[2].PixelWidth; this.defaultViewModel["MapHeight_W"] = maps[2].PixelHeight; var genremaps = await _catalogData.GetAllGenreInfoMaps(); this.defaultViewModel["MapGenreImage1_E123"] = genremaps[0]; this.defaultViewModel["MapGenreImage1_E456"] = genremaps[1]; this.defaultViewModel["MapGenreImage1_W"] = genremaps[2]; this.defaultViewModel["MapGenreImage2_E123"] = genremaps[3]; this.defaultViewModel["MapGenreImage2_E456"] = genremaps[4]; this.defaultViewModel["MapGenreImage2_W"] = genremaps[5]; this.defaultViewModel["MapGenreImage3_E123"] = genremaps[6]; this.defaultViewModel["MapGenreImage3_E456"] = genremaps[7]; this.defaultViewModel["MapGenreImage3_W"] = genremaps[8]; var genres = await _catalogData.GetGenres(); this.defaultViewModel["Genres"] = genres; if (genres.Length > 0) { cmbGenre.SelectedIndex = 0; } } this.defaultViewModel["ColorController"] = _indColorController; if (_checkList == null) { rbSearch_Checklist.IsEnabled = false; rbSearch_SearchString.IsChecked = true; } else { rbSearch_Checklist.IsChecked = true; } if (e.PageState != null) { if (e.PageState.ContainsKey("CheckListFilterText")) { txtCheckListFilter.Text = e.PageState["CheckListFilterText"].ToString(); } if (e.PageState.ContainsKey("SearchStringText")) { txtSearchString.Text = e.PageState["SearchStringText"].ToString(); } if (e.PageState.ContainsKey("GenreText")) { cmbGenre.SelectedItem = e.PageState["GenreText"].ToString(); } if (e.PageState.ContainsKey("SelectedRadioButton")) { RadioButton rb = RADIOBUTTONS[int.Parse(e.PageState["SelectedRadioButton"].ToString())]; rb.IsChecked = true; } //e.PageState["IsSearched"] = false; } }
public IList <FileInformation> SearchFile <T>(T t, string fileId) { Log.WriteLog("Search onedrive folder content."); /* * Request URL: https://graph.microsoft.com/v1.0/me/drive/items/1C1370877CDEA235!104/children * Authorization bearer token */ if (string.IsNullOrEmpty(fileId)) { fileId = "root"; } string token = t as string; IList <FileInformation> fileList = null; //bearer之后的空格需要保留 string authContent = "bearer " + token; List <HeaderEntity> headers = new List <HeaderEntity> { new HeaderEntity("SdkVersion", "Graph-dotnet-1.6.2"), new HeaderEntity("Authorization", authContent), new HeaderEntity("SampleID", "uwp-csharp-connect-sample"), new HeaderEntity("Cache-Control", "no-store, no-cache") }; NetClient netclient = new NetClient(headers); string requestUrl = ""; if (fileId.Equals("root")) { requestUrl = "/v1.0/me/drive/" + fileId + "/children"; } else { requestUrl = "/v1.0/me/drive/items/" + fileId + "/children"; } string jsonContent = ""; try { jsonContent = netclient.GET("graph.microsoft.com", requestUrl, true); } catch (WebException ex) { jsonContent = ""; Log.WriteLog("Create OneDrive folder webexception:" + ex.Message); } catch (Exception ex) { jsonContent = ""; Log.WriteLog("Search OneDrive folder content exception:" + ex.Message); } if (!string.IsNullOrEmpty(jsonContent)) { CatalogData catalogData = null; try { catalogData = JsonConvert.DeserializeObject <CatalogData>(jsonContent); } catch (Exception ex) { catalogData = null; Log.WriteLog("Search OneDrive folder content deserialize exception:" + ex.Message); } if (catalogData != null && catalogData.value != null) { fileList = new List <FileInformation>(); foreach (ValueItem item in catalogData.value) { FileInformation fileEntity = new FileInformation { FileId = item.id, FileName = item.name, FileSize = item.size }; if (item.parentReference != null) { fileEntity.ParentId = item.parentReference.id; } if (item.folder != null) { fileEntity.IsFolder = true; } else if (item.file != null) { fileEntity.IsFolder = false; } fileList.Add(fileEntity); } } } else { Log.WriteLog("Search OneDrive folder content failed."); } return(fileList); }
public void addGamesFromCatalogData(CatalogData catalogData, bool addChildProducts, ProductType gameProductType, bool isChildProduct, string parentProductId) { foreach (CatalogProduct product in catalogData.Products) { if (product.ProductBSchema == "ProductAddOn;3") { continue; } if (gamePassGamesList.Any(g => g.ProductId.Equals(product.ProductId))) { continue; } var childSubproductsList = new List <string>(); if (string.IsNullOrEmpty(product.Properties.PackageFamilyName)) { if (addChildProducts == true) { var marketProperties = product.MarketProperties.FirstOrDefault(); if (marketProperties != null) { var idsForDataRequest = new List <string>(); foreach (RelatedProduct relatedProduct in marketProperties.RelatedProducts) { if (relatedProduct.RelationshipType == "Bundle" || relatedProduct.RelationshipType == "Parent") { childSubproductsList.Add(relatedProduct.RelatedProductId); if (gamePassGamesList.Any(g => g.ProductId.Equals(relatedProduct.RelatedProductId)) == false) { idsForDataRequest.Add(relatedProduct.RelatedProductId); } } } if (idsForDataRequest.Count > 0) { var bigIdsParam = string.Join(",", idsForDataRequest); string catalogDataApiUrl = string.Format(catalogDataApiBaseUrl, bigIdsParam, countryCode, languageCode); try { var response = client.GetAsync(string.Format(catalogDataApiUrl)); var contents = response.Result.Content.ReadAsStringAsync(); if (response.Status == TaskStatus.RanToCompletion) { addGamesFromCatalogData(JsonConvert.DeserializeObject <CatalogData>(contents.Result), false, gameProductType, true, product.ProductId); } else { logger.Info($"Request {catalogDataApiUrl} not completed"); } } catch (Exception e) { logger.Error(e, $"Error in ApiRequest {catalogDataApiUrl}"); } } } } else { continue; } } var gamePassGame = new GamePassGame { BackgroundImage = string.Format("{0}.jpg", Guid.NewGuid().ToString()), BackgroundImageUrl = string.Format("https:{0}", product.LocalizedProperties[0].Images.Where(x => x.ImagePurpose == ImagePurpose.SuperHeroArt)?.FirstOrDefault()?.Uri), Category = product.Properties.Category, Categories = product.Properties.Categories, CoverImage = string.Format("{0}.jpg", Guid.NewGuid().ToString()), CoverImageUrl = string.Format("https:{0}", product.LocalizedProperties[0].Images.Where(x => x.ImagePurpose == ImagePurpose.Poster)?.FirstOrDefault()?.Uri), CoverImageLowRes = string.Format("{0}.jpg", Guid.NewGuid().ToString()), Description = product.LocalizedProperties[0].ProductDescription, Name = NormalizeGameName(product.LocalizedProperties[0].ProductTitle), ProductId = product.ProductId, Publishers = companiesStringToArray(product.LocalizedProperties[0].PublisherName), ReleaseDate = product.MarketProperties.FirstOrDefault().OriginalReleaseDate.UtcDateTime, ChildProducts = childSubproductsList, IsChildProduct = isChildProduct, ParentProductId = parentProductId }; if (string.IsNullOrEmpty(product.Properties.PackageFamilyName)) { gamePassGame.ProductType = ProductType.Collection; } else { gamePassGame.GameId = product.Properties.PackageFamilyName; gamePassGame.ProductType = gameProductType; } if (string.IsNullOrEmpty(product.LocalizedProperties[0].DeveloperName)) { gamePassGame.Developers = gamePassGame.Publishers; } else { gamePassGame.Developers = companiesStringToArray(product.LocalizedProperties[0].DeveloperName); } if (product.LocalizedProperties[0].Images.Any(x => x.ImagePurpose == ImagePurpose.BoxArt) == true) { gamePassGame.Icon = string.Format("{0}.jpg", Guid.NewGuid().ToString()); gamePassGame.IconUrl = string.Format("https:{0}", product.LocalizedProperties[0].Images.Where(x => x.ImagePurpose == ImagePurpose.BoxArt)?.FirstOrDefault()?.Uri); } else if (product.LocalizedProperties[0].Images.Any(x => x.ImagePurpose == ImagePurpose.Logo) == true) { gamePassGame.Icon = string.Format("{0}.jpg", Guid.NewGuid().ToString()); gamePassGame.IconUrl = string.Format("https:{0}", product.LocalizedProperties[0].Images.Where(x => x.ImagePurpose == ImagePurpose.Logo)?.FirstOrDefault()?.Uri); } gamePassGamesList.Add(gamePassGame); DownloadGamePassGameCache(gamePassGame); var gameAdded = false; if (addNewGames == true && gamePassGame.ProductType == ProductType.Game) { xboxLibraryHelper.AddGameToLibrary(gamePassGame, false); if (gameAdded == true) { playniteApi.Notifications.Add(new NotificationMessage( Guid.NewGuid().ToString(), $"{gamePassGame.Name} has been added to the Game Pass catalog and Playnite library", NotificationType.Info)); } } // Notify user that game has been added if (notifyCatalogUpdates == true && gameAdded == false) { playniteApi.Notifications.Add(new NotificationMessage( Guid.NewGuid().ToString(), $"{gamePassGame.Name} has been added to the Game Pass catalog", NotificationType.Info)); } RestoreMediaPaths(gamePassGame); } }
public int EditCatalog(CatalogData objDOCatalog) { return(objCatalog.EditCatalog(objDOCatalog)); }
public int DeleteCatalog(CatalogData objDOCatalog) { return(objCatalog.DeleteCatalog(objDOCatalog)); }
public int SaveCatalog(CatalogData objDOCatalog) { return(objCatalog.SaveCatalog(objDOCatalog)); }
public GetCatalogsResponse Any(GetAllCatalogs request) { var catalogs = new GetCatalogsResponse() { Status = (int)Status.Ok, ReasonPhrase = Status.Ok.ToName() }; if (acDomain.CatalogSet != null) { foreach (var item in acDomain.CatalogSet) { var serializableCatalog = new CatalogData() { ParentCode = item.Parent.Code, Name = item.Name, Code = item.Code }; catalogs.Catalogs.Add(serializableCatalog); } } return catalogs; }
//------------------------------------------------------------------------------- #region Constructor //------------------------------------------------------------------------------- // public VirtualizedCirclesList(CatalogData catalogData, CheckList checklist) { _catalogData = catalogData; _checkList = checklist; }