Esempio n. 1
0
        private void GetSiteLocation()
        {
            RadComboBoxSiteLocation.Items.Clear();
            List <SiteLocation> siteLocationList = new List <SiteLocation>();

            if (RadGridAgency.SelectedValue != null)
            {
                var cAgencySiteLocation = new CAgencySiteLocation();
                var agencySiteLocation  = cAgencySiteLocation.GetAgencySiteLocationList(Convert.ToInt32(RadGridAgency.SelectedValue));
                if (agencySiteLocation.Count > 0)
                {
                    var siteLocation = new CSiteLocation().Get(agencySiteLocation[0].SiteLocationId);
                    siteLocationList = new CSiteLocation().GetSiteLocationBySiteId(siteLocation.SiteId);

                    RadTextBoxSite.Text = (new CSite()).Get(siteLocation.SiteId).Abbreviation;
                }

                foreach (var siteLocation in siteLocationList)
                {
                    RadComboBoxSiteLocation.Items.Add(new RadComboBoxItem(siteLocation.Name, siteLocation.SiteLocationId.ToString()));
                }

                foreach (var agencySiteLo in agencySiteLocation)
                {
                    foreach (RadComboBoxItem siteLocation in RadComboBoxSiteLocation.Items)
                    {
                        if (agencySiteLo.SiteLocationId == Convert.ToInt32(siteLocation.Value))
                        {
                            siteLocation.Checked = true;
                        }
                    }
                }
            }
            else
            {
                var cSiteLocation = new CSiteLocation();
                siteLocationList = cSiteLocation.GetSiteLocationBySiteId(CurrentSiteId);
                foreach (var siteLocation in siteLocationList)
                {
                    RadComboBoxSiteLocation.Items.Add(new RadComboBoxItem(siteLocation.Name, siteLocation.SiteLocationId.ToString()));
                }

                RadTextBoxSite.Text = (new CSite()).Get(CurrentSiteId).Abbreviation;
            }

            RadComboBoxSiteLocation_OnSelectedIndexChanged(null, null);
        }
Esempio n. 2
0
        private void GetSiteLocation(bool isModify)
        {
            RadComboBoxSiteLocation.Items.Clear();
            List <SiteLocation> siteLocationList = new List <SiteLocation>();

            if (isModify)
            {
                var cPackageProgramSiteLocation = new CPackageProgramSiteLocation();
                var packageProgramSiteLocation  = cPackageProgramSiteLocation.GetPackageProgramSiteLocationList(Convert.ToInt32(hfId.Value));
                if (packageProgramSiteLocation.Count > 0)
                {
                    var siteLocation = new CSiteLocation().Get(packageProgramSiteLocation[0].SiteLocationId);
                    siteLocationList = new CSiteLocation().GetSiteLocationBySiteId(siteLocation.SiteId);

                    RadTextBoxSite.Text = (new CSite()).Get(siteLocation.SiteId).Abbreviation;
                }

                foreach (var siteLocation in siteLocationList)
                {
                    RadComboBoxSiteLocation.Items.Add(new RadComboBoxItem(siteLocation.Name, siteLocation.SiteLocationId.ToString()));
                }

                foreach (var packageProgramSiteLo in packageProgramSiteLocation)
                {
                    foreach (RadComboBoxItem siteLocation in RadComboBoxSiteLocation.Items)
                    {
                        if (packageProgramSiteLo.SiteLocationId == Convert.ToInt32(siteLocation.Value))
                        {
                            siteLocation.Checked = true;
                        }
                    }
                }
            }
            else
            {
                var cSiteLocation = new CSiteLocation();
                siteLocationList = cSiteLocation.GetSiteLocationBySiteId(CurrentSiteId);
                foreach (var siteLocation in siteLocationList)
                {
                    RadComboBoxSiteLocation.Items.Add(new RadComboBoxItem(siteLocation.Name, siteLocation.SiteLocationId.ToString()));
                }

                RadTextBoxSite.Text = (new CSite()).Get(CurrentSiteId).Abbreviation;
            }

            RadComboBoxSiteLocation_OnSelectedIndexChanged(null, null);
        }