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(); }
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(); } }
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(); }