コード例 #1
0
        public void onUpdated(Product product)
        {
            int index = GetRowIndex(product);

            if (index != -1)
            {
                products[index] = product;
                DataGridViewRow row = dgvProducts.Rows[index];
                row.Cells["ColumnName"].Value      = product.Name + "";
                row.Cells["ColumnPrice"].Value     = product.Price + "";
                row.Cells["ColumnPriceSale"].Value = product.PriceSale + "";
                row.Cells["ColumnQuantity"].Value  = product.Quantity + "";
                row.Cells["ColumnLimit"].Value     = product.Limit + "";

                UIUtilties.DataGridView_RowAdded(dgvProducts, index, product.IsCritical());

                if (productsCritical.Exists(element => element.Id == product.Id))
                {
                    if (!product.IsCritical())
                    {
                        productsCritical.Remove(product);
                    }
                }
                else if (product.IsCritical())
                {
                    productsCritical.Add(product);
                }
            }
        }
コード例 #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (DatabaseAccess.getInstance().GetCountProductsRequired() > 0)
     {
         UIUtilties.ShowNotification("من فضلك تحقق من الكميات المتاحة للمنتجات");
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
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);
 }
コード例 #6
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);
 }
コード例 #7
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);
 }
コード例 #8
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     ReFillData();
     UIUtilties.Loading(false);
 }
コード例 #9
0
        private void dgvProducts_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            Product product = products[e.RowIndex];

            UIUtilties.DataGridView_RowAdded(sender, e.RowIndex, product.IsCritical());
        }
コード例 #10
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     UIUtilties.Loading(true);
     LoadData();
     UIUtilties.Loading(false);
 }
コード例 #11
0
 private void dgvSales_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     UIUtilties.DataGridView_RowAdded(sender, e.RowIndex);
 }