/// <summary> /// Deprecated Method for adding a new object to the Resources EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToResources(Resource resource) { base.AddObject("Resources", resource); }
/// <summary> /// Create a new Resource object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="measureId">Initial value of the MeasureId property.</param> /// <param name="resourceTypeId">Initial value of the ResourceTypeId property.</param> /// <param name="taskId">Initial value of the TaskId property.</param> /// <param name="code">Initial value of the Code property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="amount">Initial value of the Amount property.</param> /// <param name="cost">Initial value of the Cost property.</param> /// <param name="totalCost">Initial value of the TotalCost property.</param> /// <param name="realUsed">Initial value of the RealUsed property.</param> public static Resource CreateResource(global::System.Int64 id, global::System.Int32 measureId, global::System.Int32 resourceTypeId, global::System.Int64 taskId, global::System.String code, global::System.String name, global::System.Double amount, global::System.Decimal cost, global::System.Decimal totalCost, global::System.Double realUsed) { Resource resource = new Resource(); resource.Id = id; resource.MeasureId = measureId; resource.ResourceTypeId = resourceTypeId; resource.TaskId = taskId; resource.Code = code; resource.Name = name; resource.Amount = amount; resource.Cost = cost; resource.TotalCost = totalCost; resource.RealUsed = realUsed; return resource; }
//internal static CustomerContactDto Map(CustomerContact customerContact) //{ // // Extract // var contactPerson = customerContact.Person; // var personPhones = new List<PersonPhone>(); // foreach (var tmpPersonPhone in contactPerson.PersonPhones.ToList()) // { // Olympus._Enterprise.Detach(tmpPersonPhone); // personPhones.Add(tmpPersonPhone); // } // // Detach // Olympus._Enterprise.Detach(contactPerson); // Olympus._Enterprise.Detach(customerContact); // // Map // var contactDto = Mapper.Map<CustomerContactDto>(customerContact); // contactDto.Person = Mapper.Map<PersonDto>(contactPerson); // contactDto.Person.PersonPhones = Mapper.Map<List<PersonPhoneDto>>(personPhones); // return contactDto; //} //internal static CustomerDto Map(Customer customer) //{ // CustomerDto customerDto = null; // if (customer != null) { // var customerContacts = new List<CustomerContactDto>(); // foreach (CustomerContact tmpCustomerContact in customer.CustomerContacts.ToList()) // { // customerContacts.Add(Mapper.Map<CustomerContactDto>(tmpCustomerContact)); // } // Olympus._Enterprise.Detach(customer); // customerDto = Mapper.Map<CustomerDto>(customer); // customerDto.CustomerContacts = customerContacts; // } // return customerDto; //} //internal static BudgetRequestDto Map(BudgetRequest budgetRequest) //{ // BudgetRequestDto budgetRequestDto = null; // if (budgetRequest != null) // { // // Customer // var customer = Map(budgetRequest.Customer); // // Person // var personEntity = budgetRequest.Employee.Person; // Olympus._Enterprise.Detach(personEntity); // var person = Mapper.Map<PersonDto>(personEntity); // // Employee // var employeeEntity = budgetRequest.Employee; // Olympus._Enterprise.Detach(employeeEntity); // var employee = Mapper.Map<EmployeeDto>(employeeEntity); // // BudgetRequestCondition // var budgetRequestConditionEntity = budgetRequest.BudgetRequestCondition; // Olympus._Enterprise.Detach(budgetRequestConditionEntity); // var budgetRequestCondition = Mapper.Map<BudgetRequestConditionDto>(budgetRequestConditionEntity); // // BubgetRequest // Olympus._Enterprise.Detach(budgetRequest); // budgetRequestDto = Mapper.Map<BudgetRequestDto>(budgetRequest); // budgetRequestDto.Customer = customer; // budgetRequestDto.Employee = employee; // budgetRequestDto.Employee.Person = person; // budgetRequestDto.BudgetRequestCondition = budgetRequestCondition; // } // return budgetRequestDto; //} internal static ResourceDto Map(Resource resource) { ResourceDto resourceDto = null; if (resource != null) { // Resource Type var resourceTypeEntity = resource.ResourceType; Olympus._Enterprise.Detach(resourceTypeEntity); var resoureceType = Mapper.Map<ResourceTypeDto>(resourceTypeEntity); //Measure var measureTypeEntity = resource.Measure; Olympus._Enterprise.Detach(measureTypeEntity); var measure = Mapper.Map<MeasureDto>(measureTypeEntity); Olympus._Enterprise.Detach(resource); resourceDto = Mapper.Map<ResourceDto>(resource); resourceDto.Measure = measure; resourceDto.ResourceType = resoureceType; } return resourceDto; }