using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TinyHeels.App_Code;
namespace TinyHeels
{
    public partial class OldSales : Form
    {
        public OldSales()
        {
            InitializeComponent();
            txtDate1.Value = DateTime.Parse(txtDate1.Value.ToShortDateString());
            txtDate2.Value = DateTime.Parse(txtDate2.Value.ToShortDateString());
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Common.command = false;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime d1 = DateTime.Parse(txtDate1.Value.ToShortDateString());
                DateTime d2 = DateTime.Parse(txtDate2.Value.ToShortDateString());
                Orders ord = new Orders();
                ord.date1 = d1;
                ord.date2 = d2;
                DataTable dt = ord.getOrderBetweenDate();
                onOrderGrid.DataSource = dt;
             
            }
            catch (Exception ex)
            {

            }
        }

        private void onOrderGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Common.OrderId = onOrderGrid.SelectedRows[0].Cells[0].Value.ToString();
                Common.command = true;
                this.Close();
            }
            catch (Exception ex)
            {

            }
        }
    }
}
