protected void btnGetProductsFromEwe_Click(object sender, EventArgs e) { string subcategories = string.Empty; for (int i = 0; i < lstCategory.Items.Count; i++) { subcategories += lstCategory.Items[i].Text + "|"; } subcategories = subcategories.Remove(subcategories.Length - 1, 1); int productsCount = new EweBL().ParseProductsForSaving(cmbEweCategory.SelectedItem.Text, subcategories.Split('|')); SetStatus("Učitano " + productsCount.ToString() + " proizvoda", System.Drawing.Color.Green, true, "success"); //save ewe category for category EweBL eweBL = new EweBL(); string categoryIDs = string.Empty; string selected = string.Empty; eweBL.DeleteCategoryEweCategory(int.Parse(cmbCategory.SelectedValue)); eweBL.SaveEweCategoryForCategory(int.Parse(cmbCategory.SelectedValue), int.Parse(cmbEweCategory.SelectedValue), true); for (int i = 0; i < lstSubCategory.Items.Count; i++) { categoryIDs += lstSubCategory.Items[i].Value + ","; selected += lstCategory.Items.Contains(lstSubCategory.Items[i]).ToString() + ","; if (lstSubCategory.Items[i].Selected) { eweBL.SaveEweCategoryForCategory(int.Parse(cmbCategory.SelectedValue), int.Parse(lstSubCategory.Items[i].Value), false); } } eweBL.SaveSelected(categoryIDs.Substring(0, categoryIDs.Length - 1), selected.Substring(0, selected.Length - 1)); }
protected void btnGetProducts_Click(object sender, EventArgs e) { try { if (lstCategory.Items.Count > 0) { //parseProducts(); string subcategories = string.Empty; for (int i = 0; i < lstCategory.Items.Count; i++) { subcategories += lstCategory.Items[i].Text + ","; } subcategories = subcategories.Remove(subcategories.Length - 1, 1); EweBL eweBL = new EweBL(); dgvProducts.DataSource = eweBL.parseProductsToDataTable(cmbEweCategory.SelectedItem.Text, subcategories.Split(',')); dgvProducts.DataBind(); if (dgvProducts.Rows.Count == 0) { SetStatus("Ne postoje proizvodi za kategoriju", System.Drawing.Color.Red, true); } pnlOptions.Visible = true; chkSelectNew.Checked = false; divPleaseWait.Style.Add("display", "none"); //cmbEweCategory.Enabled = false; //btnGetProducts.Enabled = false; /*string category = cmbEweCategory.SelectedItem.Text.Substring(0, cmbEweCategory.SelectedItem.Text.IndexOf("-")); * string subcategory = cmbEweCategory.SelectedItem.Text.Substring(cmbEweCategory.SelectedItem.Text.IndexOf("-") + 1, cmbEweCategory.SelectedItem.Text.Length - cmbEweCategory.SelectedItem.Text.IndexOf("-") - 1); * * eweBL.parseProducts(category, subcategory, chkImages.Checked, chkAttributes.Checked, cmbCategory.SelectedItem.Text, int.Parse(cmbCategory.SelectedValue), chkOverwrite.Checked); * * Page.Response.Redirect("/administrator/products.aspx");*/ string categoryIDs = string.Empty; string selected = string.Empty; eweBL.DeleteCategoryEweCategory(int.Parse(cmbCategory.SelectedValue)); for (int i = 0; i < lstCategory.Items.Count; i++) { //categoryIDs += lstSubCategory.Items[i].Value + ","; //selected += lstCategory.Items.Contains(lstSubCategory.Items[i]).ToString() + ","; //if (lstSubCategory.Items[i].Selected) eweBL.SaveEweCategoryForCategory(int.Parse(cmbCategory.SelectedValue), int.Parse(lstCategory.Items[i].Value), false); } //eweBL.SaveSelected(categoryIDs.Substring(0, categoryIDs.Length - 1), selected.Substring(0, selected.Length - 1)); eweBL.SaveEweCategoryForCategory(int.Parse(cmbCategory.SelectedValue), int.Parse(cmbEweCategory.SelectedValue), true); } } catch (BLException ex) { SetStatus(ex.Message, System.Drawing.Color.Red, true); } }