} //end QuoteItem() public QuoteItem(net.autotask.webservices.QuoteItem 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 QuoteItem(net.autotask.webservices.QuoteItem entity)
} //end QuoteItem() public QuoteItem(net.autotask.webservices.QuoteItem entity) : base(entity) { this.IsOptional = bool.Parse(entity.IsOptional.ToString()); this.LineDiscount = double.Parse(entity.LineDiscount.ToString()); this.PercentageDiscount = double.Parse(entity.PercentageDiscount.ToString()); this.Quantity = double.Parse(entity.Quantity.ToString()); this.QuoteID = int.Parse(entity.QuoteID.ToString()); this.Type = int.Parse(entity.Type.ToString()); this.UnitDiscount = double.Parse(entity.UnitDiscount.ToString()); this.AverageCost = double.Parse(entity.AverageCost.ToString()); this.CostID = entity.CostID == null ? default(int?) : int.Parse(entity.CostID.ToString()); this.Description = entity.Description == null ? default(string) : entity.Description.ToString(); this.ExpenseID = entity.ExpenseID == null ? default(int?) : int.Parse(entity.ExpenseID.ToString()); this.HighestCost = double.Parse(entity.HighestCost.ToString()); this.InternalCurrencyLineDiscount = double.Parse(entity.InternalCurrencyLineDiscount.ToString()); this.InternalCurrencyUnitDiscount = double.Parse(entity.InternalCurrencyLineDiscount.ToString()); this.InternalCurrencyUnitPrice = double.Parse(entity.InternalCurrencyUnitPrice.ToString()); this.IsTaxable = entity.IsTaxable == null ? default(bool?) : bool.Parse(entity.IsTaxable.ToString()); this.LaborID = entity.LaborID == null ? default(int?) : int.Parse(entity.LaborID.ToString()); this.MarkupRate = double.Parse(entity.MarkupRate.ToString()); this.Name = entity.Name == null ? default(string) : entity.Name.ToString(); this.PeriodType = entity.PeriodType == null ? default(string) : entity.PeriodType.ToString(); this.ProductID = entity.ProductID == null ? default(int?) : int.Parse(entity.ProductID.ToString()); this.ServiceBundleID = entity.ServiceBundleID == null ? default(int?) : int.Parse(entity.ServiceBundleID.ToString()); this.ServiceID = entity.ServiceID == null ? default(int?) : int.Parse(entity.ServiceID.ToString()); this.ShippingID = entity.ShippingID == null ? default(int?) : int.Parse(entity.ShippingID.ToString()); this.TaxCategoryID = entity.TaxCategoryID == null ? default(int?) : int.Parse(entity.TaxCategoryID.ToString()); this.TotalEffectiveTax = double.Parse(entity.TotalEffectiveTax.ToString()); this.UnitCost = double.Parse(entity.UnitCost.ToString()); this.UnitPrice = double.Parse(entity.UnitPrice.ToString()); } //end QuoteItem(net.autotask.webservices.QuoteItem entity)
} //end QuoteItem() public QuoteItem(net.autotask.webservices.QuoteItem entity) : base(entity) { } //end QuoteItem(net.autotask.webservices.QuoteItem entity)