public static Struct_UserRole GetRoles()
        {
            Struct_UserRole roleList = new Struct_UserRole();
            LoginUser       currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    roleList.errorCode    = 1001;
                    roleList.errorMessage = "";
                    return(roleList);
                }

                AdminManagerSP adminObj = new AdminManagerSP();
                if (adminObj._U_GetRoles(currentUser.CompanyID, currentUser.UserId, out roleList))
                {
                    roleList.errorCode    = 0;
                    roleList.errorMessage = "";
                }
                else
                {
                    roleList.errorCode    = 1;
                    roleList.errorMessage = "Failed to get Role List. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(roleList);
        }
Example #2
0
        public static Struct_UserRole GetRolePermission(string RoleID)
        {
            Struct_UserRole rolePermission = new Struct_UserRole();
            LoginUser       currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    rolePermission.errorCode    = 1001;
                    rolePermission.errorMessage = "";
                    return(rolePermission);
                }

                AdminManagerSP adminObj = new AdminManagerSP();
                if (!adminObj._U_GetRolePermission(currentUser.CompanyID, currentUser.UserId, string.IsNullOrEmpty(RoleID) ? 0 : Convert.ToInt32(RoleID), out rolePermission))
                {
                    rolePermission.errorCode    = adminObj.GetLastErrorCode();
                    rolePermission.errorMessage = adminObj.GetLastError();
                }
            }
            catch (Exception ex)
            {
                rolePermission.errorCode    = -4;
                rolePermission.errorMessage = "Unknown Error Occured";
                Utils.Write(ex);
            }

            return(rolePermission);
        }