예제 #1
0
        public ResponseModel GetRolesByUserID()
        {
            ResponseModel objResponseModel        = new ResponseModel();
            CRMRoleModel  objCRMRoleResponseModel = new CRMRoleModel();
            int           statusCode    = 0;
            string        statusMessage = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token));

                SettingsCaller newCRM = new SettingsCaller();
                objCRMRoleResponseModel = newCRM.GetCRMRoleByUserID(new CRMRoleService(Cache, Db), authenticate.TenantId, authenticate.UserMasterID);

                statusCode = objCRMRoleResponseModel == null ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = objCRMRoleResponseModel;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }