public void ParseCompletionInvalidJson() { var productParser = new ProductParser(); var jsonStr = @"[""suit""]"; Assert.Throws <InvalidOperationException>(() => productParser.ParseProductCompletion(jsonStr)); }
public void KeyWordsGenerateTest() { var rake = new RakeAlgorithm(TestEnvironment.STOPLIST, 3, 2); var parser = new ProductParser(); var mock = new Mock <IHttpClientFactory>(); var testClient = new HttpClient(new TestProductPageHandler()); mock.Setup(x => x.CreateClient(string.Empty)).Returns(testClient); var keyWordsService = new KeywordsService(parser, rake, mock.Object); var keyWords = keyWordsService.ExctractKeywordsForProductPageAsync("https://www.amazon.com/dp/B079P5Q8T6/ref=sspa_dk_detail_2?psc=1https://www.amazon.com/dp/B079P5Q8T6/ref=sspa_dk_detail_2?psc=1").Result; Assert.AreEqual(keyWords.Count, 10, "Invalid count keyWords"); var msg = "There are not keyword {0}"; var listKeyWords = new List <string>() { "e5 men", "ncaa hoodie", "machine washable", "school pride", "hoodie features", "embroidered school", "game day", "hands cozy", "season long", "imported" }; foreach (var keyWord in listKeyWords) { Assert.True(keyWords.Contains(keyWord), string.Format(msg, keyWord)); } }
public void BasicTaxes() { List <Product> lstProd = ProductParser.ParseLine("1 book at 12.49"); double taxes = lstProd[0].CalculateTaxes(); Assert.IsTrue(taxes == 0); }
static async Task Main(string[] args) { // Parse exchange rates var xchangeParser = new ExchangeRateParser(); var rates = xchangeParser.CsvToExchangeRates( await File.ReadAllTextAsync("ExchangeRates.csv")); // Parse products var productParser = new ProductParser(); var products = productParser.CsvToProducts( await File.ReadAllTextAsync("Prices.csv")); // Look for product var product = products.FirstOrDefault(p => p.Description == args[0]); if (product == null) { Console.WriteLine("Sorry, product not found"); return; } var converter = new CurrencyConverter(rates); Console.WriteLine($"{converter.Convert(product.Price, product.Currency, args[1]),0:0.00}"); }
public void Parse() { List<Product> lstProd = ProductParser.ParseLine("1 music CD at 14.99"); Assert.IsNotNull(lstProd); Assert.IsTrue(lstProd.Count == 1); Assert.IsTrue(lstProd[0] is Product); }
public InitDataLoad LoadInitData(string filePath) { InitDataLoad initDataLoad = new InitDataLoad(); XmlDocument xmldoc = getXmldoc(filePath); XmlNodeList initNodeList = getXmlNodeList(xmldoc, XMLMainCategories.InitData); XmlNodeList productsNodeList = getXmlNodeList(xmldoc, XMLMainCategories.ProductsList); XmlNodeList suppliersNodeList = getXmlNodeList(xmldoc, XMLMainCategories.SuppliersList); XmlNodeList customerOrderNodeList = getXmlNodeList(xmldoc, XMLMainCategories.CustomersOrderList); XmlNodeList fucureCustomerOrderNodeList = getXmlNodeList(xmldoc, XMLMainCategories.FutureCustomersOrderList); XmlNodeList supploersOrderNodeList = getXmlNodeList(xmldoc, XMLMainCategories.SuppliersOrderList); XmlNodeList WarehouseInitInventoryNodeList = getXmlNodeList(xmldoc, XMLMainCategories.WarehouseInitInventory); XmlNodeList tooltypeyNodeList = getXmlNodeList(xmldoc, XMLMainCategories.ToolTypeList); initDataLoad.InitParameters = InitDataParser.Parse(initNodeList); initDataLoad.MetaData.ToolTypeMetaData = ToolTypeParser.parse(tooltypeyNodeList); initDataLoad.MetaData.ProductsMetaData = ProductParser.Parse(productsNodeList, initDataLoad); initDataLoad.MetaData.SuppliersMetaData = SuppliersParser.Parse(suppliersNodeList, initDataLoad); initDataLoad.InitLists.InitCustomersOrderList = OrderParser.Parse(customerOrderNodeList, initDataLoad, Order.OrderTypeEnum.CustomerOrder); initDataLoad.InitLists.InitFutureCustomersOrderList = OrderParser.Parse(fucureCustomerOrderNodeList, initDataLoad, Order.OrderTypeEnum.CustomerOrder); initDataLoad.InitLists.InitPurchaseOrders = OrderParser.Parse(supploersOrderNodeList, initDataLoad, Order.OrderTypeEnum.SupplierOrder); initDataLoad.InitParameters.InitWarehouseInventory = WarehouseInitInventoryParser.Parse(WarehouseInitInventoryNodeList, initDataLoad); ///rebuild parser initDataLoad.InitLists.InitToolsList = loadTool(initDataLoad); initDataLoad.InitLists.InitProductionOrderList = generateProductionOrderList(initDataLoad); //// return(initDataLoad); }
public void CreateXMLScenario(CSVScenarioFilePath cSVScenarioFilePath) { XmlDocument doc = new XmlDocument(); XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null); XmlElement root = doc.CreateElement(LoadData.XMLMainCategories.dataset.ToString()); doc.InsertBefore(xmlDeclaration, doc.DocumentElement); doc.AppendChild(root); doc = InitDataParser.InitDataCSVToXML(doc, cSVScenarioFilePath.InitData); doc = ToolTypeParser.ToolTypeCSVToXML(doc, cSVScenarioFilePath.ToolTypeList); doc = ProductParser.ProductClassCSVToXML(doc, cSVScenarioFilePath.ProductsList); doc = WarehouseInitInventoryParser.WarehouseInitInventoryCSVToXML(doc, cSVScenarioFilePath.WarehouseInitInventory); doc = SuppliersParser.SuppliersCSVToXML(doc, cSVScenarioFilePath.SuppliersList); doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.CustomersOrderList, XMLMainCategories.CustomersOrderList); doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.FutureCustomersOrderList, XMLMainCategories.FutureCustomersOrderList); doc = OrderParser.OrderCSVToXML(doc, cSVScenarioFilePath.SuppliersOrderList, XMLMainCategories.SuppliersOrderList); FileManager fileManager = new FileManager(); string fileResultpath = fileManager.saveFilePathXML(); if (!string.IsNullOrEmpty(fileResultpath)) { using (var writer = new XmlTextWriter(fileResultpath, Encoding.UTF8) { Formatting = Formatting.Indented }) { doc.WriteTo(writer); } } }
public void ImportTaxes() { List <Product> lstProd = ProductParser.ParseLine("1 imported book at 12.49"); double taxes = lstProd[0].CalculateTaxes(); Assert.IsTrue(taxes == 0.65); }
public void GetSuggestionsSuccess() { var parser = new ProductParser(); var original_seeds = new List <string> { "1seed", "2seed", "3seed" }; var urls = new ConcurrentQueue <string>(); var jsonStr = @"[""suit"",[""suitcase"",""suits season 8""],[{""nodes"":[{""name"":""Luggage & Travel Gear"",""alias"":""fashion-luggage""}]},{},{},{},{},{},{},{},{},{}],[],""3XPFVRN05ZSW""]"; var mock = new Mock <IHttpClientFactory>(); var testClient = new HttpClient(new TestCompletionHandler(urls, jsonStr)); mock.Setup(x => x.CreateClient(string.Empty)).Returns(testClient); var rake = new RakeAlgorithm(TestEnvironment.STOPLIST, 3, 2); var keyWordsService = new KeywordsService(parser, rake, mock.Object); var suggests = keyWordsService.GetSuggestionsAsync(original_seeds.ToArray()).Result; Assert.AreEqual(suggests.Count, 2, "Invalid count suggests"); var msg = "Suggests does not contains"; Assert.True(suggests.Contains("suitcase"), msg + "suitcase"); Assert.True(suggests.Contains("suits season 8"), msg + "suits season 8"); Assert.AreEqual(urls.Count, 3 * 37, "Invalid count urls"); }
public void Parse() { List <Product> lstProd = ProductParser.ParseLine("1 book at 12.49"); Assert.IsNotNull(lstProd); Assert.IsTrue(lstProd.Count == 1); Assert.IsTrue(lstProd[0] is Book); }
public void Should_ThrowException_When_InputIsNullOrEmpty(string input) { // Arrange var productParser = new ProductParser(); // Act & Assert Assert.Throws <ArgumentException>(() => productParser.TryParse(input, out Product _)); }
[InlineData("123,,,,123,123,,,asd,")] // size is NaN public void ReturnError_IfFormatIsWrong(string input) { var target = new ProductParser(); var actual = target.Parse(input); Assert.False(actual.Successful); Assert.NotNull(actual.ErrorMessage); Assert.Null(actual.Product); }
public async Task TestParseProducts() { string s = await File.ReadAllTextAsync("resources/common_boards.json"); JArray jarrProduct = JArray.Parse(s); Esk8Service ESS = new Esk8Service(logger); List <Product> Products = ProductParser.ParseProducts(jarrProduct); Assert.Equal(138, Products.Count); return; }
public void ShouldNot_ParseProduct_When_BadProductInput(string input) { // Arrange var productParser = new ProductParser(); // Act var result = productParser.TryParse(input, out Product product); // Assert Assert.False(result); Assert.Null(product); }
private void loadProductMap() { try { Parser <Product> productParser = new ProductParser(); productMap = productParser(FileUtils.readFileText(PRODUCT_CSV_FILE)); } catch (ReaderException rex) { write(rex.Message); } }
static void Main(string[] args) { Console.WriteLine("INPUT:"); var i = 1; foreach (var productList in InputOrders) { Console.WriteLine(); Console.WriteLine($"Input {i++}:"); foreach (var productString in productList) { Console.WriteLine(productString); } } i = 1; Console.WriteLine(); Console.WriteLine("OUTPUT:"); using (new CultureOverride(CultureInfo.InvariantCulture)) { foreach (var productList in InputOrders) { Console.WriteLine(); Console.WriteLine($"Output {i++}:"); var productParser = new ProductParser(); var orderInvoiceManager = new OrderInvoiceManager(); var orderInvoice = orderInvoiceManager.CreateInvoice(productParser.ParseAll(productList)); foreach (var computedProduct in orderInvoice.Products) { Console.WriteLine(computedProduct); } Console.WriteLine($"Sales Taxes: {orderInvoiceManager.GetTotalTaxes(orderInvoice).ToString("0.00")}"); Console.WriteLine($"Total: {orderInvoiceManager.GetTotalAmount(orderInvoice).ToString("0.00")}"); } Console.WriteLine(); Console.Write("Press any key to exit..."); Console.ReadLine(); } }
public void Should_ThrowFormatException_When_BadProductInputs() { // Arrange var productParser = new ProductParser(); var productStringList = new List <string> { "1 imported box of chocolates at 11.25", "1.5 books at 12.49" }; // Act & Assert var exception = Assert.Throws <FormatException>(() => productParser.ParseAll(productStringList)); Assert.Equal($"Unable to parse \"{productStringList[1]}\"", exception.Message); }
public HttpResponseMessage Post(object products) { var parse = new ProductParser(); var prods = parse.Parse(products); var postCount = 0; foreach (Product product in prods) { var repo = new ProductsRepository(); repo.Post(product); postCount += 1; } return(prods.Count == postCount?Request.CreateResponse(HttpStatusCode.Created) : Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not process your order, try again later...")); }
public void ParseLine_ShouldParseLineIntoProductCorrectly() { //Arrange const string sampleProductLine = "1,Fruits,2,Banana"; var productParser = new ProductParser(); //Act var product = productParser.ParseLine(sampleProductLine); //Assert Assert.NotNull(product); Assert.Equal(1, product.Id); Assert.Equal("Fruits", product.Type.Name); Assert.Equal("Banana", product.Name); Assert.Equal(2, product.Price); }
public void Should_CalculateTaxCorrectly(string input, decimal expectedTax) { using (new CultureOverride(CultureInfo.InvariantCulture)) { // Arrange var taxManager = TaxManager.Instance; var productParser = new ProductParser(); productParser.TryParse(input, out Product product); // Act var tax = taxManager.CalculateTax(product); // Assert Assert.Equal(expectedTax, tax); } }
public void Should_ParseAllProductInputs() { // Arrange var productParser = new ProductParser(); var productStringList = new List <string> { "1 book at 12.49", "1 music CD at 14.99", "1 chocolate bar at 0.85" }; // Act var products = productParser.ParseAll(productStringList); // Assert Assert.Equal(productStringList.Count, products.Count); }
private async Task GetProductsFromDbAsync() { var productSync = new ProductParser(_skApi, _cts.Token); productSync.ProductInfoUpdated += OnProductInfoUpdatedHandler; var enabledSubchapters = FiltersManagerVM.FiltersVM.GetEnabledSubchapter(); TotalSubchapter = enabledSubchapters.Count; ProductProcessingStatus = "Получение складчин из базы..."; for (var i = 0; i < enabledSubchapters.Count; i++) { _cts.Token.ThrowIfCancellationRequested(); CurrentSubchapterNumber = i + 1; var subchapter = enabledSubchapters.ElementAt(i); CurrentSubchapterTitle = subchapter.Name; Status = "Раздел: " + CurrentSubchapterTitle + " " + CurrentSubchapterNumber + "/" + enabledSubchapters.Count; var startFrom = 0; List <Product> products; _dbGoodProductsCountOfChapter = 0; var productsCount = await Db.Products.Count(subchapter.Id).ConfigureAwait(false); do { _cts.Token.ThrowIfCancellationRequested(); products = await Db.Products.GetAsync(subchapter.Id, startFrom, 1000).ConfigureAwait(false); OnProductInfoUpdatedHandler(null, new ProductEventArgs { Products = products, AllProductsCount = productsCount, ProductProcessed = startFrom + products.Count }); startFrom += 1000; } while (products.Count == 1000); } }
public void Should_ReturnExpectedString_When_PrintingComputedProduct(string productInput, string expectedOutput) { using (new CultureOverride(CultureInfo.InvariantCulture)) { // Arrange var productParser = new ProductParser(); var orderInvoiceManager = new OrderInvoiceManager(); // Act var orderInvoice = orderInvoiceManager.CreateInvoice(productParser.ParseAll(new List <string> { productInput })); // Assert Assert.Equal(1, orderInvoice.Products.Count); Assert.Equal(expectedOutput, orderInvoice.Products.Single().ToString()); } }
public ProductControl(string host, int port, string dbname, string username, string password, string table_name, ProductParser parser) { this.InitializeComponent(); ProductParser newParser = new ProductParser(); dataModel = new ProductModel( this.gvProducts, host, port, dbname, username, password, "Production.Products", newParser); newParser.DataModel = dataModel; this._initModel(); }
public async Task TestCombineProductCompanies() { Esk8Service ESS = new Esk8Service(logger); string rawCompanies = await File.ReadAllTextAsync("resources/common_companies.json"); string rawProducts = await File.ReadAllTextAsync("resources/common_boards.json"); JArray jarrCompany = JArray.Parse(rawCompanies); JArray jarrProduct = JArray.Parse(rawProducts); List <Company> companies = CompanyParser.ParseCompanies(jarrCompany); List <Product> products = ProductParser.ParseProducts(jarrProduct); List <Company> combined = CompanyParser.CombineCompanyLists(companies, products.Select(x => x.Company)); Assert.Equal(42, combined.Count); }
public void ParseProductAllSuccess() { var productParser = new ProductParser(); var description = productParser.ParseProductPage(File.ReadAllText(TestEnvironment.PRODUCT1HTML)); Assert.True(description.Contains("E5 Men's NCAA Hoodie"), "Invalid product title"); var invalidProductFeature = "Invalid product feature"; Assert.True(description.Contains("70% Cotton/30% Polyester"), invalidProductFeature); Assert.True(description.Contains("Machine Washable"), invalidProductFeature); Assert.True(description.Contains("Embroidered/Tackle Twill logos & Front Pouch"), invalidProductFeature); Assert.True(description.Contains("Officially Licensed Collegiate Product"), invalidProductFeature); Assert.True(description.Contains("Imported"), invalidProductFeature); var des = "Show off your school pride in this officially licensed NCAA pullover hoodie! This hoodie features a double layer tackle twill and embroidered school name arched over logo . The additional school logo on the sleeve and contrasting team color hood lining make it perfect for game day. Keep your hands cozy in the front pouch pocket all season long!"; Assert.True(description.Contains(des), "Invalid product description"); }
public void Should_ParseProductCorrectly(string input, ProductOrigin expectedOrigin, string expectedDescription, decimal expectedPrice, int expectedQuantity) { using (new CultureOverride(CultureInfo.InvariantCulture)) { // Arrange var productParser = new ProductParser(); // Act var result = productParser.TryParse(input, out Product product); // Assert Assert.True(result); Assert.Equal(expectedOrigin, product.Origin); Assert.Equal(expectedDescription, product.Description); Assert.Equal(expectedQuantity, product.Quantity); Assert.Equal(expectedPrice, product.Price); Assert.Equal(expectedPrice * expectedQuantity, product.Amount); } }
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); }
public void ReturnProduct_IfFormatIsCorrect() { var target = new ProductParser(); var actual = target.Parse("1,2,3,4,5,6,7,8,9,10"); Assert.True(actual.Successful); Assert.Null(actual.ErrorMessage); Assert.NotNull(actual.Product); // format: Key,Artikelcode,colorcode,description,price,discountprice,delivered in,q1,size,color Assert.Equal("1", actual.Product.Key); Assert.Equal("2", actual.Product.ArticleCode); Assert.Equal("3", actual.Product.ColorCode); Assert.Equal("4", actual.Product.Description); Assert.Equal(5, actual.Product.Price); Assert.Equal(6, actual.Product.DiscountPrice); Assert.Equal("7", actual.Product.DeliveredIn); Assert.Equal("8", actual.Product.Q1); Assert.Equal((uint)9, actual.Product.Size); Assert.Equal("10", actual.Product.Color); }
protected void _initModel() { Productions.Properties.Settings setting = new Productions.Properties.Settings(); ProductParser newParser = new ProductParser(); dataModel = new ProductModel( this.gvProducts, setting.DB_HOST, setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Products", newParser); //dataModel = new ProductModel(this.gvProducts, ".\\SQL2008", setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Products", newParser); newParser.DataModel = dataModel; dataModel.resetControl(); }
public async Task TestMakeEmailsFromMatches() { MailgunService MSS = new MailgunService(logger); string bstthreadloc = await File.ReadAllTextAsync("resources/bstthread.json"); JArray BSTThreadJson = JArray.Parse(bstthreadloc); RedditService RSS = new RedditService(logger); // Get BST thread string rawCompanies = await File.ReadAllTextAsync("resources/common_companies.json"); string rawProducts = await File.ReadAllTextAsync("resources/common_boards.json"); JArray jarrCompany = JArray.Parse(rawCompanies); JArray jarrProduct = JArray.Parse(rawProducts); List <Company> companies = CompanyParser.ParseCompanies(jarrCompany); List <Product> products = ProductParser.ParseProducts(jarrProduct); List <Company> combined = CompanyParser.CombineCompanyLists(companies, products.Select(x => x.Company)); Esk8Service ESS = new Esk8Service(logger); List <RegexCategory <Company> > CompRs = ESS.GetCompanyRegexs(companies); List <RegexCategory <Product> > ProdRs = ESS.GetProductRegexs(products); List <BSTComment> comments = RSS.ParseComments(BSTThreadJson, CompRs, ProdRs); // Get mock subscribers string subloc = await File.ReadAllTextAsync("resources/Subscribers.json"); JArray subArray = JArray.Parse(subloc); List <PostedSubscribeObject> psubs = SubscriberParser.ParseSubscribers(subArray); List <Subscriber> subs = psubs.Select(x => Subscriber.FromPostedSubscriber(x)).ToList(); MatchService LSS = new MatchService(logger); Dictionary <Subscriber, List <LambdaMatch> > matches = LSS.MakeMatches(subs, comments); List <MailgunEmail> emails = matches.Select(x => MSS.MakeEmail(x.Key, x.Value)).ToList(); }
public async Task <List <Product> > GetCommonBoards() { List <Product> products = new List <Product>(); try { HttpResponseMessage m = await Client.GetAsync(COMMONBOARDSURL); if (!m.IsSuccessStatusCode) { Logger.Log($"Failed while trying to get Common Products from Esk8 server. Code: {m.StatusCode}, Reason: {m.ReasonPhrase}"); return(null); } string productJson = await m.Content.ReadAsStringAsync(); JArray comps = JArray.Parse(productJson); products = ProductParser.ParseProducts(comps); return(products); } catch (Exception e) { Logger.Log($"An unknown error ocurred while deserializing the Common Products json file:\n{e.Message}"); return(null); } }
protected void loadData() { string currentFilter ; if (IsPostBack == false) { Session["pro_filter"] = ""; currentFilter = ""; } else currentFilter = (string)Session["pro_filter"]; //this.scriptLb.Text = currentFilter; ProductParser newParser = new ProductParser(); this._dataModel = new ProductModel(this.gvProducts, @".\SQL2008", 1433, "TSQLFundamentals2008","sa", "123456", "Production.Products", 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"); } catList = new List<object>(); suppList = new List<object>(); catList.Add(""); suppList.Add(""); catList.AddRange(_dataModel.getIDItemList("Production.Categories", 0, 1, " deactive=0").ToArray()); suppList.AddRange(_dataModel.getIDItemList("Production.Suppliers", 0, 1, " deactive=0").ToArray()); if (IsPostBack == false) { this.cbCatID.DataSource = catList; this.cbCatID.DataBind(); this.cbSupplierID.DataSource = suppList; this.cbSupplierID.DataBind(); } }
protected void _initModel() { Productions.Properties.Settings setting = new Productions.Properties.Settings(); ProductParser newParser = new ProductParser(); dataModel = new ProductModel( this.gvProducts, setting.DB_HOST, setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Products", newParser); dataModel = new ProductModel(this.gvProducts, ".\\SQL2008", setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Production.Products", newParser); newParser.DataModel = dataModel; dataModel.resetControl(); this.cbxCaID.Items.Add(""); this.cbxCaID.Items.AddRange(dataModel.getIDItemList("Production.Categories", 0, 1, " deactive=0").ToArray()); this.cbxSupID.Items.Add(""); this.cbxSupID.Items.AddRange(dataModel.getIDItemList("Production.Suppliers", 0, 1, " deactive=0").ToArray()); }
protected void loadData() { ProductParser newParser = new ProductParser(); this.dataModel = new ProductModel(@".\SQL2008", 1433, "TSQLFundamentals2008", "sa", "123456", "Production.Products", 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();*/ catList = new List<object>(); suppList = new List<object>(); catList.Add(""); suppList.Add(""); catList.AddRange(dataModel.getIDItemList("Production.Categories", 0, 1, " deactive=0").ToArray()); suppList.AddRange(dataModel.getIDItemList("Production.Suppliers", 0, 1, " deactive=0").ToArray()); if (IsPostBack == false) { this.cbCatID.DataSource = catList; this.cbCatID.DataBind(); this.cbSupplierID.DataSource = suppList; this.cbSupplierID.DataBind(); } if ((Request.Params.Get("proid") != null)) { this.proID = int.Parse(Request.Params.Get("proid").Trim()); this.newEmpMode = false; if (this.IsPostBack == true) return; this.loadSuppData(); } }