Example #1
0
        protected void Load_PaymentType()
        {
            List <PaymentType> paymentTypeList = PaymentTypeController.getAllPaymentType();

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

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

                TableCell paymentTypeIDCell = new TableCell();
                paymentTypeIDCell.Controls.Add(new Label()
                {
                    Text = paymentTypeList.ElementAt(i).ID.ToString()
                });
                newRow.Cells.Add(paymentTypeIDCell);

                TableCell paymentTypeCell = new TableCell();
                paymentTypeCell.Controls.Add(new Label()
                {
                    Text = paymentTypeList.ElementAt(i).Type
                });
                newRow.Cells.Add(paymentTypeCell);
            }
        }
        protected void Load_PaymentType()
        {
            List <PaymentType> paymentTypeList = PaymentTypeController.getAllPaymentType();

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

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

                TableCell paymentTypeIDCell = new TableCell();
                paymentTypeIDCell.Controls.Add(new Label()
                {
                    Text = paymentTypeList.ElementAt(i).ID.ToString()
                });
                newRow.Cells.Add(paymentTypeIDCell);

                TableCell paymentTypeCell = new TableCell();
                paymentTypeCell.Controls.Add(new Label()
                {
                    Text = paymentTypeList.ElementAt(i).Type
                });
                newRow.Cells.Add(paymentTypeCell);

                int roleId = getUserRole();
                if (roleId == 2)
                {
                    InsertPaymentType.Visible = false;
                    TableCell SelectButtonCell = new TableCell();
                    Button    SelectButton     = new Button()
                    {
                        ID       = (i + 1) + "_S",
                        Text     = "Select",
                        CssClass = "btn btn-primary"
                    };
                    SelectButton.Click += SelectButton_Click;
                    SelectButtonCell.Controls.Add(SelectButton);
                    newRow.Cells.Add(SelectButtonCell);
                }
                else
                {
                    TableCell UpdateButtonCell = new TableCell();
                    Button    UpdateButton     = new Button()
                    {
                        ID       = (i + 1) + "_U",
                        Text     = "Update",
                        CssClass = "btn btn-warning"
                    };
                    UpdateButton.Click += UpdateButton_Click;
                    UpdateButtonCell.Controls.Add(UpdateButton);
                    newRow.Cells.Add(UpdateButtonCell);

                    TableCell deleteButtonCell = new TableCell();
                    Button    deleteButton     = new Button()
                    {
                        ID       = (i + 1) + "_D",
                        Text     = "Delete",
                        CssClass = "btn btn-danger"
                    };
                    deleteButton.Click += deleteButton_Click;
                    deleteButtonCell.Controls.Add(deleteButton);
                    newRow.Cells.Add(deleteButtonCell);
                }
            }
        }