Exemplo n.º 1
0
 public ActionResult SelectRoles(string roleID)
 {
     try
     {
         int competencyID = (int)Session["competencyID"];
         ApplicableRolesViewModel applicablerole = new ApplicableRolesViewModel();
         string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);
         applicablerole.SearchedUserDetails = new SearchedUserDetails();
         CommonMethodsDAL Commondal = new CommonMethodsDAL();
         applicablerole.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role);
         ConfigurationDAL      configDAL     = new ConfigurationDAL();
         List <ApplicableRole> NewSelectRole = new List <ApplicableRole>();
         if (roleID != "")
         {
             string   roleIDWithcomma = roleID.TrimEnd(',');
             string[] roleidArray     = roleIDWithcomma.Split(',');
             int[]    myInts          = Array.ConvertAll(roleidArray, s => int.Parse(s));
             NewSelectRole = configDAL.getNewSelectRole(myInts, competencyID);
         }
         else
         {
             HRMSDBEntities dbContext = new HRMSDBEntities();
             NewSelectRole = (from e in dbContext.HRMS_tbl_PM_Role
                              orderby e.RoleDescription ascending
                              select new ApplicableRole
             {
                 CompetencyID = competencyID,
                 RoleID = e.RoleID,
                 Role = e.RoleDescription
             }).ToList();
         }
         applicablerole.ApplicableRoles = NewSelectRole;
         return(PartialView("_SelectRoles", applicablerole));
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public ActionResult ApplicableRoles(int?competencyID)
 {
     try
     {
         Session["competencyID"] = competencyID;
         var sessionCompetencyID = (int)Session["competencyID"];
         ApplicableRolesViewModel applicablerole = new ApplicableRolesViewModel();
         string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName);
         applicablerole.SearchedUserDetails = new SearchedUserDetails();
         CommonMethodsDAL Commondal = new CommonMethodsDAL();
         applicablerole.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role);
         ConfigurationDAL configDAL = new ConfigurationDAL();
         if (competencyID != null)
         {
             List <ApplicableRole> competencyRoleApplicability = configDAL.getApplicableRoles(competencyID);
             applicablerole.ApplicableRoles = competencyRoleApplicability;
         }
         return(PartialView("_ApplicableRoles", applicablerole));
     }
     catch
     {
         throw;
     }
 }