예제 #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");
            }
        }
예제 #2
0
        protected void Updatebtn_Click(object sender, EventArgs e)
        {
            int    id           = Int32.Parse(Request.QueryString["id"]);
            string messageError = "";

            messageError = PaymentTypeController.update(updateTxt.Text);

            if (messageError != "")
            {
                lblerror.Text = messageError;
            }
            else
            {
                PaymentTypeHandler.update(id, updateTxt.Text);
                lblerror.Text = "Update Success";
            }
        }