/* Добавить новый тип товара в БД */ private void btn_Save_Click(object sender, EventArgs e) { if (tb_ProductType.Text != "") { if (!ChechForExisting()) { int result = ptController.SetNewProductType(tb_ProductType.Text); if (result == 1) { tb_ProductType.Text = ""; ptController.GetProductTypesAll(); Draw(); } else if (result == -2146232060) { MessageBox.Show("Такой вид товаров уже существует. Нажмите \"Обновить\" для просмотра.", "Ошибка"); } } else { MessageBox.Show("Такая категория уже существует!", "Ошибка"); } } else { MessageBox.Show("Введите название новой категории.", "Ошибка"); } }
/* Добавляем/изменяем вид товара */ private void ApplyChanges() { if (rtb_ProductType.Text != "") { if (!renamingInProgress) { if (!ChechForExisting()) { int result = ptController.SetNewProductType(rtb_ProductType.Text); if (result == 1) { ptController.GetProductTypesAll(); Draw(); MessageBox.Show("Marketplace \"" + rtb_ProductType.Text + "\" был добавлен успешно!", "Успех"); rtb_ProductType.Text = ""; } else if (result == -2146232060) { MessageBox.Show("Такой вид товаров уже существует. Нажмите \"Обновить\" для просмотра.", "Ошибка"); } } else { MessageBox.Show("Такая категория уже существует!", "Ошибка"); } } else { int result = ptController.UpdateExistingProductType(rtb_ProductType.Text, renamedProductTypeId); if (result == 1) { ptController.GetProductTypesAll(); Draw(); MessageBox.Show("Marketplace \"" + rtb_ProductType.Text + "\" был переименован успешно!", "Успех"); rtb_ProductType.Text = ""; RenamingProductTypeEnd(); } else if (result == -2146232060) { MessageBox.Show("Во время сохранение произшла ошибка. Пожалуйста, повторите попытку позже.", "Ошибка"); } } } else { MessageBox.Show("Введите название категории.", "Ошибка"); } if (dgv_ProductTypes.RowCount > 0) { label1.Visible = false; dgv_ProductTypes.Visible = true; } }
/* Добавить новую категори в БД */ private void btn_Save_Click(object sender, EventArgs e) { int result; if (tb_CategoryName.Text != "") { if (!ChechForExisting()) { if (!renamingInProgress) { result = kcController.SetNewKeywordCategory(tb_CategoryName.Text, int.Parse(tb_ProductTypeId.Text)); //вызываем метод для записи в БД и проверяем сразу на успешность } else { result = kcController.UpdateKeywordCategory(tb_CategoryName.Text, renamedCategoryId); } if (result == 1) { kcController.GetKeywordCategoriesJOINProductTypes(); Draw(); ptController.GetProductTypesAll(); //fill_cb_ProductTypes(); wasAdded = true; if (!renamingInProgress) { MessageBox.Show("Категория \"" + tb_CategoryName.Text + "\" была добавлена успешно!", "Успешно"); } else { MessageBox.Show("Категория \"" + tb_CategoryName.Text + "\" была переименована успешно!", "Успешно"); } tb_CategoryName.Text = ""; RenameCategoryEnd(); tb_CategoryName.Focus(); } else if (result == -2146232060) { MessageBox.Show("Такая категория уже существует. Нажмите \"Обновить\" для просмотра.", "Ошибка"); } } else { MessageBox.Show("Такая категория уже существует!", "Ошибка"); } } else { MessageBox.Show("Введите название категории.", "Ошибка"); } }
/* Конструктор */ public SemCoreView(MainFormView _mf) { InitializeComponent(); mf = _mf; scController = new SemCoreController(this); kcController = new KeywordCategoryController(this); ptController = new ProductTypesController(this); scaController = new SemCoreArchiveController(this); mpController = new MarketplaceController(this); NoProdType = false; NoKeyCat = false; mpController.GetMarketplaces(); Fill_CB_ByMarketplaces(); ptController.GetProductTypesAll(); Fill_CB_ByProductTypes(); kcController.GetKeywordCategoriesByProductId(currentProductTypeId); Fill_CB_ByKeywordCategories(); urlAmazon = ConfigurationManager.AppSettings.Get("amzLink").ToString(); tb_Link.Text = urlAmazon; }
/* Заполняем (перезаполняем после изменений) все поля на форме данными с БД */ private void FillAllFields() { if (!firstStart) { if (checkbox_ActiveStatus.Checked == true) { pController.GetProductsAllJOIN(); } else { pController.GetActiveProductsJOIN(); } } else { pController.GetActiveProductsJOIN(); } DrawProducts(); DrawProductTypes(); DrawMarketPlaces(); if (mf.um.UserRoleId == 0 || mf.um.UserRoleId == 1) { ptController.GetProductTypesAll(); Fill_CB_ByProductTypes(); mpController.GetMarketplaces(); Fill_CB_ByMarketplaces(); } }
/* Выполняем в конструкторе */ 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 FillAllFields() { pController.GetProductsAllJOIN(); DrawProducts(); DrawProductTypes(); ptController.GetProductTypesAll(); Fill_CB_ByProductTypes(); }
/* Обновляем оба CB и ключи по ним */ private void Refresh_CB_AndKeywords() { kcController.GetKeywordCategoriesAll(); ptController.GetProductTypesAll(); Fill_CB_ByKeywordCategories(); Fill_CB_ByProductTypes(); GetKeywords(); }
/* Выполняем в конструкторе */ private void GetStarted() { ptController = new ProductTypesController(this); kcController = new KeywordCategoryController(this); scaController = new SemCoreArchiveController(this); ptController.GetProductTypesAll(); fill_cb_ProductTypes(); kcController.GetKeywordCategoriesByProductId(GetProductTypeIdFromCB()); fill_cb_KeywordCategory(); }
/* Выполняем в конструкторе */ 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 GetStarted() { ptController = new ProductTypesController(this); kcController = new KeywordCategoryController(this); fscController = new FullSemCoreController(this); fscController.GetSemCoreAll(); ptController.GetProductTypesAll(); kcController.GetKeywordCategoriesAll(); DrawKeywords(); FillCB(); }
public ProductTypesView() { InitializeComponent(); CurrentColumnCount = 0; ptController = new ProductTypesController(this); connection = DBData.GetDBConnection(); ptController.GetProductTypesAll(); Draw(); }
/* Конструктор */ public SemCoreView() { InitializeComponent(); CurrentColumnCount = 0; scController = new SemCoreController(this); kcController = new KeywordCategoryController(this); ptController = new ProductTypesController(this); kcController.GetKeywordCategoriesAll(); ptController.GetProductTypesAll(); Fill_CB_ByKeywordCategories(); Fill_CB_ByProductTypes(); }
/* Конструктор */ public ProductTypesView(MainFormView _mf) { InitializeComponent(); ptController = new ProductTypesController(this); controlMainFormView = _mf; ptController.GetProductTypesAll(); Draw(); if (dgv_ProductTypes.RowCount > 0) { label1.Visible = false; dgv_ProductTypes.Visible = true; } }
/* Конструктор */ public SemCoreView(MainFormView _mf) { InitializeComponent(); CurrentColumnCount = 0; mf = _mf; scController = new SemCoreController(this); kcController = new KeywordCategoryController(this); ptController = new ProductTypesController(this); kcController.GetKeywordCategoriesAll(); ptController.GetProductTypesAll(); Fill_CB_ByKeywordCategories(); Fill_CB_ByProductTypes(); tb_Link.Text = mf.AmazonLink; }
/* Выполняем в конструкторе */ private void GetStarted() { btn_Begin.Enabled = false; btn_KeysAreDone.Enabled = false; btn_Begin.Enabled = true; btn_KeysAreDone.Enabled = true; btn_Begin.Enabled = false; btn_KeysAreDone.Enabled = false; ptController = new ProductTypesController(this); kcController = new KeywordCategoryController(this); scController = new SemCoreController(this); ptController.GetProductTypesAll(); fill_cb_ProductTypes(); kcController.GetKeywordCategoriesByProductId(GetProductTypeIdFromCB()); fill_cb_KeywordCategory(); }
/* Конструктор */ public KeywordCategoryView(SemCoreView _mf) { InitializeComponent(); kcController = new KeywordCategoryController(this); ptController = new ProductTypesController(this); HardClose = false; connection = DBData.GetDBConnection(); controlSemCoreView = _mf; kcController.GetKeywordCategoriesJOINProductTypes(); Draw(); ptController.GetProductTypesAll(); fill_cb_ProductTypes(); }
/* Конструктор */ public SemCoreRebuildView() { InitializeComponent(); connection = DBData.GetDBConnection(); lb_NewKeys.Text = str_NewKeys; lb_UpdatedKeys.Text = str_UpdatedKeys; lb_UploadedKeys.Text = str_UploadedKeys; kcController = new KeywordCategoryController(this); ptController = new ProductTypesController(this); scController = new SemCoreController(this); kcController.GetKeywordCategoriesAll(); ptController.GetProductTypesAll(); Fill_CB_ByKeywordCategories(); Fill_CB_ByProductTypes(); GetKeywords(); firstLoad = false; }