Пример #1
0
 //|------------CONSTRUCTOR------------|
 public Cart()
 {
     ProductDao       = new ProductDao();
     SalesDao         = new SalesDao();
     this.StockDao    = new StockDao();
     this.ListCart    = new ObservableDictionary <Product, int>();
     this.ProductSold = new ObservableCollection <Sales>();
 }
Пример #2
0
        /// <summary>
        /// Shows a list of products purchased in a new view or in a ListView
        /// </summary>
        public void ShowProductsPurchased()
        {
            //TODO: criar tela com as compras realizadas
            this.ProductSold.Clear();
            IEnumerable <Sales> productsSold = SalesDao.GetProductsSold();

            foreach (Sales s in productsSold)
            {
                this.ProductSold.Add(s);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (comboBoxTerm.Text.ToString() != CosmeticConstant.DateMonth &&
                comboBoxTerm.Text.ToString() != CosmeticConstant.DateYear)
            {
                MessageBox.Show("기간을 다시 선택하세요", "오류");
                return;
            }

            int topCount = Convert.ToInt32(numericUpDownCount.Text);

            // 월을 선택하면
            if (comboBoxTerm.SelectedItem.ToString() == CosmeticConstant.DateMonth)
            {
                DateTime month = dateTimePicker.Value;
                //List<TopWorstProductModel> list = SalesDao.GetTopProductByMonth(month);
                List <TopWorstProductModel> list2 = SalesDao.GetTopProductByMonth(topCount, month);

                ChartHelper.ChangeChartTitle(chartPie, month.Year + "년" + month.Month + "월" + "TOP " + topCount.ToString());
                chartControl1.Hide();
                chartPie.Show();

                //bindingSourceTopProduct.DataSource = list;
                bindingSourceTopProduct2.DataSource = list2;
            }
            else if (comboBoxTerm.SelectedItem.ToString() == CosmeticConstant.DateYear)
            {
                DateTime year = dateTimePicker.Value;
                //List<TopWorstProductModel> list = SalesDao.GetTopProductByYear(year);
                List <TopWorstProductModel> list2 = SalesDao.GetTopProductByYear(topCount, year);

                ChartHelper.ChangeChartTitle(chartPie, year.Year + "년" + "TOP " + topCount.ToString());

                chartControl1.Hide();
                chartPie.Show();
                bindingSourceTopProduct2.DataSource = list2;
            }
        }
Пример #4
0
        /// <summary>
        /// // 단가 변경하는 메서드
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnChainge_Click(object sender, EventArgs e)
        {
            int IndexNo = new SalesDao().ProNo(comboProduct.Items[comboProSelectedIndex].ToString()); //제품번호

            try
            {
                if (CheckPrice(txtChaingePrice.Text))
                {
                    if (new SalesDao().PriceUpdate(IndexNo, Int32.Parse(txtChaingePrice.Text)))
                    {
                        MessageBox.Show("변경 성공");
                        PriceView();
                    }
                    else
                    {
                        MessageBox.Show("저장 실패");
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (comboBoxInterval.Text.ToString() != CosmeticConstant.DateMonth &&
                comboBoxInterval.Text.ToString() != CosmeticConstant.DateDay)
            {
                MessageBox.Show("기간을 다시 선택하세요", "오류");
                return;
            }

            // 월을 선택하면
            if (comboBoxInterval.SelectedItem.ToString() == CosmeticConstant.DateMonth)
            {
                DateTime month = dateTimePicker.Value;

                // 카테고리 선택했을 때
                if (checkBoxCategory.Checked == true)
                {
                    chartDayMonthSales.Hide();
                    chartControlSalesVolumeDayCategory.Hide();
                    chartControlSalesVolumeMonthCategory.Show();

                    List <SalesVolumeMonthCategoryModel> list = SalesDao.GetSalesVolumeByMonthCategory(month);

                    ChartHelper.ChangeChartTitle(chartControlSalesVolumeMonthCategory, string.Format($"카테고리별 월별 판매량 ({month.Year}.{month.Month} - {month.AddMonths(11).Year}.{month.AddMonths(11).Month})"));

                    //BarSeriesView view = chartControlSalesVolumeMonthCategory.SeriesTemplate.View as BarSeriesView;
                    //view.BarWidth = 20;

                    bindingSourceSalesVolumeMonthCategoryModel.DataSource = list;
                }
                else
                {
                    List <DayMonthSalesModel> list = SalesDao.GetSalesVolumeByMonth(month);

                    ChartHelper.ChangeChartTitle(chartDayMonthSales, string.Format($"월별 판매량 ({month.Year}.{month.Month} - {month.AddMonths(11).Year}.{month.AddMonths(11).Month})"));
                    ChartTitle chartTitle1 = new ChartTitle();

                    bindingSourceMonthDaySales.DataSource = list;

                    chartDayMonthSales.Series[0].Visible = true;
                    chartDayMonthSales.Series[1].Visible = false;

                    chartDayMonthSales.Show();
                    chartControlSalesVolumeMonthCategory.Hide();
                    chartControlSalesVolumeDayCategory.Hide();
                }
            }
            // 일을 선택하면 선택한 날의 카테고리별 판매 데이터를 출력한다
            else if (comboBoxInterval.SelectedItem.ToString() == CosmeticConstant.DateDay)
            {
                DateTime day = dateTimePicker.Value;

                if (checkBoxCategory.Checked == true)
                {
                    chartDayMonthSales.Hide();
                    chartControlSalesVolumeMonthCategory.Hide();
                    chartControlSalesVolumeDayCategory.Show();

                    List <SalesVolumeMonthCategoryModel> list = SalesDao.GetSalesVolumeByDayCategory(day);

                    ChartHelper.ChangeChartTitle(chartControlSalesVolumeDayCategory, string.Format($"카테고리별 일별 판매량 ({day.Year}.{day.Month}.{day.Day} - {day.AddDays(6).Year}.{day.AddDays(6).Month}.{day.AddDays(6).Day})"));

                    BarSeriesView view = chartControlSalesVolumeDayCategory.SeriesTemplate.View as BarSeriesView;
                    view.BarWidth = 0.3D;

                    bindingSourceSalesVolumeDayCategoryModel.DataSource = list;
                }
                else
                {
                    List <DaySalesByCategoryModel> list = SalesDao.GetSalesVolumeByDay(day);

                    ChartHelper.ChangeChartTitle(chartDayMonthSales, string.Format($"판매량 {day.Year}.{day.Month}.{day.Day}"));
                    ChartTitle chartTitle1 = new ChartTitle();

                    bindingSourceDaySales.DataSource = list;

                    chartDayMonthSales.Series[1].Visible = true;
                    chartDayMonthSales.Series[0].Visible = false;

                    chartDayMonthSales.Show();
                    chartControlSalesVolumeMonthCategory.Hide();
                    chartControlSalesVolumeDayCategory.Hide();
                }
            }
        }