Beispiel #1
0
 /* Добавить новый тип товара в БД */
 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("Введите название новой категории.", "Ошибка");
     }
 }
Beispiel #2
0
        /* Добавляем/изменяем вид товара */
        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;
            }
        }
Beispiel #3
0
        /* Добавить новую категори в БД */
        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("Введите название категории.", "Ошибка");
            }
        }
Beispiel #4
0
        /* Конструктор */
        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;
        }
Beispiel #5
0
        /* Заполняем (перезаполняем после изменений) все поля на форме данными с БД */
        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();
            }
        }
Beispiel #6
0
        /* Выполняем в конструкторе */
        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();
        }
Beispiel #7
0
        /* Заполняем (перезаполняем после изменений) все поля на форме данными с БД */
        private void FillAllFields()
        {
            pController.GetProductsAllJOIN();
            DrawProducts();
            DrawProductTypes();

            ptController.GetProductTypesAll();
            Fill_CB_ByProductTypes();
        }
Beispiel #8
0
        /* Обновляем оба CB и ключи по ним */
        private void Refresh_CB_AndKeywords()
        {
            kcController.GetKeywordCategoriesAll();
            ptController.GetProductTypesAll();

            Fill_CB_ByKeywordCategories();
            Fill_CB_ByProductTypes();

            GetKeywords();
        }
Beispiel #9
0
        /* Выполняем в конструкторе */
        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();
        }
Beispiel #10
0
        /* Выполняем в конструкторе */
        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());
        }
Beispiel #11
0
        /* Выполняем в конструкторе */
        private void GetStarted()
        {
            ptController  = new ProductTypesController(this);
            kcController  = new KeywordCategoryController(this);
            fscController = new FullSemCoreController(this);

            fscController.GetSemCoreAll();
            ptController.GetProductTypesAll();
            kcController.GetKeywordCategoriesAll();
            DrawKeywords();
            FillCB();
        }
Beispiel #12
0
        public ProductTypesView()
        {
            InitializeComponent();
            CurrentColumnCount = 0;

            ptController = new ProductTypesController(this);

            connection = DBData.GetDBConnection();

            ptController.GetProductTypesAll();
            Draw();
        }
Beispiel #13
0
        /* Конструктор */
        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();
        }
Beispiel #14
0
        /* Конструктор */
        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;
            }
        }
Beispiel #15
0
        /* Конструктор */
        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;
        }
Beispiel #16
0
        /* Выполняем в конструкторе */
        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();
        }
Beispiel #17
0
        /* Конструктор */
        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();
        }
Beispiel #18
0
        /* Конструктор */
        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;
        }