/// <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 SelectedIndexChanging event of the grdCustom control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewSelectEventArgs"/> instance containing the event data.</param>
        protected void gridPaymentType_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            int thePage     = gridPaymentType.PageIndex;
            int thePageSize = gridPaymentType.PageSize;

            GridViewRow gridRow = gridPaymentType.Rows[e.NewSelectedIndex];

            gridPaymentType.SelectedIndex = e.NewSelectedIndex;
            errorLabel.Text = "";

            //this.SerialNumber = gridRow.Cells[0].Text.Trim();
            Label  lblStatus = gridRow.FindControl("labelStatus") as Label;
            string stStatus  = lblStatus.Text.Trim().ToUpper();

            rblStatus.SelectedIndex       = stStatus == "ACTIVE" ? 0 : 1;
            this.CurrentPayMethodID       = this.gridPaymentType.SelectedDataKey["ID"].ToString();
            this.buttonSubmit.Text        = "Update";
            this.buttonSubmit.CommandName = "UPDATE";

            this.PopulatePaymentPlugins();
            Label lblHandler = gridRow.FindControl("labelHandler") as Label;

            if (lblHandler != null)
            {
                this.CurrentHandler = lblHandler.Text.Trim();
            }

            this.CurrentPayMethodName = this.gridPaymentType.SelectedDataKey["Name"].ToString();
            textDescription.Text      = PaymentConfigHelper.PayElementDescription(this.CurrentPayMethodName);
            this.prevTypeCode.Value   = this.textPaymentTypeCode.Text = PaymentConfigHelper.PayElementCode(this.CurrentPayMethodName);
            if (CurrentPayMethodName.ToLower().Trim() == "cash" || CurrentPayMethodName.ToLower().Trim() == "deposit")
            {
                disableTypeEditing();                                                                                                       //disable editing for cash and Deposit
            }
            this.paymentTypePopup.Show();
        }