void SetClientInfo(HubClient hubClient) { if (InvokeRequired) { Invoke(new Action <HubClient>(SetClientInfo), hubClient); } else { var seq = from HubClientEnvironment hce in m_ndxerClientEnv.Source.Enumerate() where hce.ClientID == hubClient.ID orderby hce.CreationTime descending select hce; HubClientEnvironment clEnv = seq.First(); var clStatus = m_ndxerStatus.Get(hubClient.ID) as ClientStatus; m_lblContact.Text = hubClient.ContactName; m_lblCreationTime.Text = GetComprehensiveTime(hubClient.CreationTime); m_lblEMail.Text = hubClient.ContaclEMail; m_lblHubArchitecture.Text = AppArchitectures.GetArchitectureName(clEnv.HubArchitecture); m_lblHubVersion.Text = clEnv.HubVersion; m_lblLastActivity.Text = GetComprehensiveTime(clStatus.LastSeen); m_lblMachineName.Text = clEnv.MachineName; m_lblOSArchitecture.Text = clEnv.Is64BitOperatingSystem ? "64 Bits" : "32 Bits"; m_lblOSVersion.Text = clEnv.OSVersion; m_lblPhone.Text = hubClient.ContactPhone; m_lblStatus.Text = ClientStatuses.GetStatusName(clStatus.Status); m_lblUserName.Text = clEnv.UserName; } }
public ManagementMode_t GetProfileManagementMode(uint idProfile) { var mgmntMode = m_ndxerProfilesMgmnt.Get(idProfile) as ProfileManagementMode; Dbg.Assert(mgmntMode != null); return(mgmntMode.ManagementMode); }
public ClientStatus_t GetClientStatus(uint idClient) { var clStatus = m_ndxerClientsStatus.Get(idClient) as ClientStatus; Dbg.Assert(clStatus != null); return(clStatus.Status); }
void LoadRunningClientsAsync() { Dbg.Assert(!InvokeRequired); Func <TreeNode[]> load = () => { var roots = new List <TreeNode>(); foreach (HubClient hc in AppContext.ClientsManager.RunningClients) { var profile = m_ndxerProfiles.Get(hc.ProfileID) as UserProfile; var root = new TreeNode(profile.Name) { Tag = profile, SelectedImageIndex = NDXIMG_PROFILE, ImageIndex = NDXIMG_PROFILE }; root.Nodes.Add(CreateClientNode(hc)); roots.Add(root); } return(roots.ToArray()); }; var waitClue = new Waits.WaitClue(this); Action <Task> onErr = t => { MessageBox.Show(t.Exception.InnerException.Message, Text); AppContext.LogManager.LogSysError("Chargement de la liste des clients actifs: " + t.Exception.InnerException.Message, true); waitClue.LeaveWaitMode(); }; Action <Task <TreeNode[]> > onSucces = t => { m_tvClients.Nodes.Clear(); m_tvClients.Nodes.AddRange(t.Result); m_tvClients.ExpandAll(); waitClue.LeaveWaitMode(); }; var task = new Task <TreeNode[]>(load, TaskCreationOptions.LongRunning); task.OnSuccess(onSucces); task.OnError(onErr); waitClue.EnterWaitMode(); task.Start(); }
public IEnumerable <HubClient> GetProfileClients(uint idProfile) { return((from id in m_ndxerClients.Keys let cl = m_ndxerClients.Get(id) as HubClient where cl.ProfileID == idProfile select cl).ToArray()); }
bool CheckConstraint17() { //∀m ∈ ProductMapping ∃c ∈ ValueContext : c.ID = m.ContextID var logger = new TextLogger(LogSeverity.Warning); logger.PutLine("*** Control d’intégrité ***"); logger.PutLine($"Table: {AppContext.TableManager.TRProductsMapping.Name}"); bool err = false; if (m_ndxerMapProdNber.Source.Count > 0) { foreach (ProductMapping pm in m_ndxerMapProdNber.Source.Enumerate()) { if (m_ndxerContext.Get(pm.ContextID) == null) { logger.PutLine("La contrainte d’intégrité n° 17 est violée par l'élément suivant :"); logger.PutLine(pm); logger.PutLine(); err = true; } } } if (err) { logger.Flush(); } return(!err); }
private void UploadDataUpdates_Click(object sender, EventArgs e) { var dlg = new Jobs.ProcessingDialog(); Action upload = () => { KeyIndexer ndxerInc = AppContext.AccessPath.GetKeyIndexer(InternalTablesID.INCREMENT); IEnumerable <uint> ids = from UpdateIncrement inc in ndxerInc.Source.Enumerate() where inc.IsDeployed == false select inc.ID; var netEngin = new NetEngin(AppContext.Settings.NetworkSettings); foreach (var id in ids) { string fileName = id.ToString("X"); string src = Path.Combine(AppPaths.DataUpdateFolder, fileName); string dst = Urls.DataUpdateDirURL + fileName; netEngin.Upload(dst, src); } netEngin.Upload(Urls.DataManifestURL, AppPaths.DataManifestPath); netEngin.Upload(Urls.ManifestURL, AppPaths.ManifestPath); foreach (uint id in ids) { var inc = ndxerInc.Get(id) as UpdateIncrement; inc.DeployTime = DateTime.Now; ndxerInc.Source.Replace(ndxerInc.IndexOf(id), inc); } }; Action <Task> onErr = t => { dlg.Dispose(); this.ShowError(t.Exception.InnerException.Message); }; Action onSuccess = () => { dlg.Dispose(); m_tsbUploadDataUpdates.Enabled = false; }; var task = new Task(upload, TaskCreationOptions.LongRunning); task.OnSuccess(onSuccess); task.OnError(onErr); task.Start(); dlg.ShowDialog(Parent); }
private void ManagementMode_DatumReplaced(IDataRow row) { if (InvokeRequired) { Invoke(new Action <IDataRow>(ManagementMode_DatumReplaced), row); } else { var lvi = (from item in m_lvData.Items.AsEnumerable <ListViewItem>() where (item.Tag as UserProfile).ID == row.ID select item).Single(); ManagementMode_t mode = (m_ndxerMgmntMode.Get(row.ID) as ProfileManagementMode).ManagementMode; if (lvi.Selected) { m_tsbAutoManagement.Checked = mode == ManagementMode_t.Auto; } lvi.SubItems[m_colMgmntMode.Index].Text = ProfileManagementMode.GetManagementModeName(mode); } }
bool CheckConstraint19() { // ∀v ∈ TRSpotValueTable ∃m ∈ TRProductMappingTable: v.ProductMappingID = m.ID; var logger = new TextLogger(LogSeverity.Warning); logger.PutLine("*** Control d’intégrité ***"); logger.PutLine($"Table: {AppContext.TableManager.TRSpotValues.Name}"); bool err = false; using (var ndxer = new AttrIndexer <uint>(m_srcSpotValues, d => (d as SpotValue).ProductMappingID)) { ndxer.Connect(); foreach (uint idMapping in ndxer.Attributes) { if (m_ProductMappings.Get(idMapping) == null) { logger.PutLine("La contrainte d’intégrité n° 19 est violée par l'élément suivant :"); logger.PutLine(ndxer.Get(idMapping)); logger.PutLine(); err = true; } } } if (err) { logger.Flush(); } return(!err); }
uint GetTableGeneration(IDataTable table) { return((m_ndxerTableGen.Get(table.ID) as IFileGenerationRow)?.Generation ?? 0); }
private void ClientsManager_ClientStarted(uint clID) { if (InvokeRequired) { Invoke(new Action <uint>(ClientsManager_ClientStarted), clID); } else { TreeNode clNode = LocateClientNode(clID); if (clNode != null) { clNode.ForeColor = Color.SteelBlue; } else { var client = m_ndxerClients.Get(clID) as HubClient; if (client != null) { TreeNode root = null; foreach (TreeNode node in m_tvClients.Nodes) { if ((node.Tag as UserProfile).ID == client.ProfileID) { root = node; break; } } if (root == null) { var profile = m_ndxerProfiles.Get(client.ProfileID) as UserProfile; root = new TreeNode(profile.Name) { Tag = profile, SelectedImageIndex = NDXIMG_PROFILE, ImageIndex = NDXIMG_PROFILE }; m_tvClients.Nodes.Add(root); } root.Nodes.Add(CreateClientNode(client)); root.Expand(); } TreeNode selNode = m_tvClients.SelectedNode; if (selNode != null && selNode.Parent != null) { var hc = selNode.Tag as HubClient; if (hc.ID == clID) { UpdateStatusButtons(ClientStatus_t.Enabled); LoadClientLog(client.ID); SetClientInfo(hc); } } } } }