private void btnBrowse_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { frmEditRuleResult fer = new frmEditRuleResult(SecurityEventService.Instance.DBManager, false); if (CGeneralFuncion.ShowWindow(this, fer, true) == System.Windows.Forms.DialogResult.OK) { SecurityActionResult sar = fer.SelectedResult[0]; this.txtResult.BackColor = Color.FromArgb(sar.BackgroundColor); this.txtResult.Text = sar.Description; this.txtResult.Tag = sar.ResultGuid; } } catch (Exception ex) { MessageBox.Show("选择安全行为结果失败,错误消息为:" + ex.Message); } finally { this.Cursor = Cursors.Default; } }
private void btnNewResult_Click(object sender, EventArgs e) { SecurityActionResult result = SecurityActionResult.CreateNewSecurityActionResult(); m_newItems.Add(result.ResultGuid); InsertControl(result); }
public static SecurityActionResult CreateNewSecurityActionResult() { SecurityActionResult result = new SecurityActionResult(); result.Description = DefaultResultName; result.ResultGuid = Guid.NewGuid().ToString(); return(result); }
public static SecurityActionResult CreateSecurityActionResult(string desc, string guid, int bgColor) { SecurityActionResult result = new SecurityActionResult(); result.Description = desc; result.ResultGuid = guid; result.BackgroundColor = bgColor; return(result); }
public object Clone() { SecurityActionResult result = new SecurityActionResult(); result.ResultGuid = this.ResultGuid; result.Description = this.Description; result.BackgroundColor = this.BackgroundColor; return(result); }
private void InsertControl(SecurityActionResult result) { usEditResult ctl = new usEditResult(); ctl.Width = this.flowLayoutPanel1.Width; ctl.SetActionResult(result); ctl.CanEdit = m_isEdit; this.flowLayoutPanel1.Controls.Add(ctl); }
private void UpdateDatas() { this.Cursor = Cursors.WaitCursor; try { List <SecurityActionResult> newItems = new List <SecurityActionResult>(); List <SecurityActionResult> modifyItems = new List <SecurityActionResult>(); foreach (Control ctl in this.flowLayoutPanel1.Controls) { if (ctl is usEditResult) { usEditResult r = (usEditResult)ctl; SecurityActionResult tmpData = r.EditedResult; if (m_newItems.Contains(tmpData.ResultGuid)) { newItems.Add(tmpData); } else if (!m_initData[tmpData.ResultGuid].Equals(tmpData)) { modifyItems.Add(tmpData); } } } if (newItems.Count > 0) { SecurityEventService.Instance.InsertResults(newItems); } if (modifyItems.Count > 0) { SecurityEventService.Instance.UpdateResults(modifyItems); } if (m_deletedItems.Count > 0) { SecurityEventService.Instance.DeleteResults(m_deletedItems); } } catch (Exception ex) { MessageBox.Show("更新数据失败,错误消息为:" + ex.Message); } finally { this.Cursor = Cursors.Default; } }
public frmEditUserActionProperty(SecurityAction sa) { InitializeComponent(); this.txtName.Text = sa.Name; this.txtDesc.Text = sa.Description; this.txtGuid.Text = sa.ActionGuid; if (!string.IsNullOrWhiteSpace(sa.ResultGuid)) { SecurityActionResult result = SecurityEventService.Instance.GetSecurityActionResult(sa.ResultGuid); this.txtResult.BackColor = Color.FromArgb(result.BackgroundColor); this.txtResult.Text = result.Description; this.txtResult.Tag = result.ResultGuid; } }
public override bool Equals(object obj) { if (obj == null || (!(obj is SecurityActionResult))) { return(false); } SecurityActionResult result = (SecurityActionResult)obj; if (this.BackgroundColor != result.BackgroundColor) { return(false); } if (!string.Equals(this.Description, result.Description, StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
public void CopyFrom(SecurityActionResult result) { this.Description = result.Description; this.BackgroundColor = result.BackgroundColor; }
public void SetActionResult(SecurityActionResult result) { this.textBox1.Text = result.Description; this.pictureBox1.BackColor = Color.FromArgb(result.BackgroundColor); this.Tag = result.ResultGuid; }