예제 #1
0
        public static List <TransactionReportModel> GetAllReport()
        {
            tokobediaModelContainer       dbs     = new tokobediaModelContainer();
            List <TransactionReportModel> allData = new List <TransactionReportModel>();
            var result = (from x in dbs.HeaderTransactions
                          join y in dbs.DetailTransactions on x.ID equals y.TransactionID
                          join z in dbs.PaymentTypes on x.PaymentTypeID equals z.ID
                          join w in dbs.Products on y.ProductID equals w.ID
                          join v in dbs.Users on x.UserID equals v.Id
                          select new
            {
                TransID = x.ID,
                UserName = v.Name,
                Date = x.Date,
                ProductName = w.Name,
                Quantity = y.Quantity,
                ProductPrice = w.Price
            }).ToList();

            foreach (var xdata in result)
            {
                allData.Add(TransactionReportFactory.createTransRepObject(xdata));
            }

            return(allData);
        }
예제 #2
0
 public static tokobediaModelContainer GetInstance()
 {
     if (db == null)
     {
         db = new tokobediaModelContainer();
     }
     return(db);
 }
        private void showPaymentList()
        {
            tokobediaModelContainer db = new tokobediaModelContainer();
            var query = from g in db.PaymentTypes
                        select new
            {
                PaymentTypeId   = g.ID,
                PaymentTypeName = g.Type
            };

            GridView1.DataSource = query.ToList();
            GridView1.DataBind();
        }
예제 #4
0
        protected void loadgrid2()
        {
            tokobediaModelContainer db   = new tokobediaModelContainer();
            List <Product>          prod = new List <Product>();
            Random rnd    = new Random();
            int    value1 = 0;
            int    value2 = 0;
            int    value3 = 0;
            int    value4 = 0;
            int    value5 = 0;
            var    v      = db.Products.OrderByDescending(t => t.ID).First();
            var    d      = db.Products.OrderBy(c => c.ID).First();
            var    e      = db.Products.ToList().Count;

            do
            {
                value1 = rnd.Next(1, e);
            } while (ProductRepository.checkProductId(value1) == null);
            do
            {
                value2 = rnd.Next(1, e);
            } while (ProductRepository.checkProductId(value2) == null || value2 == value1);
            do
            {
                value3 = rnd.Next(1, e);
            } while (ProductRepository.checkProductId(value3) == null || value3 == value2 || value3 == value1);
            do
            {
                value4 = rnd.Next(1, e);
            } while (ProductRepository.checkProductId(value4) == null || value4 == value3 || value4 == value2 || value4 == value1);
            do
            {
                value5 = rnd.Next(1, e);
            } while (ProductRepository.checkProductId(value5) == null || value5 == value4 || value5 == value3 || value5 == value2 || value5 == value1);
            var query = from g in db.Products
                        join m in db.ProductTypes on g.ID equals m.ID
                        where g.ID == value1 || g.ID == value2 || g.ID == value3 || g.ID == value4 || g.ID == value5
                        select new
            {
                productId       = g.ID,
                productTypeName = m.Name,
                ProductName     = g.Name,
                ProductPrice    = g.Price,
                ProductStock    = g.Stock
            };

            GridRandomItem.DataSource = query.ToList();
            GridRandomItem.DataBind();
        }
        protected void loadgrid()
        {
            tokobediaModelContainer db = new tokobediaModelContainer();
            var query = from g in db.Products
                        join m in db.ProductTypes on g.ProductTypeID equals m.ID
                        select new
            {
                Id          = g.ID,
                Name        = g.Name,
                ProductType = m.Name,
                Stock       = g.Stock,
                Price       = g.Price
            };

            GridAllItem.DataSource = query.ToList();
            GridAllItem.DataBind();
        }