Exemplo n.º 1
0
        public List <eventsalarm_intrusionevents_mapping> eventsalarm_intrusionevents_mappingGetByEventsAlarmId(int EventsAlarmId)
        {
            List <eventsalarm_intrusionevents_mapping> lsteventsalarm_intrusionevents_mapping = new List <eventsalarm_intrusionevents_mapping>();

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "eventsalarm_intrusionevents_mappingGetByEventsAlarmId",
                                                        EventsAlarmId).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    int colEventsAlarmId    = dt.Columns["EventsAlarmId"].Ordinal;
                    int colIntrusionEventId = dt.Columns["IntrusionEventId"].Ordinal;
                    for (int i = 0; dt.Rows.Count > i; i++)
                    {
                        eventsalarm_intrusionevents_mapping NewEnt = new eventsalarm_intrusionevents_mapping();
                        NewEnt.EventsAlarmId    = Int32.Parse(dt.Rows[i].ItemArray[colEventsAlarmId].ToString());
                        NewEnt.IntrusionEventId = Int32.Parse(dt.Rows[i].ItemArray[colIntrusionEventId].ToString());
                        lsteventsalarm_intrusionevents_mapping.Add(NewEnt);
                    }
                }
                return(lsteventsalarm_intrusionevents_mapping);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public int eventsalarm_intrusionevents_mappingAdd(eventsalarm_intrusionevents_mapping eventsalarm_intrusionevents_mapping)
 {
     try
     {
         return((int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "eventsalarm_intrusionevents_mappingAdd",
                                             eventsalarm_intrusionevents_mapping.EventsAlarmId,
                                             eventsalarm_intrusionevents_mapping.IntrusionEventId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public bool eventsalarm_intrusionevents_mappingUpdate(eventsalarm_intrusionevents_mapping eventsalarm_intrusionevents_mapping)
 {
     try
     {
         int update = SqlHelper.ExecuteNonQuery(SqlImplHelper.getConnectionString(), "eventsalarm_intrusionevents_mappingUpdate",
                                                eventsalarm_intrusionevents_mapping.EventsAlarmId,
                                                eventsalarm_intrusionevents_mapping.IntrusionEventId);
         if (update > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public eventsalarm_intrusionevents_mapping eventsalarm_intrusionevents_mappingGetById(int EventsAlarmId, int IntrusionEventId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "eventsalarm_intrusionevents_mappingGetById",
                                                        EventsAlarmId,
                                                        IntrusionEventId).Tables[0];
                eventsalarm_intrusionevents_mapping NewEnt = new eventsalarm_intrusionevents_mapping();

                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.EventsAlarmId    = Int32.Parse(dr["EventsAlarmId"].ToString());
                    NewEnt.IntrusionEventId = Int32.Parse(dr["IntrusionEventId"].ToString());
                }
                return(NewEnt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool eventsalarm_intrusionevents_mappingUpdate(eventsalarm_intrusionevents_mapping eventsalarm_intrusionevents_mapping)
        {
            eventsalarm_intrusionevents_mappingImpl oeventsalarm_intrusionevents_mappingImpl = new eventsalarm_intrusionevents_mappingImpl();

            return(oeventsalarm_intrusionevents_mappingImpl.eventsalarm_intrusionevents_mappingUpdate(eventsalarm_intrusionevents_mapping));
        }
        public int eventsalarm_intrusionevents_mappingAdd(eventsalarm_intrusionevents_mapping eventsalarm_intrusionevents_mapping)
        {
            eventsalarm_intrusionevents_mappingImpl oeventsalarm_intrusionevents_mappingImpl = new eventsalarm_intrusionevents_mappingImpl();

            return(oeventsalarm_intrusionevents_mappingImpl.eventsalarm_intrusionevents_mappingAdd(eventsalarm_intrusionevents_mapping));
        }
Exemplo n.º 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            eventsalarm    auxNewEventAlarm = new eventsalarm();
            eventsalarmBus oEventsAlarm     = new eventsalarmBus();

            eventsalarm_intrusionevents_mapping    auxIntrusionEventMapping = new eventsalarm_intrusionevents_mapping();
            eventsalarm_intrusionevents_mappingBus oIntrusionEventsMapping  = new eventsalarm_intrusionevents_mappingBus();

            bool needRequiredFields = false;
            int  saveType           = 0;

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

            if (String.IsNullOrEmpty(txtCheckFrequency.Text))
            {
                needRequiredFields = true;
            }
            if (String.IsNullOrEmpty(txtEventsAlarmTittle.Text))
            {
                needRequiredFields = true;
            }

            if (!needRequiredFields)
            {
                auxNewEventAlarm.Severity           = Convert.ToInt32(ddlSeverity.SelectedValue);
                auxNewEventAlarm.EventsAlarmTittle  = txtEventsAlarmTittle.Text;
                auxNewEventAlarm.CheckFrecuency     = Convert.ToInt32(txtCheckFrequency.Text);
                auxNewEventAlarm.Active             = Convert.ToSByte(chkActive.Checked);
                auxNewEventAlarm.AffectConfidence   = Convert.ToSByte(chkBIA.Items[0].Selected);
                auxNewEventAlarm.AffectIntegrity    = Convert.ToSByte(chkBIA.Items[1].Selected);
                auxNewEventAlarm.AffectAvailability = Convert.ToSByte(chkBIA.Items[2].Selected);
                auxNewEventAlarm.IdsId = Convert.ToInt32(ddlIDPS.SelectedValue);
                auxNewEventAlarm.IdsSignatureCategoryId = Convert.ToInt32(ddlIDPSSignatures.SelectedValue);

                switch (saveType)
                {
                case 1:     //save
                    if (oEventsAlarm.eventsalarmAdd(auxNewEventAlarm) > 0)
                    {
                        if (gvIntrusionEventsAssigned.Rows.Count > 0)
                        {
                            foreach (GridViewRow rowIntrusion in gvIntrusionEventsAssigned.Rows)
                            {
                                auxIntrusionEventMapping.EventsAlarmId    = Convert.ToInt32(txtEventAlarmId.Text);
                                auxIntrusionEventMapping.IntrusionEventId = Convert.ToInt32(((Label)rowIntrusion.FindControl("intrusionEventsId")).Text);

                                if (oIntrusionEventsMapping.eventsalarm_intrusionevents_mappingAdd(auxIntrusionEventMapping) <= 0)
                                {
                                    lblMessage.Text = "Error al guardar Referencias del Evento [Evento de Intrusion] " + ((Label)rowIntrusion.FindControl("intrusionEventsId")).Text;
                                }
                            }
                        }

                        lblMessage.Text = "Datos guardados correctamente!";
                        clearFields();
                        activateFields(false, true);
                        btnNew.Enabled = true;
                        getEventsAlarmData();
                    }
                    else
                    {
                        lblMessage.Text = "Error al guardar los datos!";
                    }
                    break;

                case 2:     //update
                    auxNewEventAlarm.EventsAlarmId = Convert.ToInt32(txtEventAlarmId.Text);
                    if (oEventsAlarm.eventsalarmUpdate(auxNewEventAlarm))
                    {
                        if (gvIntrusionEventsAssigned.Rows.Count > 0)
                        {
                            foreach (GridViewRow rowIntrusion in gvIntrusionEventsAssigned.Rows)
                            {
                                auxIntrusionEventMapping.EventsAlarmId    = Convert.ToInt32(txtEventAlarmId.Text);
                                auxIntrusionEventMapping.IntrusionEventId = Convert.ToInt32(((Label)rowIntrusion.FindControl("intrusionEventsId")).Text);

                                if (oIntrusionEventsMapping.eventsalarm_intrusionevents_mappingAdd(auxIntrusionEventMapping) <= 0)
                                {
                                    lblMessage.Text = "Error al guardar Referencias del Evento [Evento de Intrusion] " + ((Label)rowIntrusion.FindControl("intrusionEventsId")).Text;
                                }
                            }
                        }

                        lblMessage.Text = "Datos actualizados correctamente!";
                        clearFields();
                        activateFields(false, true);
                        btnSave.Enabled = false;
                        getEventsAlarmData();
                    }
                    else
                    {
                        lblMessage.Text = "Error al guardar los datos!";
                    }
                    break;
                }
            }
            else
            {
                lblMessage.Text = "Error, existen campos sin completar!";
            }
        }