Exemplo n.º 1
0
        protected void _Login_Authenticate(object sender, AuthenticateEventArgs e)
        {
            users auxUser = new users();
            usersBus oUser = new usersBus();
            auxUser = oUser.usersGetByUserName(_Login.UserName);

            string hashPwd = Services.Utility.ResumeSHA1(_Login.Password);

            if (auxUser != null)
            {
                if (String.Compare(hashPwd, auxUser.UserPassword) == 0)
                    FormsAuthentication.RedirectFromLoginPage(_Login.UserName, _Login.RememberMeSet);
            }
        }
Exemplo n.º 2
0
 public int usersAdd( users users)
 {
     try
     {
         return (int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "usersAdd",
                                                                                 users.UserGroupId,
                                                                                 users.UserName,
                                                                                 users.UserFirstName,
                                                                                 users.UserLastName,
                                                                                 users.UserMail,
                                                                                 users.UserSMSNumber,
                                                                                 users.UserPassword,
                                                                                 users.UserActive);
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public List<users> usersGetAll()
 {
     List<users> lstusers = new List<users>();
     try
     {
         DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "usersGetAll").Tables[0];
         if (dt.Rows.Count > 0)
         {
             int colUserId =  dt.Columns["UserId"].Ordinal;
             int colUserGroupId =  dt.Columns["UserGroupId"].Ordinal;
             int colUserName =  dt.Columns["UserName"].Ordinal;
             int colUserFirstName =  dt.Columns["UserFirstName"].Ordinal;
             int colUserLastName =  dt.Columns["UserLastName"].Ordinal;
             int colUserMail =  dt.Columns["UserMail"].Ordinal;
             int colUserSMSNumber =  dt.Columns["UserSMSNumber"].Ordinal;
             int colUserPassword =  dt.Columns["UserPassword"].Ordinal;
             int colUserActive =  dt.Columns["UserActive"].Ordinal;
             for (int i = 0; dt.Rows.Count > i; i++)
             {
                 users NewEnt = new users();
                 NewEnt.UserId = Int32.Parse(dt.Rows[i].ItemArray[colUserId].ToString());
                 NewEnt.UserGroupId = Int32.Parse(dt.Rows[i].ItemArray[colUserGroupId].ToString());
                 NewEnt.UserName = dt.Rows[i].ItemArray[colUserName].ToString();
                 NewEnt.UserFirstName = dt.Rows[i].ItemArray[colUserFirstName].ToString();
                 NewEnt.UserLastName = dt.Rows[i].ItemArray[colUserLastName].ToString();
                 NewEnt.UserMail = dt.Rows[i].ItemArray[colUserMail].ToString();
                 NewEnt.UserSMSNumber = dt.Rows[i].ItemArray[colUserSMSNumber].ToString();
                 NewEnt.UserPassword = dt.Rows[i].ItemArray[colUserPassword].ToString();
                 NewEnt.UserActive = sbyte.Parse(dt.Rows[i].ItemArray[colUserActive].ToString());
                 lstusers.Add(NewEnt);
             }
         }
         return lstusers;
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
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...";
                }
            }
        }
Exemplo n.º 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();
            }
        }
        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...";
            }
        }
        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();
            }
        }
        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();
            }
        }
Exemplo n.º 9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            users auxNewUser = new users();
            usersBus oUsers = new usersBus();

            bool needRequiredFields = false;
            int saveType = 0;

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

            if (String.IsNullOrEmpty(txtUserName.Text)) needRequiredFields = true;
            if (String.IsNullOrEmpty(txtUserLastName.Text)) needRequiredFields = true;
            if (String.IsNullOrEmpty(txtUserFirstName.Text)) needRequiredFields = true;
            if (String.IsNullOrEmpty(txtPassword.Text)) needRequiredFields = true;
            if (String.IsNullOrEmpty(txtMail.Text)) needRequiredFields = true;

            if (!needRequiredFields)
            {
                auxNewUser.UserName = txtUserName.Text;
                auxNewUser.UserFirstName = txtUserFirstName.Text;
                auxNewUser.UserLastName = txtUserLastName.Text;
                auxNewUser.UserMail = txtMail.Text;
                auxNewUser.UserPassword = txtPassword.Text;
                auxNewUser.UserActive = Convert.ToSByte(chkActive.Checked);
                auxNewUser.UserSMSNumber = txtSMS.Text;
                auxNewUser.UserGroupId = Convert.ToInt32(ddlUserGroup.SelectedValue);

                switch (saveType)
                {
                    case 1: //save
                        if (oUsers.usersAdd(auxNewUser)> 0)
                        {
                            lblMessage.Text = "Datos guardados correctamente!";
                            clearFields();
                            activateFields(false, true);
                            btnNew.Enabled = true;
                            getUsersData();
                        }
                        else
                            lblMessage.Text = "Error al guardar los datos!";
                        break;
                    case 2: //update
                        auxNewUser.UserId = Convert.ToInt32(userId.Value);
                        if (oUsers.usersUpdate(auxNewUser))
                        {
                            lblMessage.Text = "Datos actualizados correctamente!";
                            clearFields();
                            activateFields(false, true);
                            btnSave.Enabled = false;
                            getUsersData();
                        }
                        else
                            lblMessage.Text = "Error al guardar los datos!";
                        break;
                }
            }
            else
            {
                lblMessage.Text = "Error, existen campos sin completar!";
            }
        }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
0
        public users usersGetById(int UserId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "usersGetById",
                                                                                        UserId).Tables[0];
                users NewEnt = new users();

                if(dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.UserId = Int32.Parse(dr["UserId"].ToString());
                    NewEnt.UserGroupId = Int32.Parse(dr["UserGroupId"].ToString());
                    NewEnt.UserName = dr["UserName"].ToString();
                    NewEnt.UserFirstName = dr["UserFirstName"].ToString();
                    NewEnt.UserLastName = dr["UserLastName"].ToString();
                    NewEnt.UserMail = dr["UserMail"].ToString();
                    NewEnt.UserSMSNumber = dr["UserSMSNumber"].ToString();
                    NewEnt.UserPassword = dr["UserPassword"].ToString();
                    NewEnt.UserActive = sbyte.Parse(dr["UserActive"].ToString());
                }
                return NewEnt;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 12
0
 public bool usersUpdate( users users)
 {
     try
     {
         int update = (int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "usersUpdate",
                                                                                     users.UserId,
                                                                                     users.UserGroupId,
                                                                                     users.UserName,
                                                                                     users.UserFirstName,
                                                                                     users.UserLastName,
                                                                                     users.UserMail,
                                                                                     users.UserSMSNumber,
                                                                                     users.UserPassword,
                                                                                     users.UserActive);
         if (update > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 13
0
 public bool usersUpdate(users users)
 {
     usersImpl ousersImpl = new usersImpl();
     return ousersImpl.usersUpdate( users);
 }
Exemplo n.º 14
0
 public int usersAdd(users users)
 {
     usersImpl ousersImpl = new usersImpl();
     return ousersImpl.usersAdd( users);
 }