コード例 #1
0
        protected void generateBarChartTasks()
        {
            DataTable dttTaskByStatus = new DataTable();

            dttTaskByStatus.Columns.Add(new DataColumn("statusId", System.Type.GetType("System.Int32")));
            dttTaskByStatus.Columns.Add(new DataColumn("StatusName", System.Type.GetType("System.String")));
            dttTaskByStatus.Columns.Add(new DataColumn("Quantity", System.Type.GetType("System.Int32")));

            List <taskstatus> lstTaskStatus = new List <taskstatus>();
            taskstatusBus     oTaskStatus   = new taskstatusBus();

            List <tasks> lstTasks = new List <tasks>();
            tasksBus     oTask    = new tasksBus();

            lstTaskStatus = oTaskStatus.taskstatusGetAll();

            if (lstTaskStatus.Count > 0)
            {
                foreach (taskstatus rowTaskStatus in lstTaskStatus)
                {
                    int qtyTask = 0;

                    lstTasks = oTask.tasksGetAll();

                    foreach (tasks rowTask in lstTasks)
                    {
                        if (rowTask.TaskStatudId == rowTaskStatus.TaskStatusId)
                        {
                            if (rowTask.TaskStatudId != 2)     //Closed
                            {
                                if (rowTask.TaskStatudId != 5) //Rejected
                                {
                                    qtyTask++;
                                }
                            }
                        }
                    }

                    dttTaskByStatus.Rows.Add(rowTaskStatus.TaskStatusId, rowTaskStatus.TaskStatusDescription, qtyTask);
                }
            }

            barChartTasks.Series[0].XValueMember  = "StatusName";
            barChartTasks.Series[0].YValueMembers = "Quantity";
            barChartTasks.DataSource = dttTaskByStatus;
            barChartTasks.DataBind();
        }
コード例 #2
0
        protected void getTaskData(int taskId)
        {
            DataTable dttTask = new DataTable();

            dttTask.Columns.Add(new DataColumn("taskId", System.Type.GetType("System.Int32")));
            dttTask.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
            dttTask.Columns.Add(new DataColumn("taskTittle", System.Type.GetType("System.String")));
            dttTask.Columns.Add(new DataColumn("eventsDetectionId", System.Type.GetType("System.Int32")));
            dttTask.Columns.Add(new DataColumn("taskStatusId", System.Type.GetType("System.Int32")));
            dttTask.Columns.Add(new DataColumn("statusDescription", System.Type.GetType("System.String")));
            dttTask.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttTask.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttTask.Columns.Add(new DataColumn("serverityId", System.Type.GetType("System.Int32")));
            dttTask.Columns.Add(new DataColumn("sererityDescription", System.Type.GetType("System.String")));
            dttTask.Columns.Add(new DataColumn("SLAStatus", System.Type.GetType("System.String")));

            tasks              auxtTasks        = new tasks();
            tasksBus           oTasks           = new tasksBus();
            eventsdetectionBus oEventsDetection = new eventsdetectionBus();
            idsBus             oIDPS            = new idsBus();
            eventsalarmBus     oEventsAlarm     = new eventsalarmBus();
            severityBus        oSeverity        = new severityBus();
            taskstatusBus      oTaskStatus      = new taskstatusBus();
            usersBus           oUsers           = new usersBus();

            auxtTasks = oTasks.tasksGetById(taskId);

            if (auxtTasks != null)
            {
                taskstatus      auxStatus         = new taskstatus();
                users           auxUser           = new users();
                eventsdetection auxEventDetection = new eventsdetection();
                eventsalarm     auxEventAlarm     = new eventsalarm();
                severity        auxSeverity       = new severity();
                string          SLASatus          = "";

                auxStatus         = oTaskStatus.taskstatusGetById(auxtTasks.TaskStatudId);
                auxUser           = oUsers.usersGetById(auxtTasks.UserId);
                auxEventDetection = oEventsDetection.eventsdetectionGetById(auxtTasks.EventsDetectionId);
                auxEventAlarm     = oEventsAlarm.eventsalarmGetById(auxEventDetection.EventsAlarmId);
                auxSeverity       = oSeverity.severityGetById(auxEventAlarm.Severity);

                DateTime deadTime = auxtTasks.DateTime;
                deadTime.AddMinutes(auxSeverity.SLATimeToResponse);
                if (DateTime.Now > deadTime)
                {
                    SLASatus = "Vencido";
                }
                if (DateTime.Now < deadTime)
                {
                    SLASatus = "En término";
                }

                dttTask.Rows.Add(auxtTasks.TaskId,
                                 auxtTasks.DateTime,
                                 auxtTasks.TaskTittle,
                                 auxtTasks.EventsDetectionId,
                                 auxtTasks.TaskStatudId,
                                 auxStatus.TaskStatusDescription,
                                 auxtTasks.UserId,
                                 auxUser.UserName,
                                 auxEventAlarm.Severity,
                                 auxSeverity.SeverityDescription,
                                 SLASatus);

                gvTask.DataSource = dttTask;
                gvTask.DataBind();
            }
        }
コード例 #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
            culture.DateTimeFormat.LongTimePattern  = "";
            Thread.CurrentThread.CurrentCulture     = culture;

            taskdetails    auxNewTaskDetail = new taskdetails();
            taskdetailsBus oTaskDetail      = new taskdetailsBus();

            tasks    auxTasks = new tasks();
            tasksBus oTasks   = new tasksBus();

            users    auxUser = new users();
            usersBus oUser   = new usersBus();

            eventsdetectionBus oEventsDetection = new eventsdetectionBus();

            bool needRequiredFields = false;
            int  saveType           = 0;

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

            if (String.IsNullOrEmpty(txtDateTime.Text))
            {
                needRequiredFields = true;
            }
            if (String.IsNullOrEmpty(txtEffortHours.Text))
            {
                needRequiredFields = true;
            }
            if (String.IsNullOrEmpty(txtDetail.Text))
            {
                needRequiredFields = true;
            }
            if (String.IsNullOrEmpty(txtTaskId.Text))
            {
                needRequiredFields = true;
            }

            if (!needRequiredFields)
            {
                auxUser = oUser.usersGetByUserName(HttpContext.Current.User.Identity.Name);

                DateTime dateTime = DateTime.ParseExact(txtDateTime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                auxNewTaskDetail.DateTime    = dateTime;
                auxNewTaskDetail.EffortHours = Convert.ToDecimal(txtEffortHours.Text);
                auxNewTaskDetail.Details     = txtDetail.Text;
                auxNewTaskDetail.TaskId      = Convert.ToInt32(txtTaskId.Text);
                auxNewTaskDetail.UserId      = Convert.ToInt32(ddlUsers.SelectedValue);
                int auxTaskStatus   = Convert.ToInt32(ddlTaskStatus.SelectedValue);
                int auxUserAssigned = Convert.ToInt32(ddlUsers.SelectedValue);
                switch (saveType)
                {
                case 1:     //save
                    if (oTaskDetail.taskdetailsAdd(auxNewTaskDetail) > 0)
                    {
                        if (!oTasks.tasksUpdateStatus(Convert.ToInt32(txtTaskId.Text), auxTaskStatus))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Estado de Tarea...\n";
                        }

                        auxTasks = oTasks.tasksGetById(Convert.ToInt32(txtTaskId.Text));

                        if (!oEventsDetection.eventsdetectionUpdateStatus(auxTasks.EventsDetectionId, auxTaskStatus))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Estado del Evento de Intrusión...\n";
                        }

                        if (!oTasks.tasksUpdateUser(Convert.ToInt32(txtTaskId.Text), auxUserAssigned))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Usuario asignado a la Tarea...\n";
                        }

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

                case 2:     //update

                    if (Convert.ToInt32(hfTaskStatusOrigin.Value) != auxTaskStatus)
                    {
                        if (!oTasks.tasksUpdateStatus(Convert.ToInt32(txtTaskId.Text), auxTaskStatus))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Estado de Tarea...\n";
                        }

                        if (!oEventsDetection.eventsdetectionUpdateStatus(auxTasks.EventsDetectionId, auxTaskStatus))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Estado del Evento de Intrusión...\n";
                        }
                    }

                    if (Convert.ToInt32(hfUserOrigin.Value) != auxUserAssigned)
                    {
                        if (!oTasks.tasksUpdateUser(Convert.ToInt32(txtTaskId.Text), auxUserAssigned))
                        {
                            lblMessage.Text = "Imposible actualizar nuevo Usuario asignado a la Tarea...\n";
                        }
                    }

                    auxNewTaskDetail.TaskDetailsId = Convert.ToInt32(txtTaskDetailId.Text);

                    if (oTaskDetail.taskdetailsUpdate(auxNewTaskDetail))
                    {
                        lblMessage.Text = "Datos actualizados correctamente!";
                        clearFields();
                        activateFields(false, true);
                        btnSave.Enabled = false;
                        getTaskDetailsData(TaskId);
                        lblMessage.Text = "Datos actualizados correctamente!";
                    }
                    else
                    {
                        lblMessage.Text = "Error al guardar los datos!";
                    }
                    break;
                }
            }
            else
            {
                lblMessage.Text = "Datos requeridos no cargados...";
            }
        }
コード例 #4
0
        protected void gvTaskDetails_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvTaskDetails.SelectedRow;

            tasks    auxTask = new tasks();
            tasksBus oTask   = new tasksBus();

            if ((Label)row.FindControl("taskDetailsId") != null)
            {
                txtTaskDetailId.Text = ((Label)row.FindControl("taskDetailsId")).Text;
            }
            else
            {
                txtTaskDetailId.Text = "";
            }
            if ((Label)row.FindControl("datetime") != null)
            {
                txtDateTime.Text = ((Label)row.FindControl("datetime")).Text;
            }
            else
            {
                txtDateTime.Text = "";
            }
            if ((Label)row.FindControl("effortHours") != null)
            {
                txtEffortHours.Text = ((Label)row.FindControl("effortHours")).Text;
            }
            else
            {
                txtEffortHours.Text = "";
            }
            if ((Label)row.FindControl("taskDetails") != null)
            {
                txtDetail.Text = ((Label)row.FindControl("taskDetails")).Text;
            }
            else
            {
                txtDetail.Text = "";
            }
            if ((Label)row.FindControl("taskId") != null)
            {
                txtTaskId.Text = ((Label)row.FindControl("taskId")).Text;
            }
            else
            {
                txtTaskId.Text = "";
            }

            try
            {
                auxTask = oTask.tasksGetById(Convert.ToInt32(txtTaskId.Text));
                ddlTaskStatus.SelectedValue = auxTask.TaskStatudId.ToString();
                ddlUsers.SelectedValue      = auxTask.UserId.ToString();

                hfTaskStatusOrigin.Value = auxTask.TaskStatudId.ToString();
                hfUserOrigin.Value       = auxTask.UserId.ToString();
            }
            catch
            {
            }

            activateFields(true, false);
            btnSave.Enabled = true;
        }
コード例 #5
0
        private void getTasksData()
        {
            DataTable dttTasks = new DataTable();

            dttTasks.Columns.Add(new DataColumn("taskId", System.Type.GetType("System.Int32")));
            dttTasks.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
            dttTasks.Columns.Add(new DataColumn("taskTittle", System.Type.GetType("System.String")));
            dttTasks.Columns.Add(new DataColumn("eventsDetectionId", System.Type.GetType("System.Int32")));
            dttTasks.Columns.Add(new DataColumn("taskStatusId", System.Type.GetType("System.Int32")));
            dttTasks.Columns.Add(new DataColumn("statusDescription", System.Type.GetType("System.String")));
            dttTasks.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttTasks.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttTasks.Columns.Add(new DataColumn("serverityId", System.Type.GetType("System.Int32")));
            dttTasks.Columns.Add(new DataColumn("sererityDescription", System.Type.GetType("System.String")));
            dttTasks.Columns.Add(new DataColumn("SLAStatus", System.Type.GetType("System.String")));

            List <tasks>       lstTasks         = new List <tasks>();
            tasksBus           oTasks           = new tasksBus();
            eventsdetectionBus oEventsDetection = new eventsdetectionBus();
            idsBus             oIDPS            = new idsBus();
            eventsalarmBus     oEventsAlarm     = new eventsalarmBus();
            severityBus        oSeverity        = new severityBus();
            taskstatusBus      oTaskStatus      = new taskstatusBus();
            usersBus           oUsers           = new usersBus();

            lstTasks = oTasks.tasksGetAll();

            if (lstTasks.Count > 0)
            {
                foreach (tasks row in lstTasks)
                {
                    if (row.TaskStatudId == 2 || row.TaskStatudId == 5) //Closed, Rejected
                    {
                        continue;
                    }

                    taskstatus      auxStatus         = new taskstatus();
                    users           auxUser           = new users();
                    eventsdetection auxEventDetection = new eventsdetection();
                    eventsalarm     auxEventAlarm     = new eventsalarm();
                    severity        auxSeverity       = new severity();
                    string          SLASatus          = "";

                    auxStatus         = oTaskStatus.taskstatusGetById(row.TaskStatudId);
                    auxUser           = oUsers.usersGetById(row.UserId);
                    auxEventDetection = oEventsDetection.eventsdetectionGetById(row.EventsDetectionId);
                    auxEventAlarm     = oEventsAlarm.eventsalarmGetById(auxEventDetection.EventsAlarmId);
                    auxSeverity       = oSeverity.severityGetById(auxEventAlarm.Severity);

                    DateTime deadTime = row.DateTime;
                    deadTime.AddMinutes(auxSeverity.SLATimeToResponse);
                    if (DateTime.Now > deadTime)
                    {
                        SLASatus = "Vencido";
                    }
                    if (DateTime.Now < deadTime)
                    {
                        SLASatus = "En término";
                    }

                    dttTasks.Rows.Add(row.TaskId,
                                      row.DateTime,
                                      row.TaskTittle,
                                      row.EventsDetectionId,
                                      row.TaskStatudId,
                                      auxStatus.TaskStatusDescription,
                                      row.UserId,
                                      auxUser.UserName,
                                      auxEventAlarm.Severity,
                                      auxSeverity.SeverityDescription,
                                      SLASatus);
                }

                gvTasks.DataSource = dttTasks;
                gvTasks.DataBind();
            }
        }
コード例 #6
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSearch.Text))
            {
                DataTable dttTasks = new DataTable();
                dttTasks.Columns.Add(new DataColumn("taskId", System.Type.GetType("System.Int32")));
                dttTasks.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
                dttTasks.Columns.Add(new DataColumn("taskTittle", System.Type.GetType("System.String")));
                dttTasks.Columns.Add(new DataColumn("eventsDetectionId", System.Type.GetType("System.Int32")));
                dttTasks.Columns.Add(new DataColumn("taskStatusId", System.Type.GetType("System.Int32")));
                dttTasks.Columns.Add(new DataColumn("statusDescription", System.Type.GetType("System.String")));
                dttTasks.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
                dttTasks.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
                dttTasks.Columns.Add(new DataColumn("serverityId", System.Type.GetType("System.Int32")));
                dttTasks.Columns.Add(new DataColumn("sererityDescription", System.Type.GetType("System.String")));
                dttTasks.Columns.Add(new DataColumn("SLAStatus", System.Type.GetType("System.String")));

                tasks              auxtTasks        = new tasks();
                tasksBus           oTasks           = new tasksBus();
                eventsdetectionBus oEventsDetection = new eventsdetectionBus();
                idsBus             oIDPS            = new idsBus();
                eventsalarmBus     oEventsAlarm     = new eventsalarmBus();
                severityBus        oSeverity        = new severityBus();
                taskstatusBus      oTaskStatus      = new taskstatusBus();
                usersBus           oUsers           = new usersBus();

                auxtTasks = oTasks.tasksGetById(Convert.ToInt32(txtSearch.Text));

                if (auxtTasks != null)
                {
                    taskstatus      auxStatus         = new taskstatus();
                    users           auxUser           = new users();
                    eventsdetection auxEventDetection = new eventsdetection();
                    eventsalarm     auxEventAlarm     = new eventsalarm();
                    severity        auxSeverity       = new severity();

                    auxStatus         = oTaskStatus.taskstatusGetById(auxtTasks.TaskStatudId);
                    auxUser           = oUsers.usersGetById(auxtTasks.UserId);
                    auxEventDetection = oEventsDetection.eventsdetectionGetById(auxtTasks.EventsDetectionId);
                    auxEventAlarm     = oEventsAlarm.eventsalarmGetById(auxEventDetection.EventsAlarmId);
                    auxSeverity       = oSeverity.severityGetById(auxEventAlarm.Severity);

                    //resolver SLAStatus

                    dttTasks.Rows.Add(auxtTasks.TaskId,
                                      auxtTasks.DateTime,
                                      auxtTasks.TaskTittle,
                                      auxtTasks.EventsDetectionId,
                                      auxtTasks.TaskStatudId,
                                      auxStatus.TaskStatusDescription,
                                      auxtTasks.UserId,
                                      auxUser.UserName,
                                      auxEventAlarm.Severity,
                                      auxSeverity.SeverityDescription,
                                      "");

                    gvTasks.DataSource = dttTasks;
                    gvTasks.DataBind();
                }
                else
                {
                    lblMessage.Text = "Busqueda sin resultados...";
                }
            }
        }
コード例 #7
0
        void tmrChecks_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
            culture.DateTimeFormat.LongTimePattern  = "";
            Thread.CurrentThread.CurrentCulture     = culture;

            DataTable          dttResult        = new DataTable();
            libIDPSWatcherImpl libIDPS          = new libIDPSWatcherImpl();
            eventsdetectionBus oEventsDetection = new eventsdetectionBus();
            tasksBus           oTask            = new tasksBus();
            int newEventDetectionId;
            int counter;

            dttResult = libIDPS.getIDPSData();

            if (dttResult.Rows.Count > 0)
            {
                counter = 0;

                foreach (DataRow row in dttResult.Rows)
                {
                    DateTime dateTime = new DateTime();

                    if (String.IsNullOrEmpty(row[3].ToString()))
                    {
                        dateTime = DateTime.Now;
                    }
                    else
                    {
                        dateTime = DateTime.Parse(row[3].ToString());
                    }

                    //DateTime.ParseExact(row[3].ToString(), "yyyy/MM/dd", CultureInfo.InvariantCulture);
                    newEventDetectionId = 0;
                    eventsdetection newEventDetection = new eventsdetection();
                    newEventDetection.IdsId         = Convert.ToInt32(row[0].ToString());
                    newEventDetection.EventsAlarmId = Convert.ToInt32(row[1].ToString());
                    newEventDetection.IDPSEventId   = Convert.ToInt32(row[2].ToString());
                    newEventDetection.DateTime      = dateTime;
                    newEventDetection.EventStatus   = 1;
                    newEventDetectionId             = oEventsDetection.eventsdetectionAdd(newEventDetection);

                    if (newEventDetectionId > 0)
                    {
                        tasks newTask = new tasks();
                        newTask.TaskStatudId = 1;
                        newTask.DateTime     = dateTime;
                        newTask.UserId       = 0;
                        if (row[4].ToString().Length > 49)
                        {
                            newTask.TaskTittle = row[4].ToString().Substring(0, 49);
                        }
                        else
                        {
                            newTask.TaskTittle = row[4].ToString();
                        }
                        newTask.EventsDetectionId = newEventDetectionId;

                        if (oTask.tasksAdd(newTask) > 0)
                        {
                            counter++;
                            lblCount.Text = counter.ToString();
                        }
                    }
                }

                lblTimeStamp.Text = DateTime.Now.ToString();
            }
        }
コード例 #8
0
        protected void getEventsDetectionData()
        {
            DataTable dttEventsDetection = new DataTable();

            dttEventsDetection.Columns.Add(new DataColumn("eventsDetectionId", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
            dttEventsDetection.Columns.Add(new DataColumn("eventStauts", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("eventStatusDescription", System.Type.GetType("System.String")));
            dttEventsDetection.Columns.Add(new DataColumn("IDSId", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("IDPS", System.Type.GetType("System.String")));
            dttEventsDetection.Columns.Add(new DataColumn("idsName", System.Type.GetType("System.String")));
            dttEventsDetection.Columns.Add(new DataColumn("eventsAlarmId", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("severityId", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("severityDescription", System.Type.GetType("System.String")));
            dttEventsDetection.Columns.Add(new DataColumn("SLATimeToResponse", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("TaskId", System.Type.GetType("System.Int32")));
            dttEventsDetection.Columns.Add(new DataColumn("IDPSEventId", System.Type.GetType("System.Int32")));

            List <eventsdetection> lstEvetnsDetection = new List <eventsdetection>();
            eventsdetectionBus     oEventsDetection   = new eventsdetectionBus();

            idsBus         oIDPS        = new idsBus();
            eventsalarmBus oEventsAlarm = new eventsalarmBus();
            severityBus    oSeverity    = new severityBus();
            tasksBus       oTask        = new tasksBus();
            taskstatusBus  oTaskStatus  = new taskstatusBus();

            lstEvetnsDetection = oEventsDetection.eventsdetectionGetAll();

            if (lstEvetnsDetection.Count > 0)
            {
                foreach (eventsdetection row in lstEvetnsDetection)
                {
                    if (row.EventStatus == 2 || row.EventStatus == 5) //Closed, Rejected
                    {
                        continue;
                    }

                    ids         auxIDPS       = new ids();
                    eventsalarm auxEventAlarm = new eventsalarm();
                    severity    auxSeverity   = new severity();
                    tasks       auxTask       = new tasks();
                    taskstatus  auxTaskStatus = new taskstatus();

                    auxIDPS       = oIDPS.idsGetById(row.IdsId);
                    auxEventAlarm = oEventsAlarm.eventsalarmGetById(row.EventsAlarmId);
                    auxSeverity   = oSeverity.severityGetById(auxEventAlarm.Severity);
                    auxTask       = oTask.tasksGetByEventsDetectionId(row.EventsDetectionId);
                    auxTaskStatus = oTaskStatus.taskstatusGetById(row.EventStatus);

                    dttEventsDetection.Rows.Add(row.EventsDetectionId,
                                                row.DateTime,
                                                row.EventStatus,
                                                auxTaskStatus.TaskStatusDescription,
                                                row.IdsId,
                                                auxIDPS.IdsIP,
                                                auxIDPS.idsName,
                                                row.EventsAlarmId,
                                                auxSeverity.SeverityId,
                                                auxSeverity.SeverityDescription,
                                                auxSeverity.SLATimeToResponse,
                                                auxTask.TaskId,
                                                row.IDPSEventId);
                }

                gvEventsDetection.DataSource = dttEventsDetection;
                gvEventsDetection.DataBind();
            }
        }
コード例 #9
0
        protected void generateBarChartUsers()
        {
            DataTable dttTaskByUser = new DataTable();

            dttTaskByUser.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttTaskByUser.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttTaskByUser.Columns.Add(new DataColumn("Quantity", System.Type.GetType("System.Int32")));

            List <users> lstUsers = new List <users>();
            usersBus     oUsers   = new usersBus();

            List <tasks> lstTasks = new List <tasks>();
            tasksBus     oTask    = new tasksBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                foreach (users rowUser in lstUsers)
                {
                    int qtyTask = 0;
                    if (Convert.ToBoolean(rowUser.UserActive))
                    {
                        lstTasks = oTask.tasksGetAll();
                        foreach (tasks rowTask in lstTasks)
                        {
                            if (rowTask.UserId == rowUser.UserId)
                            {
                                if (rowTask.TaskStatudId != 2)     //Closed
                                {
                                    if (rowTask.TaskStatudId != 5) //Rejected
                                    {
                                        qtyTask++;
                                    }
                                }
                            }
                        }

                        dttTaskByUser.Rows.Add(rowUser.UserId, rowUser.UserName, qtyTask);
                    }
                }
            }

            //Task without User
            int qtyWithoutUser = 0;

            lstTasks = oTask.tasksGetAll();
            if (lstTasks.Count > 0)
            {
                foreach (tasks row in lstTasks)
                {
                    if (row.UserId < 1)
                    {
                        qtyWithoutUser++;
                    }
                }

                if (qtyWithoutUser > 0)
                {
                    dttTaskByUser.Rows.Add(0, "No asignado", qtyWithoutUser);
                }
            }

            barChartUsers.Series[0].XValueMember  = "userName";
            barChartUsers.Series[0].YValueMembers = "Quantity";
            barChartUsers.DataSource = dttTaskByUser;
            barChartUsers.DataBind();
        }
コード例 #10
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtSearch.Text))
            {
                DataTable dttEventsDetection = new DataTable();
                dttEventsDetection.Columns.Add(new DataColumn("eventsDetectionId", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
                dttEventsDetection.Columns.Add(new DataColumn("eventStauts", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("eventStatusDescription", System.Type.GetType("System.String")));
                dttEventsDetection.Columns.Add(new DataColumn("IDSId", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("IDPS", System.Type.GetType("System.String")));
                dttEventsDetection.Columns.Add(new DataColumn("idsName", System.Type.GetType("System.String")));
                dttEventsDetection.Columns.Add(new DataColumn("eventsAlarmId", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("severityId", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("severityDescription", System.Type.GetType("System.String")));
                dttEventsDetection.Columns.Add(new DataColumn("SLATimeToResponse", System.Type.GetType("System.Int32")));
                dttEventsDetection.Columns.Add(new DataColumn("TaskId", System.Type.GetType("System.Int32")));

                eventsdetection    auxEvetnsDetection = new eventsdetection();
                eventsdetectionBus oEventsDetection   = new eventsdetectionBus();

                idsBus         oIDPS        = new idsBus();
                eventsalarmBus oEventsAlarm = new eventsalarmBus();
                severityBus    oSeverity    = new severityBus();
                tasksBus       oTask        = new tasksBus();

                auxEvetnsDetection = oEventsDetection.eventsdetectionGetById(Convert.ToInt32(txtSearch.Text));

                if (auxEvetnsDetection != null)
                {
                    string      strStatus     = "";
                    ids         auxIDPS       = new ids();
                    eventsalarm auxEventAlarm = new eventsalarm();
                    severity    auxSeverity   = new severity();
                    tasks       auxTask       = new tasks();

                    switch (auxEvetnsDetection.EventStatus)
                    {
                    case 1: strStatus = "Pendiente"; break;

                    case 2: strStatus = "En tratamiento"; break;

                    case 3: strStatus = "Cerrado"; break;
                    }

                    auxIDPS       = oIDPS.idsGetById(auxEvetnsDetection.IdsId);
                    auxEventAlarm = oEventsAlarm.eventsalarmGetById(auxEvetnsDetection.EventsAlarmId);
                    auxSeverity   = oSeverity.severityGetById(auxEventAlarm.Severity);
                    auxTask       = oTask.tasksGetByEventsDetectionId(auxEvetnsDetection.EventsDetectionId);

                    dttEventsDetection.Rows.Add(auxEvetnsDetection.EventsDetectionId,
                                                auxEvetnsDetection.DateTime,
                                                auxEvetnsDetection.EventStatus,
                                                strStatus,
                                                auxEvetnsDetection.IdsId,
                                                auxIDPS.IdsIP,
                                                auxIDPS.idsName,
                                                auxEvetnsDetection.EventsAlarmId,
                                                auxSeverity.SeverityId,
                                                auxSeverity.SeverityDescription,
                                                auxSeverity.SLATimeToResponse,
                                                auxTask.TaskId);

                    gvEventsDetection.DataSource = dttEventsDetection;
                    gvEventsDetection.DataBind();
                }
                else
                {
                    lblMessage.Text = "Busqueda sin resultados...";
                }
            }
        }