예제 #1
0
        private void ToggleQuotaControls()
        {
            foreach (RepeaterItem item in dlGroups.Items)
            {
                CheckBox chkEnabled = (CheckBox)item.FindControl("chkEnabled");

                CheckBox chkCountDiskspace = (CheckBox)item.FindControl("chkCountDiskspace");
                CheckBox chkCountBandwidth = (CheckBox)item.FindControl("chkCountBandwidth");
                chkCountDiskspace.Enabled = chkEnabled.Checked && IsPlan;
                chkCountBandwidth.Enabled = chkEnabled.Checked && IsPlan;

                // iterate quotas
                Control quotaPanel = item.FindControl("QuotaPanel");
                quotaPanel.Visible = chkEnabled.Checked;

                DataList dlQuotas = (DataList)item.FindControl("dlQuotas");
                foreach (DataListItem quotaItem in dlQuotas.Items)
                {
                    if (!chkEnabled.Checked)
                    {
                        QuotaEditor quotaEditor = (QuotaEditor)quotaItem.FindControl("quotaEditor");
                        quotaEditor.QuotaValue = 0;
                    }
                }

                // hide group if quotas == 0
                Control groupPanel = item.FindControl("GroupPanel");
                groupPanel.Visible = (IsPlan || dlQuotas.Items.Count > 0);
            }
        }
예제 #2
0
        public void CollectFormData()
        {
            groups = new List <HostingPlanGroupInfo>();
            quotas = new List <HostingPlanQuotaInfo>();

            // gather info
            foreach (RepeaterItem item in dlGroups.Items)
            {
                Literal  litGroupId        = (Literal)item.FindControl("groupId");
                CheckBox chkEnabled        = (CheckBox)item.FindControl("chkEnabled");
                CheckBox chkCountDiskspace = (CheckBox)item.FindControl("chkCountDiskspace");
                CheckBox chkCountBandwidth = (CheckBox)item.FindControl("chkCountBandwidth");

                if (!chkEnabled.Checked)
                {
                    continue; // disabled group
                }
                HostingPlanGroupInfo group = new HostingPlanGroupInfo();
                group.GroupId            = Utils.ParseInt(litGroupId.Text, 0);
                group.Enabled            = chkEnabled.Checked;
                group.CalculateDiskSpace = chkCountDiskspace.Checked;
                group.CalculateBandwidth = chkCountBandwidth.Checked;
                groups.Add(group);

                // iterate quotas
                DataList dlQuotas = (DataList)item.FindControl("dlQuotas");
                foreach (DataListItem quotaItem in dlQuotas.Items)
                {
                    QuotaEditor quotaEditor = (QuotaEditor)quotaItem.FindControl("quotaEditor");

                    HostingPlanQuotaInfo quota = new HostingPlanQuotaInfo();
                    quota.QuotaId    = quotaEditor.QuotaId;
                    quota.QuotaValue = quotaEditor.QuotaValue;
                    quotas.Add(quota);
                }
            }
        }