Example #1
0
        private void AddSiteButton_Click(object sender, EventArgs e)
        {
            SiteManagementForm siteManagementForm = new SiteManagementForm();
            siteManagementForm.UseForSelect = true;
            siteManagementForm.AvailableSites = mAvailableSites;
            if (siteManagementForm.ShowDialog() == DialogResult.Cancel)
                return;

            List<Site> selectedSites = siteManagementForm.SelectedSites;
            if (selectedSites.Count == 0)
                return;

            bool existed = false;
            foreach (Site selectedSite in selectedSites)
            {
                existed = false;
                foreach (Site taskSite in TaskSiteList.Items)
                {
                    if (taskSite.SiteID.Equals(selectedSite.SiteID))
                    {
                        existed = true;
                        break;
                    }
                }

                if (!existed)
                {
                    TaskSiteList.Items.Add(selectedSite);
                }
            }
        }
Example #2
0
        private void AddSiteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SiteManagementForm siteManagementForm = new SiteManagementForm();
            siteManagementForm.UseForSelect = true;

            TreeNode sitesNode = WorkspaceTreeView.SelectedNode;
            if (sitesNode.Parent.Tag is SubRegion)
            {
                if (siteManagementForm.ShowDialog() == DialogResult.Cancel)
                    return;

                List<Site> selectedSites = siteManagementForm.SelectedSites;
                if (selectedSites.Count == 0)
                    return;

                SubRegion originRegion = (SubRegion)sitesNode.Parent.Tag;
                UpdateRegionRequest request = new UpdateRegionRequest();
                request.Type = UpdateRegionType.AddSite.ToString();
                request.Region = new SubRegion();
                request.Region.ID = originRegion.ID;
                if (originRegion.Site == null)
                    originRegion.Site = new List<string>();
                foreach (Site selectedSite in selectedSites)
                {
                    if (originRegion.Site.Contains(selectedSite.SiteID))
                        continue;

                    request.Region.Site.Add(selectedSite.SiteID);
                }

                if (request.Region.Site.Count == 0)
                    return;

                HTTPAgent.instance().updateRegion(this, DataCenter.Instance().GlobalRegion.Version, request,
                    "Add region sites", sitesNode);
            }
            else if (sitesNode.Parent.Tag is TaskModel)
            {
                siteManagementForm.AvailableSites = Utility.GetAvailableSites((SubRegion)sitesNode.Parent.Parent.Tag);
                if (siteManagementForm.ShowDialog() == DialogResult.Cancel)
                    return;

                List<Site> selectedSites = siteManagementForm.SelectedSites;
                if (selectedSites.Count == 0)
                    return;

                BindingTask task = ((TaskModel)sitesNode.Parent.Tag).mTask;
                UpdateTaskRequest request = new UpdateTaskRequest();
                request.Type = UpdateTaskType.AddSite.ToString();
                foreach(Site selectedSite in selectedSites)
                {
                    if (task.Site.Contains(selectedSite.SiteID))
                        continue;

                    request.Site.Add(selectedSite.SiteID);
                }

                if (request.Site.Count == 0)
                    return;

                HTTPAgent.instance().updateTask(this, task.ID, request, "Add task sites", sitesNode);
            }
        }
Example #3
0
 private void SiteManagementToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SiteManagementForm siteManagementForm = new SiteManagementForm();
     siteManagementForm.ShowDialog();
 }