Ejemplo n.º 1
0
        }                              //end Contract()

        public Contract(net.autotask.webservices.Contract entity) : base(entity)
        {
            var thisType         = GetType();
            var fields           = GetType().GetFields();
            var entityReflection = entity.GetType();

            foreach (var i in fields)
            {
                //Console.WriteLine($"Converting: {i.Name} -- {i.FieldType} -- {i.MemberType}");
                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 Contract(net.autotask.webservices.Contract entity)
Ejemplo n.º 2
0
        }                              //end Contract()

        public Contract(net.autotask.webservices.Contract entity) : base(entity)
        {
            this.AccountID                     = int.Parse(entity.AccountID.ToString());
            this.BillingPreference             = entity.BillingPreference == null ? default(int?) : int.Parse(entity.BillingPreference.ToString());
            this.BusinessDivisionSubdivisionID = entity.BusinessDivisionSubdivisionID == null ? default(int?) : int.Parse(entity.BusinessDivisionSubdivisionID.ToString());
            this.Compliance                    = entity.Compliance == null ? default(bool?) : bool.Parse(entity.Compliance.ToString());
            this.ContractName                  = entity.ContactID == null ? default(string) : entity.ContactID.ToString();
            this.ContractType                  = int.Parse(entity.ContractType.ToString());
            this.EndDate   = DateTime.Parse(entity.EndDate.ToString());
            this.StartDate = DateTime.Parse(entity.StartDate.ToString());
            this.Status    = int.Parse(entity.Status.ToString());
            this.TimeReportingRequiresStartAndStopTimes = int.Parse(entity.TimeReportingRequiresStartAndStopTimes.ToString());
            this.ContactID           = entity.ContactID == null ? default(int?) : int.Parse(entity.ContactID.ToString());
            this.ContactName         = entity.ContactName == null ? default(string) : entity.ContactName.ToString();
            this.ContractCategory    = entity.ContractCategory == null ? default(int?) : int.Parse(entity.ContractCategory.ToString());
            this.ContractNumber      = entity.ContractName == null ? default(string) : entity.ContractName.ToString();
            this.ContractPeriodType  = entity.ContractPeriodType == null ? default(string) : entity.ContractPeriodType.ToString();
            this.Description         = entity.Description == null ? default(string) : entity.Description.ToString();
            this.EstimatedCost       = double.Parse(entity.EstimatedCost.ToString());
            this.EstimatedHours      = double.Parse(entity.EstimatedHours.ToString());
            this.EstimatedRevenue    = double.Parse(entity.EstimatedRevenue.ToString());
            this.ExclusionContractID = long.Parse(entity.ExclusionContractID.ToString());
            this.InternalCurrencyOverageBillingRate = double.Parse(entity.InternalCurrencyOverageBillingRate.ToString());
            this.InternalCurrencySetupFee           = double.Parse(entity.InternalCurrencySetupFee.ToString());
            this.IsDefaultContract       = entity.IsDefaultContract == null ? default(bool?) : bool.Parse(entity.IsDefaultContract.ToString());
            this.OpportunityID           = entity.OpportunityID == null ? default(int?) : int.Parse(entity.OpportunityID.ToString());
            this.OverageBillingRate      = double.Parse(entity.OverageBillingRate.ToString());
            this.PurchaseOrderNumber     = entity.PurchaseOrderNumber == null ? default(string) : entity.PurchaseOrderNumber.ToString();
            this.ServiceLevelAgreementID = entity.ServiceLevelAgreementID == null ? default(int?) : int.Parse(entity.ServiceLevelAgreementID.ToString());
            this.SetupFee = double.Parse(entity.SetupFee.ToString());
            this.SetupFeeAllocationCodeID = long.Parse(entity.SetupFeeAllocationCodeID.ToString());
        } //end Contract(net.autotask.webservices.Contract entity)
Ejemplo n.º 3
0
        }                              //end Contract()

        public Contract(net.autotask.webservices.Contract entity) : base(entity)
        {
        } //end Contract(net.autotask.webservices.Contract entity)