} //end ContractService() public ContractService(net.autotask.webservices.ContractService entity) : base(entity) { var thisType = GetType(); var fields = GetType().GetFields(); var entityReflection = entity.GetType(); foreach (var i in fields) { try { if (i.Name == "UserDefinedFields") { // treat differently: UserDefinedFields = entity.UserDefinedFields?.Select(udf => new UserDefinedField { Name = udf.Name, Value = udf.Value }).ToList(); continue; } var value = entityReflection.GetProperty(i.Name)?.GetValue(entity); thisType.GetField(i.Name).SetValue(this, value); } catch (Exception e) { Console.WriteLine(e); throw; } } } //end ContractService(net.autotask.webservices.ContractService entity)
} //end ContractService() public ContractService(net.autotask.webservices.ContractService entity) : base(entity) { this.ContractID = int.Parse(entity.ContractID.ToString()); this.QuoteItemID = long.Parse(entity.QuoteItemID.ToString()); this.ServiceID = int.Parse(entity.ServiceID.ToString()); this.AdjustedPrice = double.Parse(entity.AdjustedPrice.ToString()); this.InternalCurrencyAdjustedPrice = double.Parse(entity.InternalCurrencyAdjustedPrice.ToString()); this.InternalCurrencyUnitPrice = double.Parse(entity.InternalCurrencyAdjustedPrice.ToString()); this.InternalDescription = entity.InternalDescription == null ? default(string) : entity.InternalDescription.ToString(); this.InvoiceDescription = entity.InvoiceDescription == null ? default(string) : entity.InvoiceDescription.ToString(); //this.UnitCost = double.Parse(entity.UnitCost.toString()); this.UnitPrice = double.Parse(entity.UnitPrice.ToString()); } //end ContractService(net.autotask.webservices.ContractService entity)
} //end ContractService() public ContractService(net.autotask.webservices.ContractService entity) : base(entity) { } //end ContractService(net.autotask.webservices.ContractService entity)