/// <summary> /// Populates the type of the payment. /// </summary> void PopulatePaymentType() { IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); List <PaymentMethod> paymentMethods = BillingManager.GetPaymentMethods(""); PaymentConfigHelper.RefreshSection(); if (paymentMethods != null) { int i = 0; for (i = 0; i < paymentMethods.Count(); i++)//PaymentMethod e in paymentMethods) { PaymentMethod e = paymentMethods[i]; string name = e.Name; if (PaymentConfigHelper.PaymethodExists(name)) { try { string _thishandler = PaymentConfigHelper.GetHandlerNameByPayMethod(name); e.MethodDescription = PaymentConfigHelper.PayElementDescription(name); if (!string.IsNullOrEmpty(_thishandler)) { e.Handler = _thishandler; e.HandlerDescription = PaymentConfigHelper.HandlerDescription(_thishandler); e.ControlName = PaymentConfigHelper.HandlerControlName(_thishandler); } } catch { } } } gridPaymentType.DataSource = paymentMethods; gridPaymentType.DataBind(); } }
/// <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) { string paymentName = textPaymentTypeName.Text; string handlerName = ddlHandler.SelectedItem.Value; if (textPaymentTypeName.Text == "") { this.NotifyAction("Name of the payment method is required", "Validation", true); this.paymentTypePopup.Show(); return; } if (ddlHandler.SelectedIndex < 1) { this.NotifyAction("Please select the plugin for this type of payment", "Validation", true); this.paymentTypePopup.Show(); return; } /* if (txtSeqNo.Text == "") * { * this.NotifyAction("Priority is required", "Validation", true); * this.paymentTypePopup.Show(); * return; * }*/ try { bool modify = false; if (PaymentConfigHelper.PaymethodExists(paymentName)) { modify = true; } if (this.CurrentHandler == "" || !modify) { PaymentConfigHelper.AddPayElement(handlerName, textPaymentTypeName.Text, textPaymentTypeName.Text.Trim().ToUpper(), textDescription.Text); PaymentConfigHelper.RefreshSection(); } else { PaymentConfigHelper.ModifyPayElement(this.CurrentHandler, this.CurrentPayMethodName, handlerName, textPaymentTypeName.Text, textPaymentTypeCode.Text, textDescription.Text); PaymentConfigHelper.RefreshSection(); } //this.PersistValues(buttonSubmit.CommandName); IBilling BillingManager = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.SCM.BBilling, BusinessProcess.SCM"); PaymentMethod thisMethod = new PaymentMethod() { Name = paymentName, Locked = false, Active = rblStatus.SelectedValue == "1" }; if (buttonSubmit.CommandName == "UPDATE") { thisMethod.ID = Convert.ToInt32(this.CurrentPayMethodID); } BillingManager.SavePaymentMethod(thisMethod, this.UserID); if (buttonSubmit.CommandName == "NEW") { this.NotifyAction("New payment method addedd successfully", string.Format("{0} {1} ", "Adding Payment method", paymentName), false); } else { this.NotifyAction("Payment method updated successfully", string.Format("{0} {1} ", "Updating Payment method", paymentName), false); } this.PopulatePaymentType(); return; } catch (Exception ex) { this.NotifyAction(ex.Message.ToString(), "Error Occured", true); return; } }