Пример #1
0
        // get groupObject row by objectName

        public GroupObject GetGObjByObjName(string objectName, List <GroupObject> GOList)
        {
            GroupObject element = new GroupObject();

            element = GOList.Where(X => X.objectName == objectName).FirstOrDefault();

            return(element);
        }
Пример #2
0
        public async Task <int> Save(GroupObject newObject)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = urimainpath + "Save";

            var myContent = JsonConvert.SerializeObject(newObject);

            parameters.Add("Object", myContent);
            return(await APIResult.post(method, parameters));
        }
Пример #3
0
        //

        public bool HasPermissionAction(string objectname, List <GroupObject> GOList, string type)
        {
            if (HelpClass.isAdminPermision())
            {
                return(true);
            }

            bool hasPermission = false;

            GroupObject groupObject = GetGObjByObjName(objectname, GOList);

            if (groupObject != null)
            {
                if (type == "add" && groupObject.addOb == 1)
                {
                    hasPermission = true;
                }
                else if (type == "update" && groupObject.updateOb == 1)
                {
                    hasPermission = true;
                }
                else if (type == "delete" && groupObject.deleteOb == 1)
                {
                    hasPermission = true;
                }
                else if (type == "show" && groupObject.showOb == 1)
                {
                    hasPermission = true;
                }
                else if (type == "report" && groupObject.reportOb == 1)
                {
                    hasPermission = true;
                }
                else if (type == "one" && groupObject.showOb == 1)
                {
                    hasPermission = true;
                }
            }

            return(hasPermission);
        }
Пример #4
0
        //

        public List <GroupObject> GetObjSons(string objectName, List <GroupObject> GOList)
        {
            objlist = new List <GroupObject>();
            List <GroupObject> opl = new List <GroupObject>();

            // objlist;
            GroupObject firstelement = new GroupObject();

            firstelement = GOList.Where(X => X.objectName == objectName).FirstOrDefault();
            //  firstelement.objectId = objectId;
            if (firstelement != null)
            {
                objlist.Add(firstelement);
                SonsofObject(objlist, GOList);
                return(objlist);
            }
            else
            {
                return(opl);
            }
        }
Пример #5
0
        public async Task <GroupObject> GetByID(int valId)
        {
            GroupObject item = new GroupObject();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Id", valId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetByID", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <GroupObject>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    });
                    break;
                }
            }
            return(item);
        }