/// <summary> /// Handles the Click event of the buttonSubmit control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void buttonSubmit_Click(object sender, EventArgs e) { if (buttonSubmit.CommandName == "NEW") { try { bool valid = ValidateTextBox(textDiscountName); if (!valid) { this.NotifyAction("Name of the discount plan is required", "Validation", true); this.discountPopup.Show(); return; } string strdiscountName = textDiscountName.Text; valid = ValidateTextBox(textDiscountName); if (!valid) { this.NotifyAction("Discount Rate is required", "Validation", true); this.discountPopup.Show(); return; } decimal _rate = decimal.Parse(textRate.Text.Trim()) / 100.0M; /* valid = ValidateDropDownList(ddlPaymentMode); * if (!valid) * { * * this.NotifyAction("Please select the payment method for this discount", "Validation", true); * this.discountPopup.Show(); * return; * } * * string _paymentName = ddlPaymentMode.SelectedItem.Text; * int _paymentID = int.Parse(ddlPaymentMode.SelectedValue); */ valid = ValidateTextBox(textStartDate); if (!valid) { this.NotifyAction("Discount StartDate is required", "Validation", true); this.discountPopup.Show(); return; } DateTime strStartDate = DateTime.Parse(textStartDate.Text.Trim());; DateTime?strEndDate = null; if (textEndDate.Text != "") { valid = ValidateTextBox(textEndDate); if (!valid) { this.NotifyAction("Discount EndDate is required", "Validation", true); this.discountPopup.Show(); return; } strEndDate = DateTime.Parse(textEndDate.Text.Trim()); } if (rblStatus.SelectedIndex == -1) { this.NotifyAction("Discount Plan Status is required", "Validation", true); this.discountPopup.Show(); return; } bool Active = rblStatus.SelectedValue == "1"; IBilling bMGr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing"); DiscountPlan thePlan = new DiscountPlan() { Name = strdiscountName, Active = Active, EndDate = strEndDate, StartDate = strStartDate, Rate = _rate //DiscountedPayMethod = null}new PaymentMethod() { ID = _paymentID, Name = _paymentName } // DiscountedPayMethod = null }; bMGr.AddDiscountPlan(thePlan, this.UserId); this.NotifyAction("New discount plan addedd successfully", string.Format("{0} {1} ", "Adding discount plan", strdiscountName), false); } catch (Exception ew) { this.NotifyAction(ew.Message, "Error", true); } } else if (buttonSubmit.CommandName == "UPDATE") { } }