protected void Load_PaymentType()
        {
            int         paymentId = Convert.ToInt32(Request.QueryString["ID"]);
            PaymentType pay       = PaymentTypeController.getPaymentTypeById(paymentId);

            TableRow newRow = new TableRow();

            PaymentTypeTable.Controls.Add(newRow);

            TableCell paymentTypeIDCell = new TableCell();

            paymentTypeIDCell.Controls.Add(new Label()
            {
                Text = pay.ID.ToString()
            });
            newRow.Cells.Add(paymentTypeIDCell);

            TableCell paymentTypeCell = new TableCell();

            paymentTypeCell.Controls.Add(new Label()
            {
                Text = pay.Type
            });
            newRow.Cells.Add(paymentTypeCell);
        }
示例#2
0
        protected string getPaymentType()
        {
            string paymentId = HttpContext.Current.Session["user_pay"].ToString();

            PaymentType pays = PaymentTypeController.getPaymentTypeById(Convert.ToInt32(paymentId));

            return(pays.Type);
        }
        protected string getPaymentTypeName(int paymentTypeId)
        {
            PaymentType pays = PaymentTypeController.getPaymentTypeById(paymentTypeId);

            return(pays.Type);
        }
        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");
        }