Esempio n. 1
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...";
                }
            }
        }
Esempio n. 2
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();
            }
        }
        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();
            }
        }
        protected void getTaskDetailsData(int taskId)
        {
            DataTable dttTaskDetails = new DataTable();
            dttTaskDetails.Columns.Add(new DataColumn("taskDetailsId", System.Type.GetType("System.Int32")));
            dttTaskDetails.Columns.Add(new DataColumn("taskId", System.Type.GetType("System.Int32")));
            dttTaskDetails.Columns.Add(new DataColumn("taskDetails", System.Type.GetType("System.String")));
            dttTaskDetails.Columns.Add(new DataColumn("datetime", System.Type.GetType("System.DateTime")));
            dttTaskDetails.Columns.Add(new DataColumn("effortHours", System.Type.GetType("System.Decimal")));
            dttTaskDetails.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttTaskDetails.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));

            List<taskdetails> lstTaskDetails = new List<taskdetails>();
            taskdetailsBus oTaskDetails = new taskdetailsBus();
            usersBus oUsers = new usersBus();

            lstTaskDetails = oTaskDetails.taskdetailsGetByTaskId(taskId);

            if (lstTaskDetails.Count > 0)
            {
                foreach (taskdetails row in lstTaskDetails)
                {
                    users auxUser = new users();
                    auxUser = oUsers.usersGetById(row.UserId);

                    dttTaskDetails.Rows.Add(row.TaskDetailsId,
                                            row.TaskId,
                                            row.Details,
                                            row.DateTime,
                                            row.EffortHours,
                                            row.UserId,
                                            auxUser.UserName);
                }

                gvTaskDetails.DataSource = dttTaskDetails;
                gvTaskDetails.DataBind();
            }
        }
Esempio n. 5
0
        protected void gvUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvUsers.SelectedRow;

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

            List<userrolesmapping> lstGroupRolesMapping = new List<userrolesmapping>();
            userrolesmappingBus oRolesMapping = new userrolesmappingBus();

            userroles auxRol = new userroles();
            userrolesBus oRoles = new userrolesBus();

            try
            {
                ddlUserGroup.SelectedValue = ((Label)row.FindControl("userGroupId")).Text;
            }
            catch
            {

            }

            if ((Label)row.FindControl("userId") != null) { userId.Value = ((Label)row.FindControl("userId")).Text; } else { userId.Value = ""; }
            if ((Label)row.FindControl("userName") != null) { txtUserName.Text = ((Label)row.FindControl("userName")).Text; } else { txtUserName.Text = ""; }
            if ((Label)row.FindControl("userLastName") != null) { txtUserLastName.Text = ((Label)row.FindControl("userLastName")).Text; } else { txtUserLastName.Text = ""; }
            if ((Label)row.FindControl("userFirstName") != null) { txtUserFirstName.Text = ((Label)row.FindControl("userFirstName")).Text; } else { txtUserFirstName.Text = ""; }
            if ((CheckBox)row.FindControl("userActive") != null) { chkActive.Checked = ((CheckBox)row.FindControl("userActive")).Checked; } else { chkActive.Checked = false; }

            auxUser = oUser.usersGetById(Convert.ToInt32(userId.Value));
            txtMail.Text = auxUser.UserMail;
            txtPassword.Text = auxUser.UserPassword;
            txtSMS.Text = auxUser.UserSMSNumber;

            cblRolesRoles.Items.Clear();
            lstGroupRolesMapping = oRolesMapping.userrolesmappingGetByUserGroupId(Convert.ToInt32(ddlUserGroup.SelectedValue));
            if (lstGroupRolesMapping.Count > 0)
            {
                int index = 0;
                foreach (userrolesmapping rowRolMapping in lstGroupRolesMapping)
                {
                    auxRol = oRoles.userrolesGetById(rowRolMapping.UserRoleId);
                    cblRolesRoles.Items.Add(auxRol.UserRoleDescription);
                    cblRolesRoles.Items[index].Selected = true;
                    index++;
                }
            }

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