protected void loadData() { CategoryParser newParser = new CategoryParser(); this.dataModel = new CategoryModel(@".\SQL2008", 1433, "TSQLFundamentals2008", "sa", "123456", "Production.Categories", newParser); newParser.DataModel = this.dataModel; try { this.dataModel.resetModel(""); } catch (Exception ex) { Session["current_error"] = ex.Message; Response.Redirect("serverError.aspx"); } /*if (this.IsPostBack == false) this.loadEmpIDS();*/ if ((Request.Params.Get("suppid") != null)) { this.suppID = int.Parse(Request.Params.Get("suppid").Trim()); this.newEmpMode = false; if (this.IsPostBack == true) return; this.loadSuppData(); } }
public void Parse_ValidDotInput_Array() { //given string input = "A\n" + ".B\n" + ".C\n" + "..D\n" + ".E\n" + "F\n"; var expected = new CategoryBuilder() .AddTopCategory("A") .AddChildrenCategoryAndGoUp("B") .AddChildrenCategory("C") .AddChildrenCategory("D") .GoUp() .GoUp() .AddChildrenCategory("E") .AddTopCategory("F") .Build(); var parser = new CategoryParser(); //when var result = parser.Parse(input); //then Assert.Equal(expected.Length, result.Length); for (int i = 0; i < expected.Length; i++) { Assert.Equal(expected[i].Name, result[i].Name); Assert.Equal(expected[i].Parent?.Name, result[i].Parent?.Name); } }
public static void RemoveCategory(this MailItem item, Category category) { List <string> categories = CategoryParser.ConvertToList(item.Categories); if (categories.Contains(category.Name)) { categories.Remove(category.Name); } item.Categories = CategoryParser.ConvertToString(categories); }
public static void AddCategory(this MailItem item, string category) { List <string> categories = CategoryParser.ConvertToList(item.Categories); if (!categories.Contains(category)) { categories.Add(category); } item.Categories = CategoryParser.ConvertToString(categories); }
public void Parse_DuplicateNamesOnSameLevel_SingleInstance() { //given string input = "A\n" + "A"; //should be discarded var parser = new CategoryParser(); //when var result = parser.Parse(input); //then Assert.Single(result); Assert.Single(result.Distinct().ToArray()); }
public async Task <bool> Worker(string link) { CategoryParser categoryParser = new CategoryParser(); SubCategoryParser subCatParser = new SubCategoryParser(); var result = await categoryParser.Parse(1, $"{link}"); var subresult = await subCatParser.Parse(1, $"{link}"); OnNewData?.Invoke(this, result); OnNewData?.Invoke(this, subresult); dbChecker.PutIntProcessToDb("step_1", 0, true); isActive = false; return(true); }
public void Parse_SimpleDuplicateNames_ValidDistinctIdsInArray() { //given string input = "A\n" + "B\n" + ".A"; var parser = new CategoryParser(); //when var result = parser.Parse(input); //then Assert.Equal(3, result.Length); Assert.Equal(3, result.Distinct().ToArray().Length); }
public GameListBuilder( AdvancedSettings advancedSettings, MameInvoker invoker, MamePathManager pathManager, CategoryParser categoryParser) { _advancedSettings = advancedSettings; _invoker = invoker; _pathManager = pathManager; _categoryParser = categoryParser; _readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse }; }
public void Parse_DuplicateNamesOnSameLevel_SingleInstanceOfNameAtGivenLevel() { //given string input = "A\n" + ".B\n" + "Z\n" + "A\n" //should be discarded as "second A" + ".C\n" //should be attached to 1st A + "..D"; //should be attached to C in 1st A var parser = new CategoryParser(); //when var result = parser.Parse(input); //then Assert.Equal(5, result.Length); Assert.Equal(5, result.Distinct().ToArray().Length); }
static void Main(string[] args) { ServicePointManager.DefaultConnectionLimit = int.MaxValue; //ProxyHelper.VerifyProxies(); var website = new Website(); //var bucket = SouqApi.GetProductBucket("xiaomi-redmi-6-dual-sim-32-gb-3-gb-ram-4g-lte-gold-international-version-36234912"); //var productReviews = SouqApi.GetProductReview("36234912"); //var sellerReviews = SouqApi.GetSellerReview("alafreetshop"); //var cookies = SouqApi.GetProductAccessTokens("xd-design-bobby-anti-theft-backpack-black-24168110"); CityParser cityParser = new CityParser(); CategoryParser categoryParser = new CategoryParser(); CategoryProductsParser categoryProductsParser = new CategoryProductsParser(); ProductParser productParser = new ProductParser(); SellerParser sellerParser = new SellerParser(); cityParser.Process(website); categoryParser.Process(website); categoryProductsParser.Process(website); productParser.Process(website); sellerParser.Process(website); var x = JsonConvert.SerializeObject(website); File.WriteAllText("dump.json", x); Console.WriteLine("Dump Done"); Console.ReadLine(); //ExcelStore store = new ExcelStore(); //store.Store(website); //var product = website.CategoryGroups.FlattenCategories().FlattenProducts().First(); //var token = SouqApi.GetProductAccessTokens(product.Url.ExtractProductFullId()).First().Value; //var countryObj = website.Cities.First(); //SouqApi.GetDeliveryInfo(countryObj.Code, countryObj.Name, product.UnitId, token.hitsCfs, token.hitsCfsMeta); }
protected void _initModel() { Productions.Properties.Settings setting = new Productions.Properties.Settings(); CategoryParser newParser = new CategoryParser(); dataModel = new CategoryModel( this.gvCategories, setting.DB_HOST, setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Categories", newParser); //dataModel = new CategoryModel(this.gvCategories, ".\\SQL2008", setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Categories", newParser); newParser.DataModel = dataModel; dataModel.resetControl(); }
protected void loadData() { string currentFilter ; if (IsPostBack == false) { Session["cat_filter"] = "deactive=0 "; currentFilter = "deactive=0 "; } else currentFilter = (string)Session["cat_filter"]; //this.scriptLb.Text = currentFilter; CategoryParser newParser = new CategoryParser(); this._dataModel = new CategoryModel(this.gvCategories, @".\SQL2008", 1433, "TSQLFundamentals2008","sa", "123456", "Production.Categories", newParser); newParser.DataModel = this._dataModel; try { this._dataModel.resetControl(currentFilter); //if (this.IsPostBack == false) // this.loadEmpIDS(); } catch(Exception ex) { Session["current_error"] = ex.Message; Response.Redirect("serverError.aspx"); } }