Exemplo n.º 1
0
        protected void Btn_Update_Click(object sender, EventArgs e)
        {
            String paymentTypeName = PaymentTypeController.getPaymentTypeByID(Convert.ToInt32(Request.QueryString["paymentTypeID"])).Type;
            int    paymentTypeID   = Convert.ToInt32(Request.QueryString["paymentTypeID"]);
            String type            = PaymentTypeTxt.Text;

            if (paymentTypeName != type)
            {
                int isValid = PaymentTypeController.PaymentTypeValidation(type);
                if (isValid == -1)
                {
                    TypeLabel.Text = "Type must be filled, unique and consist of 3 chars or more";
                }
                else if (isValid == -2)
                {
                    TypeLabel.Text = "Type must consist of 3 chars or more and unique";
                }
                else if (isValid == -3)
                {
                    TypeLabel.Text = "Type must be unique";
                }
                else
                {
                    PaymentTypeController.update(paymentTypeID, type);
                    Response.Redirect("ViewPaymentType.aspx");
                }
            }
            else
            {
                Response.Redirect("ViewPaymentType.aspx");
            }
        }
        protected void linkSelect_Click(object sender, EventArgs e)
        {
            int paymentTypeID = Int32.Parse((sender as LinkButton).CommandArgument);

            currPaymentType = PaymentTypeController.getPaymentTypeByID(paymentTypeID);

            PaymentTypeNameBox.Text = currPaymentType.PaymentTypeName;

            UpdatePaymentTypeButton.Enabled = true;
            DeletePaymentTypeButton.Enabled = true;
        }
 private void attachProperties(int paymentTypeID)
 {
     if (!IsPostBack)
     {
         currentPaymentType = PaymentTypeController.getPaymentTypeByID(paymentTypeID);
         if (currentPaymentType == null)
         {
             Response.Redirect("ViewPaymentType.aspx");
             return;
         }
         PaymentTypeNameBox.Text = currentPaymentType.PaymentTypeName;
     }
 }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["auth_user"] != null)
     {
         if (UserController.getUserByID(Convert.ToInt32(Session["auth_user"])).RoleID != 3)
         {
             Response.Redirect("Home.aspx");
         }
     }
     else
     {
         Response.Redirect("Home.aspx");
     }
     if (!IsPostBack)
     {
         PaymentTypeTxt.Text = PaymentTypeController.getPaymentTypeByID(Convert.ToInt32(Request.QueryString["paymentTypeID"])).Type;
     }
 }