private void AddSecurityEntry(SecAction action) { wfrm_SecurityEntry frm = new wfrm_SecurityEntry(action); if(frm.ShowDialog(this) == DialogResult.OK){ DataRow dr = m_ServerAPI.AddSecurityEntry(frm.wp_Description,frm.wp_Protocol,frm.wp_Type,frm.wp_Action,frm.wp_Content,frm.wp_StartIP,frm.wp_EndIP); if(dr == null){ MessageBox.Show("Error adding security entry!!!","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); return; } } m_ServerAPI.LoadSecurity(); }
/// <summary> /// /// </summary> /// <param name="action"></param> internal wfrm_SecurityEntry(SecAction action) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // if(action == SecAction.Allow_SMTP || action == SecAction.Deny_SMTP || action == SecAction.Allow_Relay || action == SecAction.Deny_Relay){ m_pProtocol.Items.Add("SMTP"); } else{ m_pProtocol.Items.Add("POP3"); } m_pProtocol.Enabled = false; m_pProtocol.VisibleItems = 2; m_pProtocol.SelectedIndex = 0; m_pType.Items.Add("IP"); m_pType.Items.Add("IP Range"); m_pType.VisibleItems = 2; m_pAction.Items.Clear(); if(action == SecAction.Allow_SMTP || action == SecAction.Allow_POP3){ m_pAction.Items.Add("Allow"); } if(action == SecAction.Deny_SMTP || action == SecAction.Deny_POP3){ m_pAction.Items.Add("Deny"); } if(action == SecAction.Allow_Relay){ m_pAction.Items.Add("Allow Relay"); } if(action == SecAction.Deny_Relay){ m_pAction.Items.Add("Deny Relay"); } m_pAction.Enabled = false; m_pAction.VisibleItems = 4; m_pType.SelectedIndex = 0; m_pAction.SelectedIndex = 0; }