public List<userroles> userrolesGetAll()
 {
     List<userroles> lstuserroles = new List<userroles>();
     try
     {
         DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "userrolesGetAll").Tables[0];
         if (dt.Rows.Count > 0)
         {
             int colUserRoleId =  dt.Columns["UserRoleId"].Ordinal;
             int colUserRoleDescription =  dt.Columns["UserRoleDescription"].Ordinal;
             for (int i = 0; dt.Rows.Count > i; i++)
             {
                 userroles NewEnt = new userroles();
                 NewEnt.UserRoleId = Int32.Parse(dt.Rows[i].ItemArray[colUserRoleId].ToString());
                 NewEnt.UserRoleDescription = dt.Rows[i].ItemArray[colUserRoleDescription].ToString();
                 lstuserroles.Add(NewEnt);
             }
         }
         return lstuserroles;
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
 public int userrolesAdd( userroles userroles)
 {
     try
     {
         return (int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "userrolesAdd",
                                                                                 userroles.UserRoleDescription);
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
        public userroles userrolesGetById(int UserRoleId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "userrolesGetById",
                                                                                                    UserRoleId).Tables[0];
                userroles NewEnt = new userroles();

                if(dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.UserRoleId = Int32.Parse(dr["UserRoleId"].ToString());
                    NewEnt.UserRoleDescription = dr["UserRoleDescription"].ToString();
                }
                return NewEnt;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
 public bool userrolesUpdate( userroles userroles)
 {
     try
     {
         int update = SqlHelper.ExecuteNonQuery(SqlImplHelper.getConnectionString(), "userrolesUpdate",
                                                                                     userroles.UserRoleId,
                                                                                     userroles.UserRoleDescription);
         if (update > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
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;
        }
Esempio n. 6
0
        protected void ddlUserGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            List<userrolesmapping> lstGroupRolesMapping = new List<userrolesmapping>();
            userrolesmappingBus oRolesMapping = new userrolesmappingBus();

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

            cblRolesRoles.Items.Clear();
            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++;
                }
            }
        }
 public bool userrolesUpdate(userroles userroles)
 {
     userrolesImpl ouserrolesImpl = new userrolesImpl();
     return ouserrolesImpl.userrolesUpdate( userroles);
 }
 public int userrolesAdd(userroles userroles)
 {
     userrolesImpl ouserrolesImpl = new userrolesImpl();
     return ouserrolesImpl.userrolesAdd( userroles);
 }