private void btnSearch_Click(object sender, EventArgs e)
        {
            UIUtilties.Loading(true);
            DateTime date = dtpDay.Value;

            try
            {
                dgvSales.Rows.Clear();
                txtTotal.Text         = "";
                txtTotalDiscount.Text = "";
                txtTotalSale.Text     = "";
                List <Order> orders = access.GetAllOrders(date.Date);

                total         = 0;
                totalSale     = 0;
                totalDiscount = 0;

                foreach (Order order in orders)
                {
                    AddOrder(order);
                }

                RefreshTotal();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error Message...");
            }
            UIUtilties.Loading(false);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            UIUtilties.Loading(true);
            DateTime date1 = DateTime.Now.AddMonths(-1);
            DateTime date2 = DateTime.Now;

            if (rdoDayly.Checked)
            {
                date1 = dtpDay.Value;
                date2 = date1;
            }
            else if (rdoInterval.Checked)
            {
                date1 = dtpFrom.Value;
                date2 = dtpTo.Value;
            }

            try
            {
                dgvSales.Rows.Clear();
                txtTotal.Text         = "";
                txtTotalDiscount.Text = "";
                txtTotalSale.Text     = "";
                List <OrdersInfo> orders = access.GetAllOrdersInfo(date1.Date, date2.Date);

                int   counter = 1;
                float total = 0, totalSale = 0, totalDiscount = 0;

                counter = 1;
                foreach (OrdersInfo order in orders)
                {
                    dgvSales.Rows.Add(new object[] { counter, order.Date.ToShortDateString(), order.Total, order.TotalSale, order.Discount });
                    total         += order.Total;
                    totalSale     += order.TotalSale;
                    totalDiscount += order.Discount;
                    counter++;
                }

                txtTotal.Text         = total + "";
                txtTotalDiscount.Text = totalDiscount + "";
                txtTotalSale.Text     = totalSale + "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error Message...");
            }
            UIUtilties.Loading(false);
        }
예제 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     try
     {
         if (Validate())
         {
             client.Id = access.SaveClient(client);
             MessageBox.Show(" تم الحفظ", "Message....", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("لم يتم الحفظ" + "\n" + ex.Message, "Error Message....", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     UIUtilties.Loading(false);
 }
예제 #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     try
     {
         if (Validate())
         {
             order.Id = access.SaveOrder(order);
             MessageBox.Show(" تم الحفظ", "Message....", MessageBoxButtons.OK, MessageBoxIcon.Information);
             if (listener != null)
             {
                 listener.onAdded(order);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("لم يتم الحفظ" + "\n" + ex.Message, "Error Message....", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     UIUtilties.Loading(false);
 }
예제 #5
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     try
     {
         if (Validate())
         {
             if (access.UpdateOrder(order))
             {
                 MessageBox.Show(" تم التعديل", "Message....", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("لم يتم التعديل", "Error Message....", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("لم يتم التعديل" + "\n" + ex.Message, "Error Message....", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
     UIUtilties.Loading(false);
 }
예제 #6
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     ReFillData();
     UIUtilties.Loading(false);
 }
예제 #7
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     LoadData();
     UIUtilties.Loading(false);
 }