コード例 #1
0
ファイル: ProductsView.cs プロジェクト: lolodin7/ahead
        /* Заполняем (перезаполняем после изменений) все поля на форме данными с БД */
        private void FillAllFields()
        {
            pController.GetProductsAllJOIN();
            DrawProducts();
            DrawProductTypes();

            ptController.GetProductTypesAll();
            Fill_CB_ByProductTypes();
        }
コード例 #2
0
ファイル: ProductsView.cs プロジェクト: lolodin7/ahead
        /* Заполняем (перезаполняем после изменений) все поля на форме данными с БД */
        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();
            }
        }
コード例 #3
0
        public ReportBusinessUploadView(MainFormView _mf, string _mode)
        {
            InitializeComponent();
            mf        = _mf;
            FirstLoad = true;

            UpdateDate = DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59);
            StartDate  = DateTime.Today;
            EndDate    = DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59);

            DaysDiff         = (EndDate - StartDate).Days + 1;
            lb_DaysDiff.Text = "Разница дат - " + DaysDiff;

            lb_startDateText.Text = StartDate.ToString().Substring(0, 10);
            lb_endDateText.Text   = EndDate.ToString().Substring(0, 10);

            lb_mcDate.Text = UpdateDate.ToString().Substring(0, 10);

            businessList = new List <ReportBusinessModel> {
            };

            mpList        = new List <MarketplaceModel> {
            };
            pList         = new List <ProductsModel> {
            };
            FileNames     = new List <string> {
            };
            missedColumns = new List <int> {
            };

            businessController = new BusinessController(this);
            mpController       = new MarketplaceController(this);
            prodController     = new ProductsController(this);
            reportDataAnalyzer = new ReportDataAnalyzer(this);

            if (_mode.Equals("upload"))
            {
                UploadMode    = true;
                UpdateMode    = false;
                this.Text     = "Загрузить Business Report";
                btn_Save.Text = "Сохранить";
            }
            else if (_mode.Equals("update"))
            {
                UploadMode    = false;
                UpdateMode    = true;
                this.Text     = "Обновить Business Report";
                btn_Save.Text = "Обновить";
            }

            if (mpController.GetMarketplaces() == 1)
            {
                Fill_CB_Marketplace();
            }

            prodController.GetProductsAllJOIN();


            FirstLoad = false;
        }
コード例 #4
0
        public EveryDayReportsUpdate(MainFormView _mf)
        {
            InitializeComponent();
            mf = _mf;

            //path = @ConfigurationManager.AppSettings.Get("reportsPath");
            path           = "D:\\BonaFides - отчеты\\!test_tmp\\everyday";
            adv_path       = path + "\\Advertising";
            bus_path       = path + "\\Business-Reports";
            inventory_path = path + "\\Amazon-check-stock";
            orders_path    = path + "\\All-orders";



            updatedRowsCount = 0;

            advProductsList = new List <AdvertisingProductsModel> {
            };
            advBrandsList   = new List <AdvertisingBrandsModel> {
            };
            campTList       = new List <CampaignTypesModel> {
            };
            pList           = new List <ProductsModel> {
            };
            businessList    = new List <ReportBusinessModel> {
            };
            missedColumns   = new List <int> {
            };

            businessController = new BusinessController(this);
            campTController    = new CampaignTypesController(this);
            advertController   = new AdvertisingController(this);
            prodController     = new ProductsController(this);
            reportDataAnalyzer = new ReportDataAnalyzer(this);

            AP_campaignIdsList = new List <MapNameId> {
            };
            AB_campaignIdsList = new List <MapNameId> {
            };

            advProductsListOfErrors = new List <AdvertisingProductsModel> {
            };
            advBrandsListOfErrors   = new List <AdvertisingBrandsModel> {
            };

            UpdateDate = DateTime.Today;
            StartDate  = DateTime.Today;
            EndDate    = DateTime.Today.AddHours(23).AddMinutes(59);

            mpList = new List <Marketplace> {
                new Marketplace(1, "PowerDeWise (USA)", "pdw usa"), new Marketplace(2, "PowerDeWise (CA)", "pdw ca"), new Marketplace(3, "PowerDeWise (AU)", "pdw au"), new Marketplace(4, "PowerDeWise (MX)", "pdw mx"), new Marketplace(5, "LetIt.Beer (USA)", "letit beer usa"), new Marketplace(6, "LetIt.Beer (CA)", "letit beer ca"), new Marketplace(7, "PowerDeWise (JP)", "pdw jp"), new Marketplace(8, "Others", "others")
            };

            prodController.GetProductsAllJOIN();
        }
コード例 #5
0
ファイル: LoggerAdd.cs プロジェクト: lolodin7/ahead
        public LoggerAdd(LoggerView _mf, UserModel _um)
        {
            InitializeComponent();
            loggerViewControl = _mf;

            creationDate = DateTime.Now;

            uList = _um;

            pList              = new List <ProductsModel> {
            };
            mpList             = new List <MarketplaceModel> {
            };
            logList            = new List <LoggerModel> {
            };
            uniqueProductNames = new List <string> {
            };
            imageNamesForSave  = new List <string> {
            };
            asinSkuPairs       = new List <LoggerAddAsinSkuPairs> {
            };

            pController   = new ProductsController(this);
            mpController  = new MarketplaceController(this);
            logController = new LoggerController(this);

            lb_creationDate.Text     = creationDate.ToString().Substring(0, 10);
            lb_CreationUserName.Text = uList.Name;


            mpController.GetMarketplaces();

            pController.GetProductsAllJOIN();
            pList = pList.Distinct().ToList <ProductsModel>();
            Fill_CB_ByProducts();



            pbList = new List <PictureBox> {
            };
            pbList.Add(pictureBox1);
            pbList.Add(pictureBox2);
            pbList.Add(pictureBox3);
            pbList.Add(pictureBox4);
            pbList.Add(pictureBox5);
            pbList.Add(pictureBox6);
            pbList.Add(pictureBox7);
            pbList.Add(pictureBox8);
            pbList.Add(pictureBox9);
            pbList.Add(pictureBox10);
        }
コード例 #6
0
ファイル: ReportStockView.cs プロジェクト: lolodin7/ahead
        /* Конструктор */
        public ReportStockView(MainFormView _mf)
        {
            InitializeComponent();
            mf         = _mf;
            connection = DBData.GetDBConnection();
            cb_FilterParameter.SelectedIndex = 0;

            mpController    = new MarketplaceController(this);
            prodController  = new ProductsController(this);
            stockController = new ReportStockController(this);

            stockList       = new List <StockModel> {
            };
            pList           = new List <ProductsModel> {
            };
            mpList          = new List <MarketplaceModel> {
            };
            sales7daysList  = new List <AllOrdersModel> {
            };
            sales30daysList = new List <AllOrdersModel> {
            };

            filterEnabled = false;

            if (mpController.GetMarketplaces() == 1)
            {
                Fill_CB_Marketplace();
            }

            prodController.GetProductsAllJOIN();
            stockController.GetStock(DateTime.Today.AddDays(-10), DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59));
            if (stockList.Count > 0)
            {
                GetLatestDateAndProcessStockList();
                CalcValues();
                DrawTableColumns();
                DrawTableValues();
            }
            else
            {
                dgv_Stock.Visible                = false;
                label3.Visible                   = true;
                cb_MarketPlace.Enabled           = false;
                cb_FilterParameter.Enabled       = false;
                rtb_FilterParameterValue.Enabled = false;
                btn_GoFilter.Enabled             = false;
            }
        }
コード例 #7
0
ファイル: Advreport7days.cs プロジェクト: lolodin7/ahead
        public int Generate()
        {
            int result = 1;

            result = prodControl.GetProductsAllJOIN();
            result = marketplaceControl.GetMarketplaces();


            PrepareDatesList();
            result = GetAdvertisingData();
            result = GetDiffValues();
            GetUniqueValues();

            SortResultListByImpressions();

            result = CreateExcelFile();
            return(result);
        }
コード例 #8
0
        /* Загрузка файла, его обработка и преобразование в List */
        private void btn_UploadFromFile_Click(object sender, EventArgs e)
        {
            prodController.GetProductsAllJOIN();

            openFileDialog1.Filter   = "Неразмеченные файлы|*.csv";
            openFileDialog1.Title    = "Выбор файла для открытия";
            openFileDialog1.FileName = "";

            bool firstRow = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                stockList.Clear();
                path = openFileDialog1.FileName;

                try
                {
                    using (TextFieldParser parser = new TextFieldParser(@path))
                    {
                        parser.TextFieldType = FieldType.Delimited;

                        parser.SetDelimiters(",");

                        string[] fields;

                        while (!parser.EndOfData)
                        {
                            //Process row
                            fields = parser.ReadFields();

                            if (!firstRow)
                            {
                                StockModel tmpObj = new StockModel();

                                tmpObj.UpdateDate       = UpdateDate;
                                tmpObj.ASIN             = fields[2];
                                tmpObj.SKU              = fields[0];
                                tmpObj.FNSKU            = fields[1];
                                tmpObj.Name             = fields[3];
                                tmpObj.FulfillableItems = int.Parse(fields[10]);
                                tmpObj.ReservedItems    = int.Parse(fields[12]);
                                tmpObj.InboundShipped   = int.Parse(fields[16]);
                                tmpObj.InboundWorking   = int.Parse(fields[15]);

                                tmpObj.MarketPlaceId = GetMarketPlaceIdByName(cb_MarketPlace.SelectedItem.ToString());
                                tmpObj.ProductId     = GetProductIdBySku(tmpObj.SKU, tmpObj.MarketPlaceId);

                                stockList.Add(tmpObj);
                            }
                            else
                            {
                                firstRow = false;
                            }
                        }
                        lb_Path.Text = path;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Проблема при открытии файла. Убедитесь, что Вы выбрали файл с нужны расширением. Возможно, разметка файла не поддерживается программой.", "Ошибка при открытии");
                    stockList.Clear();
                }
            }
        }
コード例 #9
0
ファイル: LoggerView.cs プロジェクト: lolodin7/ahead
        /* Конструктор */
        public LoggerView(MainFormView _mf, UserModel _um)
        {
            InitializeComponent();


            firstRun  = true;
            startDate = DateTime.Today;
            //endDate = DateTime.Now;
            endDate = DateTime.Today.AddHours(23).AddMinutes(59);

            asinFilter             = false;
            skuFilter              = false;
            productNameFilter      = false;
            creationUserNameFilter = false;

            productIdForFilter = creationUserIdForFilter = -1;
            asinForFilter      = skuForFilter = "Все";

            previousCountOfLogs = 0;
            connection          = DBData.GetDBConnection();
            mf        = _mf;
            userModel = _um;

            notifyIcon1.Visible = true;

            pList   = new List <ProductsModel> {
            };
            mpList  = new List <MarketplaceModel> {
            };
            logList = new List <LoggerModel> {
            };
            uList   = new List <UserModel> {
            };

            uniqueProductNames = new List <string> {
            };
            uniqueASINs        = new List <string> {
            };

            pController   = new ProductsController(this);
            mpController  = new MarketplaceController(this);
            logController = new LoggerController(this);
            lfController  = new LoginFormController(this);

            lb_StartDate.Text = startDate.ToString().Substring(0, 10);
            lb_EndDate.Text   = endDate.ToString().Substring(0, 10);
            label4.Text       = "С " + startDate.ToString().Substring(0, 10);
            label5.Text       = "По " + endDate.ToString().Substring(0, 10);


            mpController.GetMarketplaces();

            pController.GetProductsAllJOIN();
            Fill_CB_ByProducts();

            lfController.GetAllUsers();
            Fill_CB_ByUsers();

            logController.GetAllRecordsByDate(startDate, endDate);
            if (logList.Count > 0)
            {
                label6.Visible      = false;
                dgv_Log.Visible     = true;
                previousCountOfLogs = logList.Count;
                Draw_dgv_Logs();
            }

            timer1.Enabled = true;
            timer1.Start();
        }