protected object GetProcessesStatusDataSource() { if (Request["GroupID"] != null && Request["GroupID"] != "") { try { int I = 0; MultiXTpmDB.GroupStatusProcessesRow[] GSPRows = m_DS.GroupStatus.FindByGroupID(Convert.ToInt32(Request["GroupID"])).GetGroupStatusProcessesRows(); MultiXTpmDB.ProcessStatusRow[] Rows = new MultiXTpmDB.ProcessStatusRow[GSPRows.Length]; foreach (MultiXTpmDB.GroupStatusProcessesRow GSPRow in GSPRows) { Rows[I++] = GSPRow.ProcessStatusRow; } return(Rows); } catch { } } return(m_DS.ProcessStatus); }
private int[] BuildSelectedProcessesArray() { int SelectedCount = 0; foreach (DataGridItem Item in ProcessesGrid.Items) { ListItemType ItemType = Item.ItemType; if (ItemType == ListItemType.AlternatingItem || ItemType == ListItemType.Item || ItemType == ListItemType.EditItem || ItemType == ListItemType.SelectedItem) { MultiXTpmDB.ProcessStatusRow Row = m_DS.ProcessStatus.FindByID((int)ProcessesGrid.DataKeys[Item.ItemIndex]); if (Row != null) { SecuredCheckBox CB = (SecuredCheckBox)Item.FindControl("SelectionCheckBox"); if (CB.Checked) { SelectedCount++; } } } } int[] SelectedItems = new int[SelectedCount]; SelectedCount = 0; foreach (DataGridItem Item in ProcessesGrid.Items) { ListItemType ItemType = Item.ItemType; if (ItemType == ListItemType.AlternatingItem || ItemType == ListItemType.Item || ItemType == ListItemType.EditItem || ItemType == ListItemType.SelectedItem) { MultiXTpmDB.ProcessStatusRow Row = m_DS.ProcessStatus.FindByID((int)ProcessesGrid.DataKeys[Item.ItemIndex]); if (Row != null) { SecuredCheckBox CB = (SecuredCheckBox)Item.FindControl("SelectionCheckBox"); if (CB.Checked) { SelectedItems[SelectedCount++] = Row.ID;; } } } } return(SelectedItems); }
protected MultiXTpmDB RebuildDS(MultiXTpmDB DS, MultiXTpm.ConfigData Config, MultiXTpm.SystemStatus Status) { if (DS == null) { DS = new MultiXTpmDB(); } if (Config != null) { LastConfigUpdate = Config.LastUpdate; DS.Group.Clear(); DS.GroupForwardFlags.Clear(); DS.GroupProcessClasses.Clear(); DS.Link.Clear(); DS.LinkParams.Clear(); DS.Message.Clear(); DS.Param.Clear(); DS.ProcessClass.Clear(); DS.ProcessClassLinks.Clear(); DS.ProcessClassParams.Clear(); if (Config.Groups != null) { foreach (MultiXTpm.Group Group in Config.Groups) { MultiXTpmDB.GroupRow Row = DS.Group.NewGroupRow(); if (Group.Description != null) { Row.Description = Group.Description; } Row.ID = Group.ID; DS.Group.AddGroupRow(Row); if (Group.ProcessClassIDs != null) { foreach (int ProcessClassID in Group.ProcessClassIDs) { MultiXTpmDB.GroupProcessClassesRow GPRow = DS.GroupProcessClasses.NewGroupProcessClassesRow(); GPRow.GroupID = Group.ID; GPRow.ProcessClassID = ProcessClassID; DS.GroupProcessClasses.AddGroupProcessClassesRow(GPRow); } } } } if (Config.ProcessClasses != null) { foreach (MultiXTpm.ProcessClass ProcessClass in Config.ProcessClasses) { MultiXTpmDB.ProcessClassRow Row = DS.ProcessClass.NewProcessClassRow(); Row.AdditionalConfigTextFile = ProcessClass.AdditionalConfigTextFile; Row.AutoStart = ProcessClass.AutoStart; Row.DebugLevel = ProcessClass.DebugLevel; Row.DefaultSendTimeout = ProcessClass.DefaultSendTimeout; Row.Description = ProcessClass.Description; Row.ExecCmd = ProcessClass.ExecCmd; Row.ExecParams = ProcessClass.ExecParams; Row.ExpectedPassword = ProcessClass.ExpectedPassword; Row.ID = ProcessClass.ID; Row.InactivityTimer = ProcessClass.InactivityTimer; Row.MaxInstances = ProcessClass.MaxInstances; Row.MaxQueueSize = ProcessClass.MaxQueueSize; Row.MaxRecoveryQueueSize = ProcessClass.MaxRecoveryQueueSize; Row.MaxSessions = ProcessClass.MaxSessions; Row.MinInstances = ProcessClass.MinInstances; Row.PasswordToSend = ProcessClass.PasswordToSend; Row.ClassName = ProcessClass.ClassName; Row.StartProcessDelay = ProcessClass.StartProcessDelay; DS.ProcessClass.AddProcessClassRow(Row); if (ProcessClass.Params != null) { foreach (MultiXTpm.Param Param in ProcessClass.Params) { MultiXTpmDB.ParamRow PRow = DS.Param.NewParamRow(); PRow.ParamName = Param.ParamName; PRow.ParamValue = Param.ParamValue; DS.Param.AddParamRow(PRow); MultiXTpmDB.ProcessClassParamsRow PPRow = DS.ProcessClassParams.NewProcessClassParamsRow(); PPRow.ParamID = PRow.ID; PPRow.ProcessClassID = ProcessClass.ID; DS.ProcessClassParams.AddProcessClassParamsRow(PPRow); } } if (ProcessClass.LinkIDs != null) { foreach (int LinkID in ProcessClass.LinkIDs) { MultiXTpmDB.ProcessClassLinksRow LRow = DS.ProcessClassLinks.NewProcessClassLinksRow(); LRow.LinkID = LinkID; LRow.ProcessClassID = ProcessClass.ID; DS.ProcessClassLinks.AddProcessClassLinksRow(LRow); } } } } if (Config.Links != null) { foreach (MultiXTpm.Link Link in Config.Links) { MultiXTpmDB.LinkRow Row = DS.Link.NewLinkRow(); Row.Description = Link.Description; Row.ID = Link.ID; Row.LinkType = (int)Link.LinkType; Row.LocalAddress = Link.LocalAddress; Row.LocalPort = Link.LocalPort; Row.OpenMode = (int)Link.OpenMode; Row.Raw = Link.Raw; Row.RemoteAddress = Link.RemoteAddress; Row.RemotePort = Link.RemotePort; if (Link.SSLParams != null) { Row.SSLAPI = Link.SSLParams.API.ToString(); Row.SSLCertificateFile = Link.SSLParams.CertificateFile; Row.SSLClientAuthenticationRequired = Link.SSLParams.ClientAuthenticationRequired; Row.SSLDHFile = Link.SSLParams.DHFile; Row.SSLPrivateKeyFile = Link.SSLParams.PrivateKeyFile; Row.SSLPrivateKeyPassword = Link.SSLParams.PrivateKeyPassword; Row.SSLPrivateKeyPasswordFile = Link.SSLParams.PrivateKeyPasswordFile; Row.SSLRSAPrivateKeyFile = Link.SSLParams.RSAPrivateKeyFile; Row.SSLServerAuthenticationRequired = Link.SSLParams.ServerAuthenticationRequired; Row.SSLServerNameVerificationRequired = Link.SSLParams.ServerNameVerificationRequired; Row.SSLTrustStoreDirectory = Link.SSLParams.TrustStoreDirectory; Row.SSLTrustStoreFile = Link.SSLParams.TrustStoreFile; } DS.Link.AddLinkRow(Row); if (Link.Params != null) { foreach (MultiXTpm.Param Param in Link.Params) { MultiXTpmDB.ParamRow PRow = DS.Param.NewParamRow(); PRow.ParamName = Param.ParamName; PRow.ParamValue = Param.ParamValue; DS.Param.AddParamRow(PRow); MultiXTpmDB.LinkParamsRow LPRow = DS.LinkParams.NewLinkParamsRow(); LPRow.ParamID = PRow.ID; LPRow.LinkID = Link.ID; DS.LinkParams.AddLinkParamsRow(LPRow); } } } } if (Config.Messages != null) { foreach (MultiXTpm.Message Msg in Config.Messages) { MultiXTpmDB.MessageRow MRow = DS.Message.NewMessageRow(); MRow.DbProtected = Msg.DbProtected; MRow.Description = Msg.Description; MRow.ID = Msg.ID; MRow.Priority = Msg.Priority; MRow.Stateful = Msg.Stateful; MRow.Timeout = Msg.Timeout; MRow.WSDllFile = Msg.WSDllFile; MRow.WSDllFunction = Msg.WSDllFunction; MRow.WSURL = Msg.WSURL; MRow.WSSoapAction = Msg.WSSoapAction; DS.Message.AddMessageRow(MRow); if (Msg.ForwardFlags != null) { foreach (MultiXTpm.GroupForwardFlags Flags in Msg.ForwardFlags) { MultiXTpmDB.GroupForwardFlagsRow GFRow = DS.GroupForwardFlags.NewGroupForwardFlagsRow(); GFRow.GroupID = Flags.GroupID; GFRow.IgnoreResponse = Flags.IgnoreResponse; GFRow.ForwardToAll = Flags.ForwardToAll; GFRow.MessageID = Msg.ID; GFRow.ResponseRequired = Flags.ResponseRequired; DS.GroupForwardFlags.AddGroupForwardFlagsRow(GFRow); } } } } if (Config.UsersPermissions != null) { foreach (MultiXTpm.UserPermission Perm in Config.UsersPermissions) { MultiXTpmDB.UserPermissionsRow Row = DS.UserPermissions.NewUserPermissionsRow(); Row.UserName = Perm.UserName; Row.GetWSDL = Perm.GetWSDL; Row.GetConfig = Perm.GetConfig; Row.UpdateConfig = Perm.UpdateConfig; Row.GetSystemStatus = Perm.GetSystemStatus; Row.RestartProcess = Perm.RestartProcess; Row.RestartGroup = Perm.RestartGroup; Row.StartProcess = Perm.StartProcess; Row.StartGroup = Perm.StartGroup; Row.ShutdownProcess = Perm.ShutdownProcess; Row.ShutdownGroup = Perm.ShutdownGroup; Row.SuspendGroup = Perm.SuspendGroup; Row.SuspendProcess = Perm.SuspendProcess; Row.ResumeGroup = Perm.ResumeGroup; Row.ResumeProcess = Perm.ResumeProcess; Row.RestartAll = Perm.RestartAll; Row.StartAll = Perm.StartAll; Row.ShutdownAll = Perm.ShutdownAll; Row.SuspendAll = Perm.SuspendAll; Row.ResumeAll = Perm.ResumeAll; DS.UserPermissions.AddUserPermissionsRow(Row); } } DS.Group.AcceptChanges(); DS.GroupForwardFlags.AcceptChanges(); DS.GroupProcessClasses.AcceptChanges(); DS.Link.AcceptChanges(); DS.LinkParams.AcceptChanges(); DS.Message.AcceptChanges(); DS.Param.AcceptChanges(); DS.UserPermissions.AcceptChanges(); DS.ProcessClass.AcceptChanges(); DS.ProcessClassLinks.AcceptChanges(); DS.ProcessClassParams.AcceptChanges(); } if (Status != null) { Session["__MultiXTpmVer"] = Status.TpmVersion; Session["__MultiXTpmMultiXVer"] = Status.TpmMultiXVersion; Session["__MultiXTpmHostName"] = Status.TpmHostName; Session["__MultiXTpmHostIP"] = Status.TpmHostIP; DS.GroupStatus.Clear(); DS.ProcessStatus.Clear(); DS.GroupStatusProcesses.Clear(); if (Status.GroupsStatus != null) { foreach (MultiXTpm.GroupStatus GS in Status.GroupsStatus) { if (DS.Group.FindByID(GS.ID) == null) { continue; } MultiXTpmDB.GroupStatusRow Row = DS.GroupStatus.NewGroupStatusRow(); Row.GroupID = GS.ID; Row.MaxProcessQueueEntries = GS.MaxProcessQueueEntries; Row.OutQueueSize = GS.OutQueueSize; Row.QueuedItemsSize = GS.QueuedItemsSize; Row.SessionsCount = GS.SessionsCount; DS.GroupStatus.AddGroupStatusRow(Row); if (GS.ProcessIDs != null) { foreach (int ProcessID in GS.ProcessIDs) { MultiXTpmDB.GroupStatusProcessesRow GSPRow = DS.GroupStatusProcesses.NewGroupStatusProcessesRow(); GSPRow.GroupID = GS.ID; GSPRow.ProcessID = ProcessID; DS.GroupStatusProcesses.AddGroupStatusProcessesRow(GSPRow); } } } } if (Status.ProcessesStatus != null) { foreach (MultiXTpm.ProcessStatus PS in Status.ProcessesStatus) { MultiXTpmDB.ProcessStatusRow Row = DS.ProcessStatus.NewProcessStatusRow(); Row.ProcessClassID = PS.ProcessClassID; Row.ID = PS.ID; Row.ControlStatus = (int)PS.ControlStatus; Row.IsReady = PS.IsReady; Row.LastMsgTime = PS.LastMsgTime; Row.OutQueueSize = PS.OutQueueSize; Row.SessionsCount = PS.SessionsCount; Row.AppVersion = PS.AppVersion; Row.MultiXVersion = PS.MultiXVersion; DS.ProcessStatus.AddProcessStatusRow(Row); } } DS.GroupStatus.AcceptChanges(); DS.ProcessStatus.AcceptChanges(); DS.GroupStatusProcesses.AcceptChanges(); } return(DS); }