private void SyncGridViewDataEntered()
        {
            // preserve chose cycles details: setup fee, recurring fee and 2CO id
            if (DomainBillingCycles.Count > 0)
            {
                for (int i = 0; i < gvDomainNameCycles.Rows.Count; i++)
                {
                    GridViewRow     gv_row   = gvDomainNameCycles.Rows[i];
                    DomainNameCycle gv_cycle = DomainBillingCycles[i];

                    TextBox txtSetupFee     = ecUtils.FindControl <TextBox>(gv_row, "txtSetupFee");
                    TextBox txtRecurringFee = ecUtils.FindControl <TextBox>(gv_row, "txtRecurringFee");
                    TextBox txtTransferFee  = ecUtils.FindControl <TextBox>(gv_row, "txtTransferFee");

                    gv_cycle.SetupFee     = ecUtils.ParseDecimal(txtSetupFee.Text, 0);
                    gv_cycle.RecurringFee = ecUtils.ParseDecimal(txtRecurringFee.Text, 0);
                    gv_cycle.TransferFee  = ecUtils.ParseDecimal(txtTransferFee.Text, 0);
                }
            }
        }
 private ListItem CreateDomainCycleItem(DomainNameCycle cycleItem, bool transfer)
 {
     if (transfer)
     {
         return(new ListItem(
                    String.Format("{0} - {1} {2:C} + {3} {4:C}",
                                  cycleItem.CycleName, EcommerceSettings.CurrencyCodeISO,
                                  cycleItem.TransferFee, EcommerceSettings.CurrencyCodeISO, cycleItem.SetupFee),
                    cycleItem.CycleId.ToString()
                    ));
     }
     else
     {
         return(new ListItem(
                    String.Format("{0} - {1} {2:C} + {3} {4:C}",
                                  cycleItem.CycleName, EcommerceSettings.CurrencyCodeISO,
                                  cycleItem.RecurringFee, EcommerceSettings.CurrencyCodeISO, cycleItem.SetupFee),
                    cycleItem.CycleId.ToString()
                    ));
     }
 }
        private void FlipDomainNameCycles(int indexFrom, bool moveDown)
        {
            // last item can't move down
            if (moveDown && indexFrom == DomainBillingCycles.Count - 1)
            {
                return;
            }
            // first item can't move up
            if (!moveDown && indexFrom == 0)
            {
                return;
            }
            // single item can't move in both directions
            if (DomainBillingCycles.Count == 1)
            {
                return;
            }

            // sync data prior
            SyncGridViewDataEntered();

            DomainNameCycle cycleToMove = DomainBillingCycles[indexFrom];

            // remove
            DomainBillingCycles.RemoveAt(indexFrom);
            // insert
            if (moveDown)
            {
                DomainBillingCycles.Insert(indexFrom + 1, cycleToMove);
            }
            else
            {
                DomainBillingCycles.Insert(indexFrom - 1, cycleToMove);
            }

            // re-bind data
            BindDomainNameCycles();
        }
        private void AddBillingCycleToDomainName()
        {
            // sync entered data prior
            SyncGridViewDataEntered();

            // load selected billing cycle
            BillingCycle chosenCycle = StorehouseHelper.GetBillingCycle(Convert.ToInt32(ddlBillingCycles.SelectedValue));
            // convert billing to domain name cycle
            DomainNameCycle cycle = new DomainNameCycle();

            // fill fields
            cycle.CycleId       = chosenCycle.CycleId;
            cycle.CycleName     = chosenCycle.CycleName;
            cycle.BillingPeriod = chosenCycle.BillingPeriod;
            cycle.PeriodLength  = chosenCycle.PeriodLength;
            // put into viewstate
            DomainBillingCycles.Add(cycle);

            // bind new domain cycles
            BindDomainNameCycles();

            // re-load billing cycles
            LoadBillingCyclesDDL();
        }