Esempio n. 1
0
        private void btnGetAll_Click(object sender, EventArgs e)
        {
            try
            {
                int bId = 0;
                if (rbReda1.Checked)
                {
                    bId = 1;
                }
                else
                {
                    bId = 2;
                }

                DateTime from = new DateTime(cmbFrom.DateTime.Year, cmbFrom.DateTime.Month, cmbFrom.DateTime.Day, 0, 0, 0);
                DateTime to   = new DateTime(cmbTo.DateTime.Year, cmbTo.DateTime.Month, cmbTo.DateTime.Day, 23, 59, 59);
                db = new DataAccess.RedaV1Entities(ModuleClass.Connect());

                var list = db.PurchaseInvoices.Where(s => s.BranchID == bId && s.Date >= from && s.Date <= to).ToList();
                bindingSource1.DataSource = list;
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Esempio n. 2
0
        void GetInvoices()
        {
            try
            {
                if (rbSearchByDate.Checked)
                {
                    DateTime from = new DateTime(cmbFrom.DateTime.Year, cmbFrom.DateTime.Month, cmbFrom.DateTime.Day, 0, 0, 0);
                    DateTime to   = new DateTime(cmbTo.DateTime.Year, cmbTo.DateTime.Month, cmbTo.DateTime.Day, 23, 59, 59);
                    db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
                    var list = db.PurchaseInvoices.Where(s => s.BranchID == branchID && s.Date >= from && s.Date <= to).ToList();
                    bindingSource1.DataSource = list;
                }
                else
                {
                    string query = txtSearch.Text;

                    db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
                    db.PurchaseInvoices.Where(s => s.Number.Contains(query)).Load();
                    var list = db.PurchaseInvoices.Local.ToBindingList();
                    bindingSource1.DataSource = list;
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Esempio n. 3
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         string query = txtSearch.Text;
         if (e.KeyCode == Keys.Enter)
         {
             db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
             if (!chHidden.Checked)
             {
                 db.Items.Where(s => s.Name.Contains(query) && s.Hidden == false).Load();
                 var list = db.Items.Local.ToBindingList();
                 bindingSource1.DataSource = list;
             }
             else
             {
                 db.Items.Where(s => s.Name.Contains(query)).Load();
                 var list = db.Items.Local.ToBindingList();
                 bindingSource1.DataSource = list;
             }
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Esempio n. 4
0
 private void btnShowHidden_Click(object sender, EventArgs e)
 {
     try
     {
         db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
         db.Items.Where(s => s.Hidden == true).Load();
         var list = db.Items.Local.ToBindingList();
         bindingSource1.DataSource = list;
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Esempio n. 5
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         string query = txtSearch.Text;
         if (e.KeyCode == Keys.Enter)
         {
             db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
             db.PurchaseInvoices.Where(s => s.Number.Contains(query)).Load();
             var list = db.PurchaseInvoices.Local.ToBindingList();
             bindingSource1.DataSource = list;
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Esempio n. 6
0
        private void btnGetAll_Click(object sender, EventArgs e)
        {
            try
            {
                db = new DataAccess.RedaV1Entities(ModuleClass.Connect());

                bindingSourceUsers.DataSource = db.Users.Where(s => s.IsEnable == true).ToList();
                // db.Items.Local.Clear();
                // var list = new ObservableCollection(db.ItemCategories.ToList());
                //db.Configuration.LazyLoadingEnabled = false;
                // db.Items.Where(s => s.ID > 8);
                db.SaleInvoices.Load();

                ///  db.Items.Local.AsLive().OrderBy(x => x.Id);
                var list = db.SaleInvoices.Local.ToBindingList();
                bindingSourceSaleInvoice.DataSource = list;
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }