private void btnGetSaleBetween_Click(object sender, EventArgs e)
 {
     btnSaveSaleInFile.Visible = true;
     if (ckBoxMonth.Checked)
     {
         var helper = new SaleProductManager();
         dtGrSaleBetween.DataSource = helper.GetSaleMonth(Convert.ToDateTime(dtMonth.Text));
         dtGrSaleBetween.Columns["Id"].Visible = false;
         dtGrSaleBetween.Columns["LabelName"].HeaderText = "Марка";
         dtGrSaleBetween.Columns["Name"].HeaderText = "Название";
         dtGrSaleBetween.Columns["Name"].FillWeight = 250;
         dtGrSaleBetween.Columns["Price"].HeaderText = "Сумма продажи";
         dtGrSaleBetween.Columns["Discount"].HeaderText = "Скидка";
         dtGrSaleBetween.Columns["Count"].HeaderText = "Количество";
         dtGrSaleBetween.Columns["DateTimeSale"].HeaderText = "Дата продажи";
         txtAllPriceGrid.Text = helper.GetAllSalePrice(helper.GetSaleMonth(Convert.ToDateTime(dtMonth.Text))).ToString();
         txtCountProductGrid.Text = helper.GetAllSaleCount(helper.GetSaleMonth(Convert.ToDateTime(dtMonth.Text))).ToString();
     }
     else
     {
         var helper = new SaleProductManager();
         dtGrSaleBetween.DataSource = helper.GetSaleBetween(Convert.ToDateTime(dtBegin.Text), Convert.ToDateTime(dtEnd.Text));
         dtGrSaleBetween.Columns["Id"].Visible = false;
         dtGrSaleBetween.Columns["LabelName"].HeaderText = "Марка";
         dtGrSaleBetween.Columns["Name"].HeaderText = "Название";
         dtGrSaleBetween.Columns["Name"].FillWeight = 250;
         dtGrSaleBetween.Columns["Price"].HeaderText = "Сумма продажи";
         dtGrSaleBetween.Columns["Discount"].HeaderText = "Скидка";
         dtGrSaleBetween.Columns["Count"].HeaderText = "Количество";
         dtGrSaleBetween.Columns["DateTimeSale"].HeaderText = "Дата продажи";
         txtAllPriceGrid.Text = helper.GetAllSalePrice(helper.GetSaleBetween(Convert.ToDateTime(dtBegin.Text), Convert.ToDateTime(dtEnd.Text))).ToString();
         txtCountProductGrid.Text = helper.GetAllSaleCount(helper.GetSaleBetween(Convert.ToDateTime(dtBegin.Text), Convert.ToDateTime(dtEnd.Text))).ToString();
     }
 }
 private void btnSaveSaleInFile_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog FBD = new FolderBrowserDialog();
     if (FBD.ShowDialog() == DialogResult.OK)
     {
         if (ckBoxMonth.Checked)
         {
             var helper = new SaleProductManager();
             if (helper.WriteSaleInFile(helper.GetSaleMonth(Convert.ToDateTime(dtMonth.Text)), FBD.SelectedPath.ToString()) &&
                 helper.WriteStringInFile("Всего продано " + txtCountProductGrid.Text + " шт. на сумму " + txtAllPriceGrid.Text + "000 рублей", FBD.SelectedPath.ToString()))
             {
                 MessageBox.Show("Продажи сохранены в файл!");
             }
             else
             {
                 MessageBox.Show("Упс! Что-то пошло не так!");
             }
         }
         else
         {
             var helper = new SaleProductManager();
             if (helper.WriteSaleInFile(helper.GetSaleBetween(Convert.ToDateTime(dtBegin.Text), Convert.ToDateTime(dtEnd.Text)), FBD.SelectedPath.ToString()) &&
                 helper.WriteStringInFile("Всего продано " + txtCountProductGrid.Text + " шт. на сумму " + txtAllPriceGrid.Text + "000 рублей", FBD.SelectedPath.ToString()))
             {
                 MessageBox.Show("Продажи сохранены в файл!");
             }
             else
             {
                 MessageBox.Show("Упс! Что-то пошло не так!");
             }
         }
     }
 }