Esempio n. 1
0
        /*==================Header transaction Repository=====================*/

        /*  Manipulate Header Transaction  */
        public static int addTransactionToDatabase(HeaderTransaction t)
        {
            db.HeaderTransactions.Add(t);
            return(db.SaveChanges());
        }
Esempio n. 2
0
 public static HeaderTransaction addHT(HeaderTransaction HT)
 {
     db.HeaderTransactions.Add(HT);
     db.SaveChanges();
     return(HT);
 }
Esempio n. 3
0
 public static void addHeaderTransaction(HeaderTransaction headerTransaction)
 {
     db.HeaderTransactions.Add(headerTransaction);
     db.SaveChanges();
 }
        public static HeaderTransaction getTransaction(int ID)
        {
            HeaderTransaction ht = (from x in db.HeaderTransactions where x.ID == ID select x).FirstOrDefault();

            return(ht);
        }
        protected void LoadDetailTransaction()
        {
            int transactionId = Convert.ToInt32(Request.QueryString["ID"]);
            List <DetailTransaction> detailTransactionList = DetailTransactionController.getDetailTransactionById(transactionId);

            int userId           = getUserId();
            HeaderTransaction ht = HeaderTransactionController.getHeaderTransactionByTransactionId(transactionId);

            int subtotal   = 0;
            int grandtotal = 0;

            for (int i = 0; i < detailTransactionList.Count; i++)
            {
                TableRow newRow = new TableRow();
                HeaderTransactionHistoryTable.Controls.Add(newRow);

                TableCell numberCell = new TableCell();
                numberCell.Controls.Add(new Label()
                {
                    // Letak Masukkin Nomor
                    Text = (i + 1) + "."
                });
                newRow.Cells.Add(numberCell);

                //Cari nama Product dari product
                int     productId = detailTransactionList.ElementAt(i).ProductID;
                Product products  = ProductController.getProductById(productId);

                TableCell TransactionProductNameCell = new TableCell();
                TransactionProductNameCell.Controls.Add(new Label()
                {
                    Text = products.Name
                });
                newRow.Cells.Add(TransactionProductNameCell);


                //Quantity
                TableCell TransactionProductQuantityCell = new TableCell();
                TransactionProductQuantityCell.Controls.Add(new Label()
                {
                    Text = detailTransactionList.ElementAt(i).Quantity.ToString()
                });
                newRow.Cells.Add(TransactionProductQuantityCell);


                //Subtotal
                subtotal = (products.Price * detailTransactionList.ElementAt(i).Quantity);
                TableCell subTotalCell = new TableCell();
                subTotalCell.Controls.Add(new Label()
                {
                    Text = "Rp. " + subtotal.ToString()
                });
                newRow.Cells.Add(subTotalCell);


                //GrandTotal
                grandtotal = grandtotal + subtotal;
            }

            PaymentType pays = PaymentTypeController.getPaymentTypeById(ht.PaymentTypeID);

            LblGrandTotal.Text      = "Rp. " + grandtotal.ToString();
            LblPaymentType.Text     = pays.Type.ToString();
            LblTransactionDate.Text = ht.Date.ToString("dd-MM-yyyy");
        }
Esempio n. 6
0
 public static HeaderTransaction addHeaderTransaction(HeaderTransaction newHeaderTransaction)
 {
     db.HeaderTransactions.Add(newHeaderTransaction);
     db.SaveChanges();
     return(newHeaderTransaction);
 }
 public static HeaderTransaction AddTransactionHeader(HeaderTransaction transactionHeader)
 {
     db.HeaderTransactions.Add(transactionHeader);
     db.SaveChanges();
     return(transactionHeader);
 }
        public int GetLastTransactionID()
        {
            HeaderTransaction getHT = db.HeaderTransactions.OrderByDescending(x => x.ID).FirstOrDefault();

            return(getHT.ID);
        }
 public void InsertHTransaction(HeaderTransaction newHT)
 {
     db.HeaderTransactions.Add(newHT);
     db.SaveChanges();
 }