Example #1
0
        protected void doInsertPaymentType(object sender, EventArgs e)
        {
            String type = paymentTypeNameId.Text;

            PaymentType pt = PaymentTypeRepository.db.PaymentTypes.Where(payType => payType.Type.Equals(type)).FirstOrDefault();
            String      paymentTypeIsExist;

            try
            {
                paymentTypeIsExist = pt.Type;
            }
            catch
            {
                paymentTypeIsExist = "";
            }


            if (type.Length == 0)
            {
                errorMsgId.Text = "Please fill the payment type name";
            }
            else if (type.Length < 3)
            {
                errorMsgId.Text = "Payment type name must be 3 character or more";
            }
            else if (type.Equals(paymentTypeIsExist))
            {
                errorMsgId.Text = "Payment type name is already exist, please input different type of payment";
            }
            else
            {
                PaymentTypeController.insertPaymentType(type);
                Response.Redirect("ViewPaymentType.aspx");
            }
        }
Example #2
0
        protected void insertPaymentType(object sender, EventArgs e)
        {
            string paymentTypeName = PaymentTypeNameBox.Text;

            string error = PaymentTypeController.insertPaymentType(paymentTypeName);

            if (error == "")
            {
                Response.Redirect("ViewPaymentType.aspx");
            }
            else
            {
                ErrorMessage.Text = error;
            }
        }