public void Download(string sessionHandler, DataGrid DownloadedAuctionData, AllegroWebApiService service) { try { accountStructTable = service.doMyAccount2(sessionHandler, "sell", (int)offset, auctionsID, 100); } catch { //Shower.Dispatcher.Invoke(delegate { Shower.Items.Add("Nie można sprawdzić obecnych aukcji"); }); MessageBoxResult wrongResult = MessageBox.Show("Błąd podczas pobierania aukcji", "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (wrongResult == MessageBoxResult.OK) { return; } } foreach (MyAccountStruct2 accountStruct in accountStructTable) { DownloadedAuctionData.Dispatcher.Invoke(delegate { DownloadedAuctionData.Items.Add(new DataGridItem() { Column1 = accountStruct.myaccountarray[9], Column2 = accountStruct.myaccountarray[33], Column10 = accountStruct.myaccountarray[27], Column3 = accountStruct.myaccountarray[4] + " zł", Column4 = accountStruct.myaccountarray[17], Column5 = accountStruct.myaccountarray[16], Column6 = accountStruct.myaccountarray[0], Column7 = accountStruct.myaccountarray[6], Column8 = accountStruct.myaccountarray[7], }); }); } }
//METODY public Session(string webAPIKey, int countryId) { allegroService = new AllegroWebApiService(); this.countryId = countryId; this.webAPIKey = webAPIKey; allegroService.doQuerySysStatus(3, countryId, webAPIKey, out localVersion);//pobieranie versionKey }
public void GoOn(string sessionHandler, AllegroWebApiService service) { //Ceny można zmieniać tylko przy aukcjach, na których nikt jeszcze nic nie kupił - takie są zasady allegro dla WebApi try //Na REST Api można zmieniać zawsze { //Generalnie wywala błędy, ale działa O.o itemId = 7302711402; string changePriceInfo = service.doChangePriceItem(sessionHandler, ref itemId, 0, 0, 1000, 0); service.doChangeQuantityItem(sessionHandler, ref itemId, 10, out itemsNow, out itemsSold); } catch { MessageBoxResult wrongResult = MessageBox.Show("Ta aukcja jest właśnie modyfikowana. Spróbuj później.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public long GetLocalVersionKey(AllegroWebApiService service) { long version = 0; try { var info = service.doQuerySysStatus(1, 1, apiKey, out version); //Shower.Items.Add("Kod wersji: " + version); } catch { MessageBoxResult wrongResult = MessageBox.Show("Zgubiłem klucz wersji. Zrestartuj mnie!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } return(version); }
public string LogIn(string sessionHandler, long version, AllegroWebApiService service) { long offset = 0; long serverTime = 0; try { sessionHandler = service.doLogin(login, pass, 1, apiKey, version, out offset, out serverTime); } catch { //Shower.Items.Add("Logowanie się nie powiodło"); MessageBoxResult wrongResult = MessageBox.Show("Błąd w session Handlerze", "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (wrongResult == MessageBoxResult.OK) { Application.Current.Shutdown(); } } return(sessionHandler); }
public Categories(AllegroWebApiService allegroService, string webAPIKey, out long verKey, out string verString) { this.allegroService = allegroService; catTree = allegroService.doGetCatsData(1, 0, webAPIKey, out verKey, out verString); }
public void MakeAuction(DateTime timeWorker, List <int> categoriesList, DateTime[] dateWorker, UInt32 numberOfDataWorkers, Calendar OfferCallendar, ComboBox OfferFrequencyCB, AllegroWebApiService service, string apiKey, AllegroFormFiller fillIt, string currentOrginalName, UInt32 imageCounter, FieldsValue[] formFiller, string sessionHandler, TextBox NameOfProdTB, TextBox AmountTB, TextBox PriceTB, TextBox SKUTB, TextBox CustomKurierZwykłyTB, TextBox CustomKurierPobranieTB, TextBox DescriptionTB, CheckBox Kurier, CheckBox Paleta, CheckBox ListP, CheckBox TylkoOsobisty, CheckBox InnaDostawa) { try { SellFormFieldsForCategoryStruct auctionForm = service.doGetSellFormFieldsForCategory(apiKey, 1, 252416); timeWorker = DateTime.Now.AddMinutes(20); int i = 0; int x = 0; if (categoriesList.Count != 0) { caty: if (toMuchWeight == false) { if (x < categoriesList.Count) { int category = categoriesList[x]; if (timeWorker == null) { timeWorker = DateTime.Now.AddMinutes(20); } next: switch (i) { case 0: if (OfferFrequencyCB.SelectedIndex == i) //Jednorazowo { timeWorker = DateTime.Now.AddMinutes(12); if (categoriesList.Count > 1) { fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } else { fillIt.MakeAuction(category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } x++; goto caty; } else { i++; goto next; } break; case 1: if (OfferFrequencyCB.SelectedIndex == i) //Co dwa tygodnie { timeWorker = DateTime.Now.AddMinutes(12); if (categoriesList.Count > 1) { fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } else { fillIt.MakeAuction(category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } timeWorker = DateTime.Now.AddMinutes(20); timeWorker = timeWorker.AddDays(14); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); x++; goto caty; } else { i++; goto next; } break; case 2: if (OfferFrequencyCB.SelectedIndex == i) //Co tydzień { timeWorker = DateTime.Now.AddMinutes(12); if (categoriesList.Count > 1) { fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } else { fillIt.MakeAuction(category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } timeWorker = DateTime.Now.AddMinutes(20); timeWorker = timeWorker.AddDays(7); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); timeWorker = timeWorker.AddDays(7); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); timeWorker = timeWorker.AddDays(7); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); x++; goto caty; } else { i++; goto next; } break; case 3: if (OfferFrequencyCB.SelectedIndex == i) //Co 3 dni { timeWorker = DateTime.Now.AddMinutes(12); if (categoriesList.Count > 1) { fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } else { fillIt.MakeAuction(category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } timeWorker = DateTime.Now.AddMinutes(20); for (UInt32 z = 0; z < 10; z++) { timeWorker = timeWorker.AddDays(3); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } x++; goto caty; } else { i++; goto next; } break; case 4: if (OfferFrequencyCB.SelectedIndex == i) //Codziennie { timeWorker = DateTime.Now.AddMinutes(12); if (categoriesList.Count > 1) { fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } else { fillIt.MakeAuction(category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } timeWorker = DateTime.Now.AddMinutes(20); for (UInt32 z = 0; z < 31; z++) { timeWorker = timeWorker.AddDays(1); fillIt.MakeAuction2(timeWorker, category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } x++; goto caty; } else { i++; goto next; } break; case 5: if (OfferFrequencyCB.SelectedIndex == i) //Custom { if (OfferCallendar.SelectedDate != null) { if (numberOfDataWorkers > 0) { for (UInt32 z = 0; z < numberOfDataWorkers; z++) { fillIt.MakeAuction2(dateWorker[z], category, toMuchWeightNoticed, toMuchWeight, currentOrginalName, imageCounter, service, formFiller, sessionHandler, NameOfProdTB, AmountTB, PriceTB, SKUTB, CustomKurierZwykłyTB, CustomKurierPobranieTB, DescriptionTB, Kurier, Paleta, ListP, TylkoOsobisty, InnaDostawa); } } } x++; goto caty; } else { i++; } Array.Clear(dateWorker, 0, dateWorker.Length); numberOfDataWorkers = 0; break; } } } } else { MessageBoxResult wrongResult = MessageBox.Show("Musisz wybrać kategorie!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } toMuchWeight = false; toMuchWeightNoticed = false; } catch { MessageBoxResult wrongResult = MessageBox.Show("Błąd przy wystawianiu oferty!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } categoriesList.Clear(); }
public void MakeAuction2(DateTime currentDateWorker, int categorySwitch, bool toMuchWeightNoticed, bool toMuchWeight, string currentOrginalName, UInt32 imageCounter, AllegroWebApiService service, FieldsValue[] formFiller, string sessionHandler, TextBox NameOfProdTB, TextBox AmountTB, TextBox PriceTB, TextBox SKUTB, TextBox CustomKurierZwykłyTB, TextBox CustomKurierPobranieTB, TextBox DescriptionTB, CheckBox Kurier, CheckBox Paleta, CheckBox ListP, CheckBox TylkoOsobisty, CheckBox InnaDostawa) { formFiller[0] = new FieldsValue(); formFiller[0].fid = 0; formFiller[401] = new FieldsValue(); //Stan formFiller[401].fid = 20365; formFiller[401].fvalueint = 1; formFiller[402] = new FieldsValue(); //Stan formFiller[402].fid = 32611; formFiller[402].fvalueint = 1; afterSale = new AfterSalesServiceConditionsStruct(); afterSale.warranty = "de4e9e97-f3fa-445e-ba87-a9d70f3e670e"; afterSale.returnpolicy = "e711157a-609b-4845-a916-37eae22a94e5"; afterSale.impliedwarranty = "8e2c1aca-5237-4b36-9853-1783a8d4bd97"; //Określanie częstotliwości wystawiania formFiller[1] = new FieldsValue(); formFiller[1].fid = 1; formFiller[1].fvaluestring = NameOfProdTB.Text; formFiller[2] = new FieldsValue(); formFiller[2].fid = 2; formFiller[2].fvalueint = categorySwitch; formFiller[3] = new FieldsValue(); formFiller[3].fid = 3; formFiller[3].fvaluedatetime = (long)ConvertToTimestamp(currentDateWorker); formFiller[4] = new FieldsValue(); formFiller[4].fid = 4; formFiller[4].fvalueint = 99; formFiller[5] = new FieldsValue(); formFiller[5].fid = 5; if (AmountTB.Text != "") { if (AmountTB.Text != "0") { formFiller[5].fvalueint = Int32.Parse(AmountTB.Text); } else { formFiller[5].fvalueint = 1; } } else { formFiller[5].fvalueint = 1; } formFiller[8] = new FieldsValue(); formFiller[8].fid = 8; formFiller[8].fvaluefloat = float.Parse(PriceTB.Text); formFiller[9] = new FieldsValue(); formFiller[9].fid = 9; formFiller[9].fvalueint = 1; formFiller[10] = new FieldsValue(); formFiller[10].fid = 10; formFiller[10].fvalueint = 15; formFiller[11] = new FieldsValue(); formFiller[11].fid = 11; formFiller[11].fvaluestring = "Poznań"; formFiller[12] = new FieldsValue(); formFiller[12].fid = 12; formFiller[12].fvalueint = 1; formFiller[14] = new FieldsValue(); formFiller[14].fid = 14; formFiller[14].fvalueint = 32; string path = AppDomain.CurrentDomain.BaseDirectory; //Dopisz kod zamieniający istniejący plik na nowy i zrób funkcję zapisującą w oddzielnym pliku path = path.Replace(@"\", "/"); string normalPath = path; path = path + "/Auctions/" + currentOrginalName + "/Photos/" + currentOrginalName; BitmapImage photoBitmapBeggining = new BitmapImage(new Uri(normalPath + "head.png")); //W .Net robi się to inaczej byte[] photoBeggining = getJPGFromImageControl(photoBitmapBeggining); formFiller[342] = new FieldsValue(); formFiller[342].fid = 342; formFiller[342].fvalueimage = photoBeggining; if (imageCounter > 7) { imageCounter = 7; } imageSelector = 0; for (UInt32 i = 16; i < 16 + imageCounter; i++) { BitmapImage photoBitmap = new BitmapImage(new Uri(path + imageSelector + ".jpg")); //Zrób sprawdzanie dla różnych typów obrazów jpg png gif może przez exists byte[] photo = getJPGFromImageControl(photoBitmap); formFiller[i] = new FieldsValue(); formFiller[i].fid = (int)i; formFiller[i].fvalueimage = photo; imageSelector++; } if (File.Exists(normalPath + "Table/" + SKUTB.Text + ".png")) { BitmapImage photoBitmapTable = new BitmapImage(new Uri(normalPath + "Table/" + SKUTB.Text + ".png")); byte[] photoTable = getJPGFromImageControl(photoBitmapTable); formFiller[343] = new FieldsValue(); formFiller[343].fid = 343; formFiller[343].fvalueimage = photoTable; isThereATable = true; } formFiller[27] = new FieldsValue(); formFiller[27].fid = 27; formFiller[27].fvaluestring = "Numer konta bankowego: 97 1140 2004 0000 3102 7532 3271"; formFiller[28] = new FieldsValue(); formFiller[28].fid = 28; formFiller[28].fvalueint = 0; formFiller[29] = new FieldsValue(); formFiller[29].fid = 29; formFiller[29].fvalueint = 1; formFiller[30] = new FieldsValue(); formFiller[30].fid = 30; formFiller[30].fvalueint = 1; formFiller[32] = new FieldsValue(); formFiller[32].fid = 32; formFiller[32].fvaluestring = "60-715"; formFiller[33] = new FieldsValue(); formFiller[33].fid = 33; formFiller[33].fvaluestring = "97 1140 2004 0000 3102 7532 3271"; formFiller[34] = new FieldsValue(); formFiller[34].fid = 34; formFiller[34].fvaluestring = "97 1140 2004 0000 3102 7532 3271"; formFiller[35] = new FieldsValue(); formFiller[35].fid = 35; formFiller[35].fvalueint = 1; if (TylkoOsobisty.IsChecked == true) { Paleta.IsChecked = false; Kurier.IsChecked = false; ListP.IsChecked = false; InnaDostawa.IsChecked = false; } if (Paleta.IsChecked == false) { if (Kurier.IsChecked == true) { formFiller[400] = new FieldsValue(); formFiller[400].fid = 22164; formFiller[400].fvaluefloat = 20; formFiller[44] = new FieldsValue(); //Kurier opłacony z góry formFiller[44].fid = 44; formFiller[44].fvaluefloat = 21; formFiller[144] = new FieldsValue(); formFiller[144].fid = 144; formFiller[144].fvaluefloat = 21; formFiller[244] = new FieldsValue(); formFiller[244].fid = 244; formFiller[244].fvalueint = 1; formFiller[45] = new FieldsValue(); //Kurier za pobraniem formFiller[45].fid = 45; formFiller[45].fvaluefloat = 30; formFiller[145] = new FieldsValue(); formFiller[145].fid = 145; formFiller[145].fvaluefloat = 30; formFiller[245] = new FieldsValue(); formFiller[245].fid = 245; formFiller[245].fvalueint = 1; } } if (ListP.IsChecked == true) { formFiller[400] = new FieldsValue(); formFiller[400].fid = 22164; formFiller[400].fvaluefloat = 2; formFiller[41] = new FieldsValue(); //list polecony ekonomiczny formFiller[41].fid = 41; formFiller[41].fvaluefloat = (float)4.20; formFiller[141] = new FieldsValue(); formFiller[141].fid = 141; formFiller[141].fvaluefloat = (float)4.20; formFiller[241] = new FieldsValue(); formFiller[241].fid = 241; formFiller[241].fvalueint = 1; formFiller[43] = new FieldsValue(); //list polecony priorytetowy formFiller[43].fid = 43; formFiller[43].fvaluefloat = 7; formFiller[143] = new FieldsValue(); formFiller[143].fid = 143; formFiller[143].fvaluefloat = 7; formFiller[243] = new FieldsValue(); formFiller[243].fid = 243; formFiller[243].fvalueint = 1; } if (Kurier.IsChecked == false) { if (Paleta.IsChecked == true) { formFiller[400] = new FieldsValue(); formFiller[400].fid = 22164; formFiller[400].fvaluefloat = 100; formFiller[44] = new FieldsValue(); //Paleta opłacona z góry formFiller[44].fid = 44; formFiller[44].fvaluefloat = 160; formFiller[144] = new FieldsValue(); formFiller[144].fid = 144; formFiller[144].fvaluefloat = 160; formFiller[244] = new FieldsValue(); formFiller[244].fid = 244; formFiller[244].fvalueint = 1; formFiller[45] = new FieldsValue(); //Paleta za pobraniem formFiller[45].fid = 45; formFiller[45].fvaluefloat = 160; formFiller[145] = new FieldsValue(); formFiller[145].fid = 145; formFiller[145].fvaluefloat = 160; formFiller[245] = new FieldsValue(); formFiller[245].fid = 245; formFiller[245].fvalueint = 1; } } if (InnaDostawa.IsChecked == true) { formFiller[400] = new FieldsValue(); formFiller[400].fid = 22164; formFiller[400].fvaluefloat = 50; formFiller[44] = new FieldsValue(); //Kurier opłacony z góry formFiller[44].fid = 44; formFiller[44].fvaluefloat = float.Parse(CustomKurierZwykłyTB.Text); formFiller[144] = new FieldsValue(); formFiller[144].fid = 144; formFiller[144].fvaluefloat = float.Parse(CustomKurierZwykłyTB.Text); formFiller[244] = new FieldsValue(); formFiller[244].fid = 244; formFiller[244].fvalueint = 1; formFiller[45] = new FieldsValue(); //Kurier za pobraniem formFiller[45].fid = 45; formFiller[45].fvaluefloat = float.Parse(CustomKurierPobranieTB.Text); formFiller[145] = new FieldsValue(); formFiller[145].fid = 145; formFiller[145].fvaluefloat = float.Parse(CustomKurierPobranieTB.Text); formFiller[245] = new FieldsValue(); formFiller[245].fid = 245; formFiller[245].fvalueint = 1; } formFiller[340] = new FieldsValue(); formFiller[340].fid = 340; formFiller[340].fvalueint = 1; formFiller[341] = new FieldsValue(); formFiller[341].fid = 341; switch (imageCounter) { case 0: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis0phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis0photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 1: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis1phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis1photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 2: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis2phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis2photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 3: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis3phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis3photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 4: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis4phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis4photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 5: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis5phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis5photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 6: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis6phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis6photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; case 7: if (isThereATable == true) { StreamReader desc = new StreamReader(normalPath + "Desc/opis7phototable.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } else { StreamReader desc = new StreamReader(normalPath + "Desc/opis7photo.json"); descriptionWorker = desc.ReadToEnd(); descriptionWorker = descriptionWorker.Replace("AUTYT", NameOfProdTB.Text); descriptionWorker = descriptionWorker.Replace("OFFDESC", DescriptionTB.Text); formFiller[341].fvaluestring = descriptionWorker; desc.Close(); } break; } isThereATable = false; if (Encoding.Default.GetByteCount(descriptionWorker) > 1569) { if (toMuchWeightNoticed == false) { MessageBoxResult wrongResult = MessageBox.Show("Twój tekst jest za długi! Musisz go skrócić.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); toMuchWeight = true; toMuchWeightNoticed = true; /* * MessageBoxResult wrongResult = MessageBox.Show("Twój tekst jest za długi! Skrócuć go automatycznie?", "Error", MessageBoxButton.OKCancel, MessageBoxImage.Error); * * int dotSearcher = DescriptionTB.Text.Length - 1; * DescriptionTB.Text = DescriptionTB.Text.Remove(dotSearcher - 3, DescriptionTB.Text.Length - dotSearcher-3); * while (DescriptionTB.Text[dotSearcher].ToString() != ".") * { * dotSearcher--; * } * DescriptionTB.Text = DescriptionTB.Text.Remove(dotSearcher, DescriptionTB.Text.Length - dotSearcher); * goto autoDescriptionChange; */ } } if (toMuchWeight == false) { service.doNewAuctionExt(sessionHandler, formFiller, 1, 1, itemStruct, variants, auctionTags, afterSale, addicionalServicesGroup, out itemCost, out itemPromStatus); } Thread.Sleep(200); }