internal void ResolveNavigationProperties(biz.dfch.CS.Appclusive.Api.Core.Core coreRepository) { Contract.Requires(null != coreRepository); // Permission if (this.PermissionId > 0) { Api.Core.Permission permission = coreRepository.Permissions .Where(j => j.Id == this.PermissionId) .FirstOrDefault(); Contract.Assert(null != permission, "no permission available"); this.Permission = AutoMapper.Mapper.Map<Permission>(permission); } // Trustee if (this.TrusteeId > 0) { if (TrusteeType == TrusteeTypeEnum.Role.GetHashCode()) { Api.Core.Role role = coreRepository.Roles .Where(j => j.Id == this.TrusteeId) .FirstOrDefault(); Contract.Assert(null != role, "no role available"); this.Trustee = AutoMapper.Mapper.Map<Role>(role); } else { Api.Core.User user = coreRepository.Users .Where(j => j.Id == this.TrusteeId) .FirstOrDefault(); Contract.Assert(null != user, "no user available"); this.Trustee = AutoMapper.Mapper.Map<User>(user); } } }
public static void ResolveReferencedEntityName(this IEntityReference entity, biz.dfch.CS.Appclusive.Api.Core.Core coreRepository) { try { if (entity.EntityId > 0 && null != entity.EntityKind && null != entity.EntityKind.EntityType) { string uriStr = Properties.Settings.Default.AppclusiveApiBaseUrl + "Core/{0}s()?$filter=Id%20eq%20{1}L"; Uri requestUri = new Uri(string.Format(uriStr, entity.EntityKind.EntityType.Name, entity.EntityId)); // call Generic execute Method: IEnumerable<Api.Core.Node> result = coreRepository.Execute<Api.Core.Node>(requestUri, HttpMethod.Get.ToString(), true, null); Type[] paramTypes = { typeof(Uri), typeof(String), typeof(Boolean), typeof(System.Data.Services.Client.OperationParameter[]) }; MethodInfo m = typeof(biz.dfch.CS.Appclusive.Api.Core.Core).GetMethod("Execute", paramTypes); Type[] genericTypeArgs = { entity.EntityKind.EntityType }; MethodInfo execute = m.MakeGenericMethod(genericTypeArgs); object[] args = {requestUri, HttpMethod.Get.ToString(), true, null}; IEnumerable<object> result = (IEnumerable<object>)execute.Invoke(coreRepository, args); object refEntity = result.FirstOrDefault(); // read name property PropertyInfo p = entity.EntityKind.EntityType.GetProperty("Name"); entity.EntityName = (string)p.GetValue(refEntity); } } catch (Exception ex) { // add logging } }
internal void ResolveJob(biz.dfch.CS.Appclusive.Api.Core.Core coreRepository) { Contract.Requires(null != coreRepository); Api.Core.Job job = coreRepository.Jobs .Where(j => j.RefId == this.Id.ToString() && j.EntityKindId == Constants.EntityKindId.Order.GetHashCode()) .FirstOrDefault(); Contract.Assert(null != job, "No job available for this order"); this.Job = AutoMapper.Mapper.Map<Job>(job); }
public List <PrivateCustomer> GetPrivateCustomers() { biz business = new biz(); DataSet dataSet = business.Execute("SELECT * FROM PrivateCustomer"); DataTable customerTable = dataSet.Tables[0]; List <PrivateCustomer> privateCustomers = new List <PrivateCustomer>(); foreach (DataRow itemRow in customerTable.Rows) { privateCustomers.Add( new PrivateCustomer((string)itemRow["firstName"], (string)itemRow["lastName"], (string)itemRow["address"], (int)itemRow["zipCode"], (int)itemRow["phoneNumber"], (int)itemRow["id"], (int)itemRow["amountSpent"])); } return(privateCustomers); }
public List <CorporateCustomer> GetCorporateCustomers() { biz business = new biz(); DataSet dataSet = business.Execute("SELECT * FROM CorporateCustomer"); DataTable customerTable = dataSet.Tables[0]; List <CorporateCustomer> corporateCustomers = new List <CorporateCustomer>(); foreach (DataRow itemRow in customerTable.Rows) { corporateCustomers.Add( new CorporateCustomer((string)itemRow["companyName"], (int)itemRow["seNumber"], (int)itemRow["phoneNumber"], (int)itemRow["id"], (int)itemRow["amountSpent"]) ); } return(corporateCustomers); }
/// <param name="coreRepository"></param> internal void ResolveNavigationProperties(biz.dfch.CS.Appclusive.Api.Core.Core coreRepository) { Contract.Requires(null != coreRepository); // EntityKind if (this.EntityKindId > 0) { Api.Core.EntityKind entityKind = coreRepository.EntityKinds .Where(j => j.Id == this.EntityKindId) .FirstOrDefault(); Contract.Assert(null != entityKind, "no entityKind available"); this.EntityKind = AutoMapper.Mapper.Map<EntityKind>(entityKind); } }
public void AddToJobResponses(biz.dfch.CS.Appclusive.Core.OdataServices.Core.JobResponse jobResponse) { base.AddObject("JobResponses", jobResponse); }
public void AddToAssocs(biz.dfch.CS.Appclusive.Core.OdataServices.Core.Assoc assoc) { base.AddObject("Assocs", assoc); }
public void AddToTenants(biz.dfch.CS.Appclusive.Core.OdataServices.Core.Tenant tenant) { base.AddObject("Tenants", tenant); }
public void AddToUsers(biz.dfch.CS.Appclusive.Core.OdataServices.Core.User user) { base.AddObject("Users", user); }
public void AddToNodes(biz.dfch.CS.Appclusive.Core.OdataServices.Core.Node node) { base.AddObject("Nodes", node); }
internal void ResolveNavigationProperties(biz.dfch.CS.Appclusive.Api.Core.Core coreRepository, Models.Core.Acl acl = null) { Contract.Requires(null != coreRepository); // ACL if (this.AclId > 0 && this.Acl == null) { if (null == acl) { try { acl = Models.Core.Acl.GetAclsFromCache() .FirstOrDefault(j => j.Id == this.AclId); } catch { Contract.Assert(null != acl, "no acl available"); } } this.Acl = acl; } // Permission if (this.Permission == null) { if (this.PermissionId > 0) { try { this.Permission = Models.Core.Permission.GetPermissionsFromCache() .FirstOrDefault(j => j.Id == this.PermissionId); } catch { // Contract.Assert(null != this.Permission, "no permission available"); } } else { // all permissions this.Permission = new Permission() { Name = GeneralResources.PermissionsAll }; } } // Trustee if (this.TrusteeId > 0 && this.Trustee == null) { try { if (TrusteeType == TrusteeTypeEnum.Role.GetHashCode()) { Models.Core.Role role = Models.Core.Role.GetRolesFromCache() .FirstOrDefault(j => j.Id == this.TrusteeId); //Contract.Assert(null != role, "no role available"); this.Trustee = role; } else { Models.Core.User user = Models.Core.User.GetUsersFromCache() .FirstOrDefault(j => j.Id == this.TrusteeId); //Contract.Assert(null != user, "no user available"); this.Trustee = user; } } catch { // Contract.Assert(null != this.Trustee, "no trustee available"); } } }
public void AddToEndpoints(biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Endpoint endpoint) { base.AddObject("Endpoints", endpoint); }
public void AddToAuditTrails(biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.AuditTrail auditTrail) { base.AddObject("AuditTrails", auditTrail); }
public void AddToCimiTargets(biz.dfch.CS.Appclusive.Core.OdataServices.Cmp.CimiTarget cimiTarget) { base.AddObject("CimiTargets", cimiTarget); }
public void AddToMessages(biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Message message) { base.AddObject("Messages", message); }
/// <summary> /// Find Order by Approval /// </summary> /// <param name="coreRepository"></param> internal void ResolveOrderId(biz.dfch.CS.Appclusive.Api.Core.Core coreRepository) { Contract.Requires(null != coreRepository); if (null == this.Job) { this.ResolveJob(coreRepository); } this.Order = AutoMapper.Mapper.Map<Order>(coreRepository.InvokeEntityActionWithSingleResult<Api.Core.Order>(this, "Order", null)); if (null != this.Order) { this.OrderId = Order.Id; } }
public void AddToIncidents(biz.dfch.CS.Appclusive.Core.OdataServices.Csm.Incident incident) { base.AddObject("Incidents", incident); }
public void AddToHealthChecks(biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.HealthCheck healthCheck) { base.AddObject("HealthChecks", healthCheck); }
public void AddToNetworkAddresses(biz.dfch.CS.Appclusive.Core.OdataServices.Cmp.NetworkAddress networkAddress) { base.AddObject("NetworkAddresses", networkAddress); }
public void AddToRatings(biz.dfch.CS.Appclusive.Core.OdataServices.Fab.Rating rating) { base.AddObject("Ratings", rating); }
public void AddToEntityKinds(biz.dfch.CS.Appclusive.Core.OdataServices.Core.EntityKind entityKind) { base.AddObject("EntityKinds", entityKind); }
public void AddToNetworks(biz.dfch.CS.Appclusive.Core.OdataServices.Cmp.Network network) { base.AddObject("Networks", network); }
public void AddToDataTypes(biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.DataType dataType) { base.AddObject("DataTypes", dataType); }