public intrusionevents intrusioneventsGetById(int IntrusionEventsId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "intrusioneventsGetById",
                                                        IntrusionEventsId).Tables[0];
                intrusionevents NewEnt = new intrusionevents();

                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.IntrusionEventsId    = Int32.Parse(dr["IntrusionEventsId"].ToString());
                    NewEnt.IntrusionEventDetail = dr["IntrusionEventDetail"].ToString();
                    NewEnt.CVEId = dr["CVEId"].ToString();
                    NewEnt.CWEId = dr["CWEId"].ToString();
                    NewEnt.CWEId = dr["CAPECId"].ToString();
                    NewEnt.CWEId = dr["OWASPId"].ToString();
                }
                return(NewEnt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public bool intrusioneventsUpdate(intrusionevents intrusionevents)
 {
     try
     {
         int update = SqlHelper.ExecuteNonQuery(SqlImplHelper.getConnectionString(), "intrusioneventsUpdate",
                                                intrusionevents.IntrusionEventsId,
                                                intrusionevents.IntrusionEventDetail,
                                                intrusionevents.CVEId,
                                                intrusionevents.CWEId,
                                                intrusionevents.CAPECId,
                                                intrusionevents.OWASPId);
         if (update > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void gvEvents_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvEvents.SelectedRow;

            intrusionevents    auxIntrusionEvents = new intrusionevents();
            intrusioneventsBus oIntrusionEvent    = new intrusioneventsBus();

            if ((Label)row.FindControl("intrusionEventId") != null)
            {
                txtIntrusionEventId.Text = ((Label)row.FindControl("intrusionEventId")).Text;
            }
            else
            {
                txtIntrusionEventId.Text = "";
            }
            if ((Label)row.FindControl("intrusionEventDetail") != null)
            {
                txtIntrusionDetail.Text = ((Label)row.FindControl("intrusionEventDetail")).Text;
            }
            else
            {
                txtIntrusionDetail.Text = "";
            }
            if ((Label)row.FindControl("CVEId") != null)
            {
                txtCVEId.Text = ((Label)row.FindControl("CVEId")).Text;
            }
            else
            {
                txtCVEId.Text = "";
            }
            if ((Label)row.FindControl("CWEId") != null)
            {
                txtCWEId.Text = ((Label)row.FindControl("CWEId")).Text;
            }
            else
            {
                txtCWEId.Text = "";
            }
            if ((Label)row.FindControl("CAPECId") != null)
            {
                txtCAPECId.Text = ((Label)row.FindControl("CAPECId")).Text;
            }
            else
            {
                txtCAPECId.Text = "";
            }
            if ((Label)row.FindControl("OWASPId") != null)
            {
                txtOWASPId.Text = ((Label)row.FindControl("OWASPId")).Text;
            }
            else
            {
                txtOWASPId.Text = "";
            }

            activateFields(true, false);
            btnSave.Enabled = true;
        }
 public int intrusioneventsAdd(intrusionevents intrusionevents)
 {
     try
     {
         return((int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "intrusioneventsAdd",
                                             intrusionevents.IntrusionEventDetail,
                                             intrusionevents.CVEId,
                                             intrusionevents.CWEId,
                                             intrusionevents.CAPECId,
                                             intrusionevents.OWASPId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
        protected void getEventsAlarmData()
        {
            DataTable dttEventsAlarm = new DataTable();

            dttEventsAlarm.Columns.Add(new DataColumn("eventsAlarmId", System.Type.GetType("System.Int32")));
            dttEventsAlarm.Columns.Add(new DataColumn("eventsAlarmTittle", System.Type.GetType("System.String")));
            dttEventsAlarm.Columns.Add(new DataColumn("checkFrecuency", System.Type.GetType("System.Int32")));
            dttEventsAlarm.Columns.Add(new DataColumn("serverity", System.Type.GetType("System.Int32")));
            dttEventsAlarm.Columns.Add(new DataColumn("severityDescription", System.Type.GetType("System.String")));
            dttEventsAlarm.Columns.Add(new DataColumn("SLATimeToResponse", System.Type.GetType("System.Int32")));
            dttEventsAlarm.Columns.Add(new DataColumn("active", System.Type.GetType("System.Boolean")));

            List <eventsalarm> lstEventsAlarm   = new List <eventsalarm>();
            eventsalarmBus     oEventsAlarm     = new eventsalarmBus();
            intrusioneventsBus oIntrusionEvents = new intrusioneventsBus();
            severityBus        oSeverity        = new severityBus();

            lstEventsAlarm = oEventsAlarm.eventsalarmGetAll();

            if (lstEventsAlarm.Count > 0)
            {
                foreach (eventsalarm row in lstEventsAlarm)
                {
                    intrusionevents auxIntrusionEvent = new intrusionevents();
                    severity        auxSeverity       = new severity();

                    auxSeverity = oSeverity.severityGetById(row.Severity);

                    dttEventsAlarm.Rows.Add(row.EventsAlarmId,
                                            row.EventsAlarmTittle,
                                            row.CheckFrecuency,
                                            row.Severity,
                                            auxSeverity.SeverityDescription,
                                            auxSeverity.SLATimeToResponse,
                                            row.Active);
                }

                gvAlarms.DataSource = dttEventsAlarm;
                gvAlarms.DataBind();
            }
        }
        public List <intrusionevents> intrusioneventsGetAll()
        {
            List <intrusionevents> lstintrusionevents = new List <intrusionevents>();

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "intrusioneventsGetAll").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    int colIntrusionEventsId    = dt.Columns["IntrusionEventsId"].Ordinal;
                    int colIntrusionEventDetail = dt.Columns["IntrusionEventDetail"].Ordinal;
                    int colCVEId   = dt.Columns["CVEId"].Ordinal;
                    int colCWEId   = dt.Columns["CWEId"].Ordinal;
                    int colCAPECId = dt.Columns["CAPECId"].Ordinal;
                    int colOWASPId = dt.Columns["OWASPId"].Ordinal;

                    for (int i = 0; dt.Rows.Count > i; i++)
                    {
                        intrusionevents NewEnt = new intrusionevents();
                        NewEnt.IntrusionEventsId    = Int32.Parse(dt.Rows[i].ItemArray[colIntrusionEventsId].ToString());
                        NewEnt.IntrusionEventDetail = dt.Rows[i].ItemArray[colIntrusionEventDetail].ToString();
                        NewEnt.CVEId   = dt.Rows[i].ItemArray[colCVEId].ToString();
                        NewEnt.CWEId   = dt.Rows[i].ItemArray[colCWEId].ToString();
                        NewEnt.CAPECId = dt.Rows[i].ItemArray[colCAPECId].ToString();
                        NewEnt.OWASPId = dt.Rows[i].ItemArray[colOWASPId].ToString();

                        lstintrusionevents.Add(NewEnt);
                    }
                }
                return(lstintrusionevents);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            intrusionevents    auxNewIntrusionEvents = new intrusionevents();
            intrusioneventsBus oIntrusionEvents      = new intrusioneventsBus();
            bool needRequiredFields = false;
            int  saveType           = 0;

            if (btnNew.Enabled)
            {
                saveType = 2;
            }
            if (!btnNew.Enabled)
            {
                saveType = 1;
            }

            if (String.IsNullOrEmpty(txtIntrusionDetail.Text))
            {
                needRequiredFields = true;
            }
            if ((String.IsNullOrEmpty(txtCVEId.Text)) &&
                (String.IsNullOrEmpty(txtCWEId.Text)) &&
                (String.IsNullOrEmpty(txtCAPECId.Text)) &&
                (String.IsNullOrEmpty(txtOWASPId.Text)))
            {
                needRequiredFields = true;
            }

            if (!needRequiredFields)
            {
                if (txtIntrusionDetail.Text.Length > 49)
                {
                    auxNewIntrusionEvents.IntrusionEventDetail = txtIntrusionDetail.Text.Substring(0, 49);
                }
                else
                {
                    auxNewIntrusionEvents.IntrusionEventDetail = txtIntrusionDetail.Text;
                }
                auxNewIntrusionEvents.CVEId   = txtCVEId.Text;
                auxNewIntrusionEvents.CWEId   = txtCWEId.Text;
                auxNewIntrusionEvents.CAPECId = txtCAPECId.Text;
                auxNewIntrusionEvents.OWASPId = txtOWASPId.Text;

                switch (saveType)
                {
                case 1:     //save
                    if (oIntrusionEvents.intrusioneventsAdd(auxNewIntrusionEvents) > 0)
                    {
                        lblMessage.Text = "Datos guardados correctamente!";
                        clearFields();
                        activateFields(false, true);
                        btnNew.Enabled = true;
                        getIntrusionEventsData();
                    }
                    else
                    {
                        lblMessage.Text = "Error al guardar los datos!";
                    }
                    break;

                case 2:     //update
                    auxNewIntrusionEvents.IntrusionEventsId = Convert.ToInt32(txtIntrusionEventId.Text);
                    if (oIntrusionEvents.intrusioneventsUpdate(auxNewIntrusionEvents))
                    {
                        lblMessage.Text = "Datos actualizados correctamente!";
                        clearFields();
                        activateFields(false, true);
                        btnSave.Enabled = false;
                        getIntrusionEventsData();
                    }
                    else
                    {
                        lblMessage.Text = "Error al guardar los datos!";
                    }
                    break;
                }
            }
        }
        public bool intrusioneventsUpdate(intrusionevents intrusionevents)
        {
            intrusioneventsImpl ointrusioneventsImpl = new intrusioneventsImpl();

            return(ointrusioneventsImpl.intrusioneventsUpdate(intrusionevents));
        }
        public int intrusioneventsAdd(intrusionevents intrusionevents)
        {
            intrusioneventsImpl ointrusioneventsImpl = new intrusioneventsImpl();

            return(ointrusioneventsImpl.intrusioneventsAdd(intrusionevents));
        }
Exemplo n.º 10
0
        protected void gvAlarms_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvAlarms.SelectedRow;

            eventsalarm    auxEventsAlarm = new eventsalarm();
            eventsalarmBus oEventsAlarm   = new eventsalarmBus();

            intrusionevents        auxIntrusionEvent          = new intrusionevents();
            List <intrusionevents> lstIntrusionEventsAssigned = new List <intrusionevents>();
            intrusioneventsBus     oIntrusionEvents           = new intrusioneventsBus();

            List <eventsalarm_intrusionevents_mapping> lstEventsMapping = new List <eventsalarm_intrusionevents_mapping>();
            eventsalarm_intrusionevents_mappingBus     oEventsMapping   = new eventsalarm_intrusionevents_mappingBus();

            try
            {
                ddlSeverity.SelectedValue = ((Label)row.FindControl("severity")).Text;
            }
            catch
            {
            }

            if ((Label)row.FindControl("eventsAlarmId") != null)
            {
                txtEventAlarmId.Text = ((Label)row.FindControl("eventsAlarmId")).Text;
            }
            else
            {
                txtEventAlarmId.Text = "";
            }
            if ((Label)row.FindControl("eventsAlarmTittle") != null)
            {
                txtEventsAlarmTittle.Text = ((Label)row.FindControl("eventsAlarmTittle")).Text;
            }
            else
            {
                txtEventsAlarmTittle.Text = "";
            }
            if ((Label)row.FindControl("checkFrecuency") != null)
            {
                txtCheckFrequency.Text = ((Label)row.FindControl("checkFrecuency")).Text;
            }
            else
            {
                txtCheckFrequency.Text = "";
            }
            if ((CheckBox)row.FindControl("active") != null)
            {
                chkActive.Checked = ((CheckBox)row.FindControl("active")).Checked;
            }
            else
            {
                chkActive.Checked = false;
            }

            auxEventsAlarm   = oEventsAlarm.eventsalarmGetById(Convert.ToInt32(txtEventAlarmId.Text));
            lstEventsMapping = oEventsMapping.eventsalarm_intrusionevents_mappingGetByEventsAlarmId(Convert.ToInt32(txtEventAlarmId.Text));

            if (lstEventsMapping.Count > 0)
            {
                foreach (eventsalarm_intrusionevents_mapping rowMapping in lstEventsMapping)
                {
                    auxIntrusionEvent = oIntrusionEvents.intrusioneventsGetById(rowMapping.IntrusionEventId);
                    lstIntrusionEventsAssigned.Add(auxIntrusionEvent);
                }

                gvIntrusionEventsAssigned.DataSource = lstIntrusionEventsAssigned;
                gvIntrusionEventsAssigned.DataBind();
            }

            ddlIDPS.SelectedValue    = auxEventsAlarm.IdsId.ToString();
            chkBIA.Items[0].Selected = Convert.ToBoolean(auxEventsAlarm.AffectConfidence);
            chkBIA.Items[1].Selected = Convert.ToBoolean(auxEventsAlarm.AffectIntegrity);
            chkBIA.Items[2].Selected = Convert.ToBoolean(auxEventsAlarm.AffectAvailability);
            getSignatureData(auxEventsAlarm.IdsId);
            ddlIDPSSignatures.SelectedValue = auxEventsAlarm.IdsSignatureCategoryId.ToString();

            activateFields(true, false);
            btnSave.Enabled = true;
        }