Exemplo n.º 1
0
        private void button8_Click(object sender, EventArgs e)
        {
            DBContext myDB = new DBContext();

            myDB.products.Load();
            StoreModels.Contact c = new StoreModels.Contact(); c = null;
            bool isPaid           = true;

            StoreModels.Check ch = new StoreModels.Check(); ch = null;
            var lst = myDB.products.ToList();

            if (lst.Count == 0)
            {
                MessageBox.Show("محصولی ثبت نشده");
                return;
            }

            List <StoreModels.ProductTransactionItem> listpti = new List <StoreModels.ProductTransactionItem>();

            for (int i = 0; i < lst.Count; i++)
            {
                StoreModels.ProductTransactionItem temp = new StoreModels.ProductTransactionItem()
                {
                    Product      = lst[i],
                    Count        = 3,
                    ItemPrice    = lst[0].SellPrice,
                    ItemDiscount = 0,
                };
                listpti.Add(temp);
            }

            Store myStore = new Store();

            myStore.sell(listpti, DateTime.Now, null, isPaid, c, ch);
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            StoreModels.Check ch = new StoreModels.Check()
            {
                Date         = DateTime.Now,
                Price        = 2000,
                VosoolStatus = StoreModels.Check.VosoolStatuses.pishAzMoed,
                BankBranch   = "1234"
            };

            DBContext myDb = new DBContext();

            myDb.save(ch);
        }
Exemplo n.º 3
0
        private void button16_Click(object sender, EventArgs e)
        {
            DBContext myDb = null;

            try
            {
                myDb = new DBContext();
                StoreModels.Check ck = myDb.checks.Where(i => i.Code == 4).First();
                myDb.checks.Attach(ck);
                myDb.delete(ck);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }