/* Выполняем в конструкторе */ private void GetStarted(string _categoryName, string _prodTypeName) { ptController = new ProductTypesController(this); kcController = new KeywordCategoryController(this); fscController = new FullSemCoreController(this); ptController.GetProductTypesAll(); fill_cb_ProductTypes(); kcController.GetKeywordCategoriesByProductId(GetProductTypeIdFromCB()); fill_cb_KeywordCategory(); fscController.GetSemCoreByProductAndCategory(GetProductTypeIdFromCB(), GetKeywordCategoryIdFromCB()); for (int i = 0; i < cb_ProductType.Items.Count; i++) { if (cb_ProductType.Items[i].ToString().Equals(_prodTypeName)) { cb_ProductType.SelectedItem = cb_ProductType.Items[i]; } } for (int i = 0; i < cb_KeywordCategory.Items.Count; i++) { if (cb_KeywordCategory.Items[i].ToString().Equals(_categoryName)) { cb_KeywordCategory.SelectedItem = cb_KeywordCategory.Items[i]; } } ShowKeywords(); }
/* Выполняем в конструкторе */ private void GetStarted() { ptController = new ProductTypesController(this); kcController = new KeywordCategoryController(this); fscController = new FullSemCoreController(this); ptController.GetProductTypesAll(); fill_cb_ProductTypes(); kcController.GetKeywordCategoriesByProductId(GetProductTypeIdFromCB()); fill_cb_KeywordCategory(); fscController.GetSemCoreByProductAndCategory(GetProductTypeIdFromCB(), GetKeywordCategoryIdFromCB()); }
private void ShowKeywords() { fscController.GetSemCoreByProductAndCategory(GetProductTypeIdFromCB(), GetKeywordCategoryIdFromCB()); ReDrawKeywords(); StartKeySearch(); if (dgv_Keywords.RowCount > 0) { label5.Visible = false; dgv_Keywords.Visible = true; } else { label5.Text = "Упс, похоже, не найдено ни одного ключа :("; dgv_Keywords.Visible = false; label5.Visible = true; } }
/* Получаем набор ключей по категории и виду товара после нажатия кнопки */ private void btn_GetKeywords_Click(object sender, EventArgs e) { if (!cb_ProductType.SelectedItem.ToString().Equals(AllProductTypesCBName) && cb_KeywordCategory.SelectedItem.ToString().Equals(AllKeywordCategoriesCBName)) { fscController.GetSemCoreByProductId(GetSelectedProductTypeId()); ReDrawKeywords(); } else if (cb_ProductType.SelectedItem.ToString().Equals(AllProductTypesCBName) && !cb_KeywordCategory.SelectedItem.ToString().Equals(AllKeywordCategoriesCBName)) { fscController.GetSemCoreByCategoryId(GetSelectedCategoryId()); ReDrawKeywords(); } else if (!cb_ProductType.SelectedItem.ToString().Equals(AllProductTypesCBName) && !cb_KeywordCategory.SelectedItem.ToString().Equals(AllKeywordCategoriesCBName)) { fscController.GetSemCoreByProductAndCategory(GetSelectedProductTypeId(), GetSelectedCategoryId()); ReDrawKeywords(); } else if (cb_ProductType.SelectedItem.ToString().Equals(AllProductTypesCBName) && cb_KeywordCategory.SelectedItem.ToString().Equals(AllKeywordCategoriesCBName)) { fscController.GetSemCoreAll(); ReDrawKeywords(); } }