Пример #1
0
 public bool CheckIsAdminUser(string Email)
 {
     try
     {
         string     query      = "?Email=" + HttpUtility.UrlEncode(Email);
         AdminUsers adminUsers = CABusinessProjectTrackingAPIClient.GetHttpResponse <AdminUsers>(query, CABPTMethodConstants.CheckIsAdmin);
         if (adminUsers.IsActive == false)
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
        public static List <oMenuAccess> getRoleAccessbyEmailID(string EmailID)
        {
            List <RolesAccess> accessList = null;

            List <MenuAccess>  menuList = null;
            List <oMenuAccess> authobj  = null;


            string query = "?Email=" + HttpUtility.UrlEncode(EmailID);

            accessList = CABusinessProjectTrackingAPIClient.GetHttpResponse <List <RolesAccess> >(query, CABPTMethodConstants.ROLEMENUMAPPING);

            if (accessList != null)
            {
                for (int i = 0; i < accessList.Count; i++)
                {
                    if (accessList[i].roleid == accessList[i].levelid)
                    {
                        HttpCookie roleCookie = new HttpCookie("AUTH_PTPR");
                        roleCookie.Value = accessList[i].projectId.ToString();
                        HttpCookie roleCookie_ = new HttpCookie("RoleID");
                        roleCookie_.Value = accessList[i].roleid.ToString();
                        //roleCookie.Values.Add("R", accessList[i].projectId.ToString());
                        roleCookie.Expires = DateTime.Now.AddDays(1d);
                        HttpContext.Current.Response.Cookies.Add(roleCookie);
                        HttpCookie menuCookie = new HttpCookie("AUTH_PT" + accessList[i].projectId);
                        menuList = accessList[i].AccessList;
                        for (int j = 0; j < menuList.Count; j++)
                        {
                            menuCookie.Values.Add(menuList[j].MenuId.ToString(), Convert.ToBoolean(menuList[j].roAccessgrant).ToString());
                        }
                        menuCookie.Expires = DateTime.Now.AddDays(1d);
                        HttpContext.Current.Response.Cookies.Add(menuCookie);

                        authobj = new List <oMenuAccess>();
                        authobj = JsonConvert.DeserializeObject <List <oMenuAccess> >(JsonConvert.SerializeObject(accessList[i].AccessList));
                    }
                }
            }
            return(authobj);
        }