Exemple #1
0
        public ToolStripItemEditView(string groupId)
        {
            InitializeComponent();
            Unity.ApplyResource(this);
            ApplyLanguageResource();
            _groupId = groupId;
            PropertyGridTypeWrapper typeWrapper = new PropertyGridTypeWrapper(typeof(ToolStripItemAbstract));

            typeWrapper.ActOnSubClass = true;
            typeWrapper.VisibleAll    = true;
            typeWrapper.VisibleException.AddRange(new string[] {
                ToolStripItemAbstract.Property_Name, ToolStripItemAbstract.Property_Code
            });
            propertyGrid.AddTypeWrapper(typeWrapper);
            this.txtCode.Regex                = CoreConstant.ENTITY_CODE_REGEX;
            this.txtCode.CustomValidate       = CodeValidateMethod;
            this._userControlEvent            = new UserControlEvent(null);
            this._userControlEvent.FormEntity = null;
            this._userControlEvent.Dock       = DockStyle.Fill;
        }
Exemple #2
0
        private void FormEvents_Load(object sender, EventArgs e)
        {
            if (FormHostingContainer.Instance.ActiveHosting == null)
            {
                return;
            }
            if (FormHostingContainer.Instance.ActiveHosting.SelectionService.PrimarySelection == null)
            {
                return;
            }
            object           primarySelection = FormHostingContainer.Instance.ActiveHosting.SelectionService.PrimarySelection;
            IShellControlDev shellControlDev  = primarySelection as IShellControlDev;

            if (shellControlDev == null)
            {
                throw new NotImplementedException();
            }
            this._userControlEvent            = new UserControlEvent(shellControlDev.Entity);
            this._userControlEvent.FormEntity = FormHostingContainer.Instance.ActiveFormEntity;
            this._userControlEvent.Dock       = DockStyle.Fill;
            this._userControlEvent.OnEdited  += new UserControlEvent.OnEditedEventHandler(_userControlEvent_OnAfterEdit);
            this.Controls.Add(this._userControlEvent);
        }
        public Feed getHostUserControlDetail(string id, DateTime startDate, DateTime endDate)
        {
            SqlConnection conn = new SqlConnection();
            SqlCommand cmd = new SqlCommand();
            SqlDataReader rdr = null;

            Feed feed = new Feed();
            feed.name = "User Control";

            string sql = @"
                SELECT	dateadd(second,[EVENT_TIME]/1000, '1970-01-01') AS ed,
                        dateadd(second,[BEGIN_TIME]/1000, '1970-01-01') AS begin_time,
                        dateadd(second,[END_TIME]/1000, '1970-01-01') AS end_time,
                        (SELECT
                            CASE [EVENT_ID]
                                WHEN 501 THEN 'Application Control Driver'
                                WHEN 502 THEN 'Application Control Rules'
                                WHEN 999 THEN 'Tamper Protection'
                            END) AS event_type,
                        severity,
                        (SELECT
                            CASE [ACTION]
                                WHEN 0 THEN 'allow'
                                WHEN 1 THEN 'block'
                                WHEN 2 THEN 'ask'
                                WHEN 3 THEN 'continue'
                                WHEN 4 THEN 'terminate'
                            END) AS action,
                        description,
                        rule_name,
                        caller_process_name,
                        parameter,
                        alert,
                        user_name,
                        domain_name
                FROM	v_agent_behavior_log l
                            INNER JOIN identity_map m ON l.[GROUP_ID] = m.[ID]
                WHERE	caller_process_name != 'SysPlant' AND
                        COMPUTER_ID = @Id AND
                        dateadd(second,[BEGIN_TIME]/1000, '1970-01-01')  BETWEEN @StartDate AND @EndDate
                ORDER	BY l.EVENT_TIME";

            try {
                conn.ConnectionString = this.sqlConnectionString;
                conn.Open();

                cmd = new SqlCommand(sql, conn);
                cmd.CommandType = System.Data.CommandType.Text;

                cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.VarChar, 32)).Value = id;
                cmd.Parameters.Add(new SqlParameter("@StartDate", SqlDbType.DateTime)).Value = startDate;
                cmd.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime)).Value = endDate;
                rdr = cmd.ExecuteReader();

                while (rdr.Read()) {
                    UserControlEvent e = new UserControlEvent();
                    e.feed = feed.name;
                    e.ed = (DateTime)rdr["begin_time"];
                    e.et = rdr["event_type"] == DBNull.Value ? null : (string)rdr["event_type"];
                    e.severity = (int)rdr["severity"];
                    e.action_taken = rdr["action"] == DBNull.Value ? null : (string)rdr["action"];
                    e.description = rdr["description"] == DBNull.Value ? null : (string)rdr["description"];
                    e.rule_name = rdr["rule_name"] == DBNull.Value ? null : (string)rdr["rule_name"];
                    e.caller_process = rdr["caller_process_name"] == DBNull.Value ? null : (string)rdr["caller_process_name"];
                    e.parameter = rdr["parameter"] == DBNull.Value ? null : (string)rdr["parameter"];
                    if (rdr["alert"] != DBNull.Value && (int)rdr["alert"] == 1) {
                        e.alert = true;
                    }
                    e.user_name = rdr["user_name"] == DBNull.Value ? null : (string)rdr["user_name"];
                    e.domain_name = rdr["domain_name"] == DBNull.Value ? null : (string)rdr["domain_name"];

                    feed.events.Add(e);

                    if ((DateTime)rdr["ed"] < mindt) {
                        mindt = (DateTime)rdr["ed"];
                    }

                    if ((DateTime)rdr["ed"] > maxdt) {
                        maxdt = (DateTime)rdr["ed"];
                    }
                }
            } catch (Exception e) {
                feed.error = e.Message;
            } finally {
                rdr.Close();
                rdr.Dispose();
                cmd.Dispose();
                conn.Close();
                conn.Dispose();
            }

            return feed;
        }