private PxAuthorizationInfo getPxAuthorizationInfo(List <Authorization> pData) { PxAuthorizationInfo result = new PxAuthorizationInfo(); long tailYetkiNo = 0; string tailYetkiKod = null; int tailIzin = 0; foreach (Authorization a in pData) { PxResourceInfo resource = result.GetResource(a.VARLIKKOD); if (resource == null) { resource = this.createNewResource(a, ref tailYetkiNo, ref tailYetkiKod, ref tailIzin); result.AddResource(resource); } else { PxPermissionInfo perm = resource.GetPermission(string.IsNullOrEmpty(a.YETKIKOD) ? tailYetkiKod : a.YETKIKOD); if (perm == null) { perm = this.createNewPermission(a, ref tailYetkiNo, ref tailYetkiKod, ref tailIzin); } resource.AddPermission(perm); } } return(result); }
private PxResourceInfo createNewResource(Authorization pAuth, ref long pTailYetkiNo, ref string pTailYetkiKod, ref int pTailIzin) { PxResourceInfo resource = new PxResourceInfo(); resource = new PxResourceInfo(); resource.Code = pAuth.VARLIKKOD; resource.ID = pAuth.VARLIKNO; resource.Name = pAuth.VARLIKAD; resource.ParentID = pAuth.UST_VARLIKNO; resource.Permissions = new Dictionary <string, PxPermissionInfo>(); PxPermissionInfo perm = this.createNewPermission(pAuth, ref pTailYetkiNo, ref pTailYetkiKod, ref pTailIzin); resource.AddPermission(perm); return(resource); }