private Guid?GetExistingRoleId() { var roles = CrmSvc.GetEntityDataBySearchParams("role", new List <CrmServiceClient.CrmSearchFilter> { new CrmServiceClient.CrmSearchFilter { SearchConditions = new List <CrmServiceClient.CrmFilterConditionItem> { new CrmServiceClient.CrmFilterConditionItem { FieldName = "name", FieldOperator = ConditionOperator.Equal, FieldValue = ProposalManagerApplicationName } } } }, CrmServiceClient.LogicalSearchOperator.None, new List <string> { "roleid" }); if (roles != null) { return(roles.Any() ? (Guid?)roles.First().Value["roleid"] : null); } else { return(null); } }
private Guid GetIdByName(string entityName, string recordName) => (Guid)CrmSvc.GetEntityDataBySearchParams(entityName, new List <CrmServiceClient.CrmSearchFilter> { new CrmServiceClient.CrmSearchFilter { SearchConditions = new List <CrmServiceClient.CrmFilterConditionItem> { new CrmServiceClient.CrmFilterConditionItem { FieldName = "name", FieldOperator = ConditionOperator.Equal, FieldValue = recordName } } } }, CrmServiceClient.LogicalSearchOperator.None, new List <string> { $"{entityName}id" }).Single().Value[$"{entityName}id"];
private Dictionary <string, Dictionary <string, object> > GetPrivilegeRecords() => CrmSvc.GetEntityDataBySearchParams("privilege", new List <CrmServiceClient.CrmSearchFilter> { new CrmServiceClient.CrmSearchFilter { FilterOperator = LogicalOperator.Or, SearchConditions = ( from rp in RequiredPrivileges select new CrmServiceClient.CrmFilterConditionItem { FieldName = "name", FieldOperator = ConditionOperator.Equal, FieldValue = rp.Key } ).ToList() } }, CrmServiceClient.LogicalSearchOperator.None, new List <string> { "privilegeid", "name" });
private Guid?GetExistingUser() { var users = CrmSvc.GetEntityDataBySearchParams("systemuser", new List <CrmServiceClient.CrmSearchFilter> { new CrmServiceClient.CrmSearchFilter { SearchConditions = new List <CrmServiceClient.CrmFilterConditionItem> { new CrmServiceClient.CrmFilterConditionItem { FieldName = "applicationid", FieldOperator = ConditionOperator.Equal, FieldValue = ProposalManagerApplicationId.Value } } } }, CrmServiceClient.LogicalSearchOperator.None, new List <string> { "systemuserid" }); if (users != null) { if (users.Any()) { PackageLog.Log("PM user already created. Id: " + users.First().Value["systemuserid"].ToString()); return((Guid?)users.First().Value["systemuserid"]); } else { return(null); } } else { return(null); } }