protected void NewMessageBtn_Click(object sender, System.EventArgs e) { try { int l_ID = Convert.ToInt32(MessageID.Text); if (l_ID < 0 || l_ID > 99999999) { throw new Exception(); } MessageID.Text = l_ID.ToString(); if (m_MessageRow == null && l_ID > 0) { if (m_DS.Message.FindByID(l_ID) != null) { Utilities.SetError(this, "Message ID already defined in the system", null); SetNewState(false, false, -1); } else { m_MessageRow = m_DS.Message.NewMessageRow(); m_MessageRow.ID = l_ID; m_DS.Message.AddMessageRow(m_MessageRow); SetNewState(false, true, l_ID); } } } catch { Utilities.SetError(this, "Invalid Message ID Specified", null); SetNewState(false, false, -1); } }
private void SetNewState(bool bNewMessageID, bool bEditMode, int pMessageID) { m_bNewMessage = bNewMessageID; m_bEditMode = bEditMode; m_MessageID = pMessageID; if (m_MessageID < 0) { m_MessageRow = null; } StoreInViewState(); BindAll(); }
private bool SaveData() { try { m_MessageID = Convert.ToInt32(MessageID.Text); int T = Convert.ToInt32(Timeout.Text); if (T < 0) { throw new Exception("Invalid timeout value"); } if (m_bNewMessage) { m_MessageRow = m_DS.Message.NewMessageRow(); m_MessageRow.ID = m_MessageID; } else if (!m_bEditMode) { throw new Exception("Invalid mode on save"); } m_MessageRow.Description = Description.Text.Trim(); m_MessageRow.WSDllFile = WSDllFile.Text.Trim(); m_MessageRow.WSDllFunction = WSDllFunction.Text.Trim(); m_MessageRow.WSSoapAction = WSSoapAction.Text.Trim(); m_MessageRow.WSURL = WSURL.Text.Trim(); m_MessageRow.ID = m_MessageID; m_MessageRow.Stateful = Stateful.Checked; m_MessageRow.Timeout = Convert.ToInt32(Timeout.Text); if (m_bNewMessage) { m_MessageRow.Table.Rows.Add(m_MessageRow); } ConvertEmptyStringToNull(m_MessageRow); return(true); } catch (Exception E) { if (E is FormatException) { Utilities.SetError(this, "Invalid numeric value specified", null); } else { Utilities.SetError(this, E.Message, null); } return(false); } }
protected void Page_Load(object sender, System.EventArgs e) { m_DS = EnvInit(); m_MessageRow = null; m_bEditMode = false; m_bNewMessage = false; m_MessageID = -1; if (!IsPostBack) { if (Request["MessageID"] != null) { if (Request["MessageID"].ToLower() == "new") { SetNewState(true, false, m_MessageID); return; } m_MessageID = Convert.ToInt32(Request["MessageID"]); } else { m_MessageID = -1; } if (m_MessageID >= 0) { m_MessageRow = m_DS.Message.FindByID(m_MessageID); if (m_MessageRow == null) { Utilities.SetError(this, "Message not defined in the system", null); } } SetNewState(false, false, m_MessageID); } else { LoadFromViewState(); if (m_MessageID >= 0) { m_MessageRow = m_DS.Message.FindByID(m_MessageID); } } }
protected void ShowMessageBtn_Click(object sender, System.EventArgs e) { try { int l_ID = Convert.ToInt32(MessageID.Text); m_MessageRow = m_DS.Message.FindByID(l_ID); if (m_MessageRow == null) { SetNewState(false, false, -1); MessageID.Text = l_ID.ToString(); Utilities.Confirm(this, "Message not defined in the system, to add a new one, click OK", "document.all('NewMessageBtn').click()", null); } else { SetNewState(false, false, l_ID); } } catch { Utilities.SetError(this, "Invalid Message ID Specified", null); SetNewState(false, false, -1); } }
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); }