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 Btn_Insert_Click(object sender, EventArgs e) { String type = PaymentTypeTxt.Text; 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.add(type); Response.Redirect("ViewPaymentType.aspx"); } }