예제 #1
0
        public static CustomField2 Execute(CorrigoService service, CorrigoEntity entity,
                                           CustomFieldDescriptor customFieldDescriptor)
        {
            string label    = "IFS-1119";
            string href     = "https://jira.qa.corrigo.com:55445/browse/IFS-1119";
            string urlValue = $"<a href=\"{href}\">{label}</a>";

            var customField = new CustomField2
            {
                Descriptor = new CustomFieldDescriptor {
                    Id = customFieldDescriptor.Id
                },
                ObjectId     = entity.Id,
                ObjectTypeId = customFieldDescriptor.ActorTypeId,
                Value        = urlValue
            };
            var command = new CreateCommand {
                Entity = customField
            };
            var response = service.Execute(command) as OperationCommandResponse;

            customField.Id = response?.EntitySpecifier?.Id ?? 0;

            return(customField);
        }
예제 #2
0
        public static WoPriority Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine($"Retrieve WoPriority with id={id.ToString()}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.WoPriority,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties =
                        new string[]
                    {
                        "Id", "DisplayAs", "IsEmergency", "RespondInMinutes", "DueInMinutes",
                        "AcknowledgeInMinutes"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!String.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            WoPriority toReturn = result as WoPriority;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Console.WriteLine(String.Concat("WoPriority.Id=".PadRight(30), toReturn.Id.ToString()));
            Console.WriteLine(String.Concat("WoPriority.DisplayAs=".PadRight(30), String.IsNullOrEmpty(toReturn.DisplayAs) ? "" : toReturn.DisplayAs));
            Console.WriteLine(String.Concat("WoPriority.IsEmergency=".PadRight(30), toReturn.IsEmergency.ToString(), "  //Escalate"));
            Console.WriteLine(String.Concat("WoPriority.RespondInMinutes =".PadRight(30), toReturn.RespondInMinutes.ToString(), "  //Response minutes."));
            Console.WriteLine(String.Concat("WoPriority.DueInMinutes=".PadRight(30), toReturn.DueInMinutes.ToString(), "  //Complete minutes."));
            Console.WriteLine(String.Concat("WoPriority.AcknowledgeInMinutes=".PadRight(30), toReturn.AcknowledgeInMinutes.ToString(), "  //Complete minutes."));
            Console.WriteLine();

            return(toReturn);
        }
예제 #3
0
        public static Contract Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Contract with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Contract,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Contract toReturn = result as Contract;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Contract.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Contract.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));

            Console.WriteLine();

            return(toReturn);
        }
예제 #4
0
        public static CustomField2 Retrieve(CorrigoService service, CorrigoEntity entity,
                                            CustomFieldDescriptor customFieldDescriptor)
        {
            var list = service.RetrieveMultiple(
                new QueryExpression
            {
                Count       = 1,
                EntityType  = EntityType.CustomField2,
                PropertySet = new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "ObjectId",
                        "ObjectTypeId",
                        "Value",
                    }
                },
                Criteria = new FilterExpression
                {
                    Conditions = new ConditionExpression[]
                    {
                        new ConditionExpression
                        {
                            PropertyName = "ObjectId",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { entity.Id }
                        },
                        new ConditionExpression
                        {
                            PropertyName = "Descriptor.Id",
                            Operator     = ConditionOperator.Equal,
                            Values       = new object[] { customFieldDescriptor.Id }
                        }
                    },
                    FilterOperator = LogicalOperator.And
                }
            });

            return(list.FirstOrDefault() as CustomField2);
        }
예제 #5
0
        public static BillingAccount Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve BillingAccount with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.BillingAccount,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs",
                        "PortalImageSetId",
                        "CpThemeId",
                        "IsBillAcct",
                        "Number",
                        "PayTerms",
                        "PayDays",
                        "PayInstr",
                        "IsCreditHold",
                        "AccrualMargin",
                        "SalesRep",
                        "IsTaxExempt",
                        "CorporateEntity.*",
                        "Address.*",
                        "IsInactive",
                        "PayDayWeekday",
                        "PayDayNumber",
                        "BillingContact.*"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            BillingAccount toReturn = result as BillingAccount;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("BillingAccount.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("BillingAccount.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("BillingAccount.PortalImageSetId=".PadRight(padRightNumber), !toReturn.PortalImageSetId.HasValue ? "" : toReturn.PortalImageSetId.ToString()));

            Console.WriteLine(string.Concat("BillingAccount.CpThemeId=".PadRight(padRightNumber), !toReturn.CpThemeId.HasValue ? "" : toReturn.CpThemeId.ToString()));

            Console.WriteLine(string.Concat("BillingAccount.IsBillAcct=".PadRight(padRightNumber), toReturn.IsBillAcct));
            Console.WriteLine(string.Concat("BillingAccount.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));

            Console.WriteLine(string.Concat("BillingAccount.PayTerms=".PadRight(padRightNumber), toReturn.PayTerms ?? ""));
            Console.WriteLine(string.Concat("BillingAccount.PayDays=".PadRight(padRightNumber), toReturn.PayDays));

            Console.WriteLine(string.Concat("BillingAccount.PayInstr=".PadRight(padRightNumber), toReturn.PayInstr ?? ""));

            Console.WriteLine(string.Concat("BillingAccount.IsCreditHold=".PadRight(padRightNumber), toReturn.IsCreditHold));
            Console.WriteLine(string.Concat("BillingAccount.AccrualMargin= ".PadRight(padRightNumber), toReturn.AccrualMargin));
            Console.WriteLine(string.Concat("BillingAccount.SalesRep= ".PadRight(padRightNumber), toReturn.SalesRep ?? ""));
            Console.WriteLine(string.Concat("BillingAccount.IsTaxExempt=".PadRight(padRightNumber), toReturn.IsTaxExempt));


            if (toReturn.CorporateEntity != null)
            {
                Console.WriteLine(string.Concat("BillingAccount.CorporateEntity.Id=".PadRight(padRightNumber), toReturn.CorporateEntity.Id.ToString()));
                Console.WriteLine(string.Concat("BillingAccount.CorporateEntity.DisplayAs=".PadRight(padRightNumber), toReturn.CorporateEntity.DisplayAs ?? ""));
            }

            if (toReturn.Address != null)
            {
                Console.WriteLine(string.Concat("BillingAccount.Address.Id=".PadRight(padRightNumber), toReturn.Address.Id.ToString()));
                Console.WriteLine(string.Concat("BillingAccount.Address.Country=".PadRight(padRightNumber), toReturn.Address.Country ?? ""));
                Console.WriteLine(string.Concat("BillingAccount.Address.State=".PadRight(padRightNumber), toReturn.Address.State ?? ""));
                Console.WriteLine(string.Concat("BillingAccount.Address.City=".PadRight(padRightNumber), toReturn.Address.City ?? ""));
                Console.WriteLine(string.Concat("BillingAccount.Address.Street=".PadRight(padRightNumber), toReturn.Address.Street ?? ""));
            }

            Console.WriteLine(string.Concat("BillingAccount.IsInactive=".PadRight(padRightNumber), toReturn.IsInactive));
            Console.WriteLine(string.Concat("BillingAccount.PayDayWeekday=".PadRight(padRightNumber), toReturn.PayDayWeekday));
            Console.WriteLine(string.Concat("BillingAccount.PayDayNumber=".PadRight(padRightNumber), toReturn.PayDayNumber));

            if (toReturn.BillingContact != null)
            {
                Console.WriteLine(string.Concat("BillingAccount.BillingContact.Id=".PadRight(padRightNumber), toReturn.BillingContact.Id.ToString()));
                Console.WriteLine(string.Concat("BillingAccount.BillingContact.DisplayAs=".PadRight(padRightNumber), toReturn.BillingContact.DisplayAs ?? ""));
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #6
0
        public static WorkZone Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve WorkZone with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.WorkZone,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs",
                        "TimeZone",
                        "AccessOptionsMask",
                        "AdvanceNotice",
                        "Asset.*",
                        "AutoAssignEnabled",
                        "BackupRoutingId",
                        "BillingAccount.*",
                        "BizHours.*",
                        "ContactAddresses.*",
                        "Contract.*",
                        "CpThemeId",
                        "CurrencyTypeId",
                        "CustomFields.*",
                        "DefaultAccess",
                        "Entity",
                        "EscalationRules.*",
                        "IsOffline",
                        "LanguageId",
                        "NoIncompleteItem",
                        "NoIncompletePunchList",
                        "Number",
                        "OnCallRules.*",
                        "Portfolios.*",
                        "Responsibilities.*",
                        "RoundApptTimeTo",
                        "SchedulingWindow",
                        "SpecDispatchRules.*",
                        "TaxRegion.*",
                        "Teams.*",
                        "UiShowProvidersFirst",
                        "UseBizHours",
                        "UseEscalation",
                        "UseHolidays",
                        "UseOnCall",
                        "WoNumberDigits",
                        "WoNumberPrefix",
                        "WorkPlanAutoCancel",
                        "WorkPlanAutoDependency",
                        "WorkPlanChildResolution",
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            WorkZone toReturn = result as WorkZone;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("WorkZone.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("WorkZone.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("WorkZone.Asset.Id=".PadRight(padRightNumber), toReturn.Asset?.Id.ToString() ?? ""));
            Console.WriteLine(string.Concat("WorkZone.TimeZone=".PadRight(padRightNumber), toReturn.TimeZone.ToString()));



            Console.WriteLine(string.Concat("WorkZone.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));


            if (toReturn.Contract != null)
            {
                Console.WriteLine(string.Concat("WorkZone.Contract.Id=".PadRight(padRightNumber),
                                                toReturn.Contract.Id.ToString()));
                Console.WriteLine(string.Concat("WorkZone.Contract.DisplayAs=".PadRight(padRightNumber),
                                                toReturn.Contract.DisplayAs));
            }

            if (toReturn.TaxRegion != null)
            {
                Console.WriteLine(string.Concat("WorkZone.TaxRegion.Id=".PadRight(padRightNumber),
                                                toReturn.TaxRegion.Id.ToString()));
                Console.WriteLine(string.Concat("WorkZone.TaxRegion.DisplayAs=".PadRight(padRightNumber),
                                                toReturn.TaxRegion.DisplayAs));
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #7
0
        public static Document Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Document with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Document,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "ActorId",
                        "ActorTypeId",
                        "Description",
                        "Title",
                        "DocType.*",
                        "EndDate",
                        "StartDate",
                        "UpdatedDate",
                        "ExtensionId",
                        "MimeType",
                        "UpdatedBy.*",
                        "WonId",
                        "WonMemberId",
                        "Blob.*",
                        "DocUrl",
                        "IsPublic",
                        "IsShared",
                        "StorageTypeId"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Document toReturn = result as Document;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Document.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Document.ActorId=".PadRight(padRightNumber), toReturn.ActorId.ToString()));
            Console.WriteLine(string.Concat("Document.ActorTypeId=".PadRight(padRightNumber), toReturn.ActorTypeId.ToString()));
            Console.WriteLine(string.Concat("Document.Description=".PadRight(padRightNumber), toReturn.Description ?? ""));
            Console.WriteLine(string.Concat("Document.Title=".PadRight(padRightNumber), toReturn.Title ?? ""));

            if (toReturn.DocType != null)
            {
                Console.WriteLine(string.Concat("Document.DocType.DisplayAs=".PadRight(padRightNumber), toReturn.DocType.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("Document.DocType.Description=".PadRight(padRightNumber), toReturn.DocType.Description ?? ""));
            }

            Console.WriteLine(string.Concat("Document.EndDate=".PadRight(padRightNumber), toReturn.EndDate?.ToString() ?? ""));
            Console.WriteLine(string.Concat("Document.StartDate=".PadRight(padRightNumber), toReturn.StartDate.ToString()));
            Console.WriteLine(string.Concat("Document.UpdatedDate=".PadRight(padRightNumber), toReturn.UpdatedDate.ToString()));
            Console.WriteLine(string.Concat("Document.ExtensionId=".PadRight(padRightNumber), toReturn.ExtensionId.ToString()));
            Console.WriteLine(string.Concat("Document.StorageTypeId=".PadRight(padRightNumber), toReturn.StorageTypeId.ToString()));
            Console.WriteLine(string.Concat("Document.MimeType=".PadRight(padRightNumber), toReturn.MimeType.ToString()));


            if (toReturn.UpdatedBy != null)
            {
                Console.WriteLine(string.Concat("Document.UpdatedBy.DisplayAs=".PadRight(padRightNumber), toReturn.UpdatedBy.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("Document.UpdatedBy.Id=".PadRight(padRightNumber), toReturn.UpdatedBy.Id.ToString()));
            }

            Console.WriteLine(string.Concat("Document.WonId=".PadRight(padRightNumber), toReturn.WonId.ToString()));
            Console.WriteLine(string.Concat("Document.WonMemberId=".PadRight(padRightNumber), toReturn.WonMemberId.ToString()));


            if (toReturn.Blob != null)
            {
                Console.WriteLine(string.Concat("Document.Blob.Id=".PadRight(padRightNumber), toReturn.Blob.Id.ToString()));
                Console.WriteLine(string.Concat("Document.Blob.FileName=".PadRight(padRightNumber), toReturn.Blob.FileName ?? ""));
            }

            Console.WriteLine(string.Concat("Document.DocUrl=".PadRight(padRightNumber), toReturn.DocUrl));
            Console.WriteLine(string.Concat("Document.IsPublic=".PadRight(padRightNumber), toReturn.IsPublic));
            Console.WriteLine(string.Concat("Document.IsShared=".PadRight(padRightNumber), toReturn.IsShared));
            Console.WriteLine(string.Concat("Document.StorageTypeId=".PadRight(padRightNumber), toReturn.StorageTypeId));

            Console.WriteLine();

            return(toReturn);
        }
예제 #8
0
        public static Organization Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Organization with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Organization,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs",
                        "Number",
                        "Address.*",
                        "ContactAddresses.*",
                        "CustomFields.*",
                        "Notes.*",
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Organization toReturn = result as Organization;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 55;

            Console.WriteLine(string.Concat("Organization.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Organization.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("Organization.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));

            if (toReturn.Address != null)
            {
                Console.WriteLine(string.Concat("Organization.Address.City=".PadRight(padRightNumber), toReturn.Address.City ?? ""));
            }


            Console.WriteLine();

            return(toReturn);
        }
예제 #9
0
        public static Employee Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine($"Retrieve Employee with id={id.ToString()}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Employee,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "FirstName",
                        "LastName",
                        "DisplayAs",
                        "Role.*",
                        "AccessToAllWorkZones",
                        "LanguageId",
                        "ActorTypeId",
                        "Username",
                        "DtPwdChange",
                        "ProviderInvitedOn",
                        "Instructions",
                        "WonMemberId",
                        "WonLocationId",
                        "WonServiceRadius",
                        "IsElectronicPayment",
                        "ProviderStatusId",
                        "LabelId",
                        "FreeTextAllowed",
                        "RadiusUnit",
                        "Password",
                        "Number",
                        "JobTitle",
                        "FederalId",
                        "ExternalId",
                        "ForcePasswordReset",
                        "DefaultPriceList.*",
                        "PriceLists.*",
                        "CustomFields.*", "CustomFields.Descriptor.*",
                        "Organization.*",
                        "ContactAddresses.*",
                        "Address.*",
                        "Teams.*",
                        "WorkZones.*",
                        "Portfolios.*",
                        "CustomerGroups.*",
                        "Specialties.*",
                        "PayRates.*",
                        "StockLocations.*",
                        "Services.*",
                        "AlertSubscriptions.*",
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Employee toReturn = result as Employee;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 45;

            Console.WriteLine(string.Concat("Employee.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Employee.FirstName=".PadRight(padRightNumber), toReturn.FirstName ?? ""));
            Console.WriteLine(string.Concat("Employee.LastName=".PadRight(padRightNumber), toReturn.LastName ?? ""));
            Console.WriteLine(string.Concat("Employee.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));

            if (toReturn.Role != null)
            {
                Console.WriteLine(string.Concat("Employee.Role.Id=".PadRight(padRightNumber), toReturn.Role.Id.ToString()));
                Console.WriteLine(string.Concat("Employee.Role.DisplayAs=".PadRight(padRightNumber), toReturn.Role.DisplayAs ?? ""));
            }

            Console.WriteLine(string.Concat("Employee.AccessToAllWorkZones=".PadRight(padRightNumber), toReturn.AccessToAllWorkZones));
            Console.WriteLine(string.Concat("Employee.LanguageId=".PadRight(padRightNumber), toReturn.LanguageId));
            Console.WriteLine(string.Concat("Employee.ActorTypeId=".PadRight(padRightNumber), toReturn.ActorTypeId));

            Console.WriteLine(string.Concat("Employee.Username="******""));

            Console.WriteLine(string.Concat("Employee.DtPwdChange=".PadRight(padRightNumber), toReturn.DtPwdChange));
            Console.WriteLine(string.Concat("Employee.ProviderInvitedOn=".PadRight(padRightNumber), !toReturn.ProviderInvitedOn.HasValue? "" : toReturn.ProviderInvitedOn.Value.ToString()));

            Console.WriteLine(string.Concat("Employee.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("Employee.Instructions=".PadRight(padRightNumber), toReturn.Instructions ?? ""));
            Console.WriteLine(string.Concat("Employee.WonMemberId=".PadRight(padRightNumber), toReturn.WonMemberId));
            Console.WriteLine(string.Concat("Employee.WonLocationId=".PadRight(padRightNumber), toReturn.WonLocationId));
            Console.WriteLine(string.Concat("Employee.WonServiceRadius=".PadRight(padRightNumber), toReturn.WonServiceRadius));
            Console.WriteLine(string.Concat("Employee.IsElectronicPayment=".PadRight(padRightNumber), toReturn.IsElectronicPayment));
            Console.WriteLine(string.Concat("Employee.ProviderStatusId=".PadRight(padRightNumber), toReturn.ProviderStatusId));
            Console.WriteLine(string.Concat("Employee.LabelId=".PadRight(padRightNumber), toReturn.LabelId));
            Console.WriteLine(string.Concat("Employee.FreeTextAllowed=".PadRight(padRightNumber), toReturn.FreeTextAllowed));
            Console.WriteLine(string.Concat("Employee.RadiusUnit=".PadRight(padRightNumber), toReturn.RadiusUnit));
            Console.WriteLine(string.Concat("Employee.Password="******""));
            Console.WriteLine(string.Concat("Employee.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));
            Console.WriteLine(string.Concat("Employee.JobTitle=".PadRight(padRightNumber), toReturn.JobTitle ?? ""));
            Console.WriteLine(string.Concat("Employee.FederalId=".PadRight(padRightNumber), toReturn.FederalId ?? ""));
            Console.WriteLine(string.Concat("Employee.ExternalId=".PadRight(padRightNumber), toReturn.ExternalId ?? ""));
            Console.WriteLine(string.Concat("Employee.ForcePasswordReset=".PadRight(padRightNumber), toReturn.ForcePasswordReset));

            if (toReturn.DefaultPriceList != null)
            {
                Console.WriteLine(string.Concat("Employee.DefaultPriceList.Id=".PadRight(padRightNumber), toReturn.DefaultPriceList.Id));
                Console.WriteLine(string.Concat("Employee.DefaultPriceList.DisplayAs=".PadRight(padRightNumber), toReturn.DefaultPriceList.DisplayAs ?? ""));
            }

            int i = 0;

            if (toReturn.PriceLists != null && toReturn.PriceLists.Length > 0)
            {
                foreach (var price in toReturn.PriceLists)
                {
                    Console.WriteLine(string.Concat($"Employee.PriceLists[{i}].Id=".PadRight(padRightNumber), price.Id));
                    i++;
                }
            }

            if (toReturn.CustomFields != null && toReturn.CustomFields.Length > 0)
            {
                i = 0;
                foreach (var customField in toReturn.CustomFields)
                {
                    Console.WriteLine(string.Concat($"Employee.CustomFields[{i}].Id=".PadRight(padRightNumber), customField.Id));
                    if (customField.Descriptor != null)
                    {
                        Console.WriteLine(string.Concat($"Employee.CustomFields[{i}].Descriptor.Name=".PadRight(padRightNumber), customField.Descriptor.Name ?? ""));
                    }
                    Console.WriteLine(string.Concat($"Employee.CustomFields[{i}].Value=".PadRight(padRightNumber), customField.Value ?? ""));
                    i++;
                }
            }

            if (toReturn.Organization != null)
            {
                Console.WriteLine(string.Concat("Employee.Organization.Id=".PadRight(padRightNumber), toReturn.Organization.Id));
                Console.WriteLine(string.Concat("Employee.Organization.DisplayAs=".PadRight(padRightNumber), toReturn.Organization.DisplayAs));
            }

            if (toReturn.ContactAddresses != null && toReturn.ContactAddresses.Length > 0)
            {
                i = 0;
                foreach (var address in toReturn.ContactAddresses)
                {
                    Console.WriteLine(string.Concat($"Employee.ContactAddresses[{i}].Id=".PadRight(padRightNumber), address.Id));
                    i++;
                }
            }

            if (toReturn.Address != null)
            {
                Console.WriteLine(string.Concat("Employee.Address.Id=".PadRight(padRightNumber), toReturn.Address.Id));
                Console.WriteLine(string.Concat("Employee.Address.City=".PadRight(padRightNumber), toReturn.Address.City ?? ""));
                Console.WriteLine(string.Concat("Employee.Address.Street=".PadRight(padRightNumber), toReturn.Address.Street ?? ""));
            }

            if (toReturn.Teams != null && toReturn.Teams.Length > 0)
            {
                i = 0;
                foreach (var team in toReturn.Teams)
                {
                    Console.WriteLine(string.Concat($"Employee.Teams[{i}].TeamId=".PadRight(padRightNumber), team.TeamId));
                    i++;
                }
            }

            if (toReturn.WorkZones != null && toReturn.WorkZones.Length > 0)
            {
                i = 0;
                foreach (var wz in toReturn.WorkZones)
                {
                    Console.WriteLine(string.Concat($"Employee.WorkZones[{i}].WorkZoneId=".PadRight(padRightNumber), wz.WorkZoneId));
                    i++;
                }
            }

            if (toReturn.Portfolios != null && toReturn.Portfolios.Length > 0)
            {
                i = 0;
                foreach (var portfolio in toReturn.Portfolios)
                {
                    Console.WriteLine(string.Concat($"Employee.Portfolios[{i}].PortfolioId=".PadRight(padRightNumber), portfolio.PortfolioId));
                    i++;
                }
            }

            if (toReturn.CustomerGroups != null && toReturn.CustomerGroups.Length > 0)
            {
                i = 0;
                foreach (var cg in toReturn.CustomerGroups)
                {
                    Console.WriteLine(string.Concat($"Employee.CustomerGroups[{i}].CustomerGroupId=".PadRight(padRightNumber), cg.CustomerGroupId));
                    i++;
                }
            }

            if (toReturn.Specialties != null && toReturn.Specialties.Length > 0)
            {
                i = 0;
                foreach (var sp in toReturn.Specialties)
                {
                    Console.WriteLine(string.Concat($"Employee.Specialties[{i}].SpecialtyId=".PadRight(padRightNumber), sp.SpecialtyId));
                    i++;
                }
            }

            if (toReturn.PayRates != null && toReturn.PayRates.Length > 0)
            {
                i = 0;
                foreach (var pr in toReturn.PayRates)
                {
                    Console.WriteLine(string.Concat($"Employee.PayRates[{i}].LaborCodeId=".PadRight(padRightNumber), pr.LaborCodeId));
                    i++;
                }
            }

            if (toReturn.StockLocations != null && toReturn.StockLocations.Length > 0)
            {
                i = 0;
                foreach (var sl in toReturn.StockLocations)
                {
                    Console.WriteLine(string.Concat($"Employee.StockLocations[{i}].StockLocationId=".PadRight(padRightNumber), sl.StockLocationId));
                    i++;
                }
            }

            if (toReturn.Services != null && toReturn.Services.Length > 0)
            {
                i = 0;
                foreach (var srv in toReturn.Services)
                {
                    Console.WriteLine(string.Concat($"Employee.Services[{i}].ServiceId=".PadRight(padRightNumber), srv.ServiceId));
                    i++;
                }
            }

            if (toReturn.AlertSubscriptions != null && toReturn.AlertSubscriptions.Length > 0)
            {
                i = 0;
                foreach (var alertSubcription in toReturn.AlertSubscriptions)
                {
                    Console.WriteLine(string.Concat($"Employee.AlertSubscriptions[{i}].AlertTypeId=".PadRight(padRightNumber), alertSubcription.AlertTypeId));
                    i++;
                }
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #10
0
        public static Address2 Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Address2 with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Address2,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "ActorTypeId",
                        "ActorId",
                        "TypeId",
                        "Street",
                        "Street2",
                        "City",
                        "State",
                        "Zip",
                        "Country",
                        "GeoStatusId",
                        "Latitude",
                        "Longitude",
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Address2 toReturn = result as Address2;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Address2.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Address2.ActorTypeId=".PadRight(padRightNumber), toReturn.ActorTypeId.ToString()));
            Console.WriteLine(string.Concat("Address2.ActorId=".PadRight(padRightNumber), toReturn.ActorId.ToString()));
            Console.WriteLine(string.Concat("Address2.TypeId=".PadRight(padRightNumber), toReturn.TypeId.ToString()));
            Console.WriteLine(string.Concat("Address2.Street=".PadRight(padRightNumber), toReturn.Street ?? ""));
            Console.WriteLine(string.Concat("Address2.Street2=".PadRight(padRightNumber), toReturn.Street2 ?? ""));
            Console.WriteLine(string.Concat("Address2.City=".PadRight(padRightNumber), toReturn.City ?? ""));
            Console.WriteLine(string.Concat("Address2.State=".PadRight(padRightNumber), toReturn.State ?? ""));
            Console.WriteLine(string.Concat("Address2.Zip=".PadRight(padRightNumber), toReturn.Zip ?? ""));
            Console.WriteLine(string.Concat("Address2.Country=".PadRight(padRightNumber), toReturn.Country ?? ""));
            Console.WriteLine(string.Concat("Address2.GeoStatusId=".PadRight(padRightNumber), toReturn.GeoStatusId.ToString()));
            Console.WriteLine(string.Concat("Address2.Latitude=".PadRight(padRightNumber), toReturn.Latitude.ToString()));
            Console.WriteLine(string.Concat("Address2.Longitude=".PadRight(padRightNumber), toReturn.Longitude.ToString()));

            Console.WriteLine();

            return(toReturn);
        }
예제 #11
0
        public static AssetTree Retrieve(CorrigoService service, int childId, int parentId)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve AssetTree with ChildId={childId} ParentId={parentId}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new AssetTreeEntitySpecifier
                {
                    ChildId  = childId,
                    ParentId = parentId
                },
                    //new PropertySet
                    //{
                    //    Properties = new string[]
                    //    {
                    //        "Id",
                    //        "ParentId",
                    //        "ChildId",
                    //        "Child.*",
                    //        //"Child.Address.*",
                    //        "Distance"
                    //    }
                    //}
                    new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            AssetTree toReturn = result as AssetTree;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 55;

            Console.WriteLine(string.Concat("AssetTree.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("AssetTree.ParentId=".PadRight(padRightNumber), toReturn.ParentId.ToString()));

            if (toReturn.Child != null)
            {
                Console.WriteLine(string.Concat("AssetTree.Child.Name=".PadRight(padRightNumber), toReturn.Child.Name ?? ""));

                if (toReturn.Child.Address != null)
                {
                    Console.WriteLine(string.Concat("AssetTree.Child.Address.Country=".PadRight(padRightNumber), toReturn.Child.Address.Country ?? ""));
                    Console.WriteLine(string.Concat("AssetTree.Child.Address.City=".PadRight(padRightNumber), toReturn.Child.Address.City ?? ""));
                    Console.WriteLine(string.Concat("AssetTree.Child.Address.Street=".PadRight(padRightNumber), toReturn.Child.Address.Street ?? ""));
                }
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #12
0
        public static Specialty Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Specialty with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Specialty,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs",
                        "WONServiceId",
                        "Instructions",
                        "TaxCode.*",
                        "Currencies.*"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Specialty toReturn = result as Specialty;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Specialty.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Specialty.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("Specialty.WONServiceId=".PadRight(padRightNumber), toReturn.WONServiceId.ToString()));
            Console.WriteLine(string.Concat("Specialty.Instructions=".PadRight(padRightNumber), toReturn.Instructions ?? ""));

            if (toReturn.TaxCode != null)
            {
                Console.WriteLine(string.Concat("Specialty.TaxCode.Id=".PadRight(padRightNumber), toReturn.TaxCode.Id.ToString()));
                Console.WriteLine(string.Concat("Specialty.TaxCode.DisplayAs=".PadRight(padRightNumber), toReturn.TaxCode.DisplayAs ?? ""));
            }

            if (toReturn.Currencies != null)
            {
                for (int i = 0; i < toReturn.Currencies.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Specialty.Currencies[{i}].Nte=".PadRight(padRightNumber), toReturn.Currencies[i].Nte?.ToString() ?? ""));
                    Console.WriteLine(string.Concat($"Specialty.Currencies[{i}].AvgCostAll=".PadRight(padRightNumber), toReturn.Currencies[i].AvgCostAll?.ToString() ?? ""));
                    Console.WriteLine(string.Concat($"Specialty.Currencies[{i}].AvgCostTech=".PadRight(padRightNumber), toReturn.Currencies[i].AvgCostTech?.ToString() ?? ""));
                    Console.WriteLine(string.Concat($"Specialty.Currencies[{i}].AvgCostVendor=".PadRight(padRightNumber), toReturn.Currencies[i].AvgCostVendor?.ToString() ?? ""));
                }
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #13
0
        public static Contact Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Contact with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Contact,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "DisplayAs",
                        "FirstName",
                        "LastName",
                        "TypeId",
                        "CustomerId",
                        "CanViewAnyRequest",
                        "CanCreateRequest ",
                        "PriorityThreshold",
                        "CustomFields.*",
                        "ContactAddresses.*",
                        "GroupsBridge.*",
                        "Username",
                        "Number",
                        "MustResetPassword",
                        "NoAlertEmails",
                        "Comment",
                        "Currencies.*",
                        "UnlimitedAuthorization",
                        "UnlimitedRequest"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Contact toReturn = result as Contact;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Contact.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Contact.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("Contact.FirstName=".PadRight(padRightNumber), toReturn.FirstName ?? ""));
            Console.WriteLine(string.Concat("Contact.LastName=".PadRight(padRightNumber), toReturn.LastName ?? ""));
            Console.WriteLine(string.Concat("Contact.TypeId=".PadRight(padRightNumber), toReturn.TypeId.ToString()));
            Console.WriteLine(string.Concat("Contact.CustomerId=".PadRight(padRightNumber), toReturn.CustomerId.ToString()));
            Console.WriteLine(string.Concat("Contact.CanViewAnyRequest=".PadRight(padRightNumber), toReturn.CanViewAnyRequest.ToString()));
            Console.WriteLine(string.Concat("Contact.CanCreateRequest =".PadRight(padRightNumber), toReturn.CanCreateRequest.ToString()));
            Console.WriteLine(string.Concat("Contact.PriorityThreshold=".PadRight(padRightNumber), toReturn.PriorityThreshold.ToString()));

            if (toReturn.CustomFields != null && toReturn.CustomFields.Length > 0)
            {
                for (int i = 0; i < toReturn.CustomFields.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Contact.CustomFields[{i}].Value=".PadRight(padRightNumber), toReturn.CustomFields[i].Value ?? ""));
                }
            }

            if (toReturn.ContactAddresses != null && toReturn.ContactAddresses.Length > 0)
            {
                for (int i = 0; i < toReturn.ContactAddresses.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Contact.ContactAddresses[{i}].Id=".PadRight(padRightNumber), toReturn.ContactAddresses[i].Id.ToString() ?? ""));
                }
            }

            if (toReturn.GroupsBridge != null && toReturn.GroupsBridge.Length > 0)
            {
                for (int i = 0; i < toReturn.GroupsBridge.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Contact.GroupsBridge[{i}].Id=".PadRight(padRightNumber), toReturn.GroupsBridge[i].Id.ToString() ?? ""));
                }
            }

            Console.WriteLine(string.Concat("Contact.Username="******""));
            Console.WriteLine(string.Concat("Contact.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));
            Console.WriteLine(string.Concat("Contact.MustResetPassword="******"Contact.NoAlertEmails=".PadRight(padRightNumber), toReturn.NoAlertEmails.ToString()));
            Console.WriteLine(string.Concat("Contact.Comment=".PadRight(padRightNumber), toReturn.Comment ?? ""));


            if (toReturn.Currencies != null && toReturn.Currencies.Length > 0)
            {
                for (int i = 0; i < toReturn.Currencies.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Contact.Currencies[{i}].AuthorizationLimit=".PadRight(padRightNumber), toReturn.Currencies[i].AuthorizationLimit?.ToString() ?? ""));
                    Console.WriteLine(string.Concat($"Contact.Currencies[{i}].NotificationThreshold=".PadRight(padRightNumber), toReturn.Currencies[i].NotificationThreshold?.ToString() ?? ""));
                    Console.WriteLine(string.Concat($"Contact.Currencies[{i}].RequestLimit=".PadRight(padRightNumber), toReturn.Currencies[i].RequestLimit?.ToString() ?? ""));
                }
            }

            Console.WriteLine(string.Concat("Contact.UnlimitedAuthorization=".PadRight(padRightNumber), toReturn.UnlimitedAuthorization.ToString()));
            Console.WriteLine(string.Concat("Contact.UnlimitedRequest=".PadRight(padRightNumber), toReturn.UnlimitedRequest.ToString()));

            Console.WriteLine();

            return(toReturn);
        }
예제 #14
0
        public static Task Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve Task with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.Task,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "ModelId",
                        "DisplayAs",
                        "Preventive",
                        "Routine",
                        "Corrective",
                        "Default",
                        "Symptom",
                        "CompletionTime",
                        "Specialty.*",
                        "PunchList.*",
                        "Priority.*",
                        "SelfHelpType",
                        "Instructions",
                        "SelfHelpContent",
                        "PeopleRequired",
                        "SkillLevel",
                        "GlAccount",
                        "Number",
                        "Currencies.*"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            Task toReturn = result as Task;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 35;

            Console.WriteLine(string.Concat("Task.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("Task.ModelId=".PadRight(padRightNumber), toReturn.ModelId.ToString()));

            var model = service.Retrieve(new EntitySpecifier {
                EntityType = EntityType.Model, Id = toReturn.ModelId
            }, new AllProperties()) as Model;

            if (model != null)
            {
                Console.WriteLine(string.Concat("Model.Name= ".PadRight(padRightNumber), $"'{model.DisplayAs}'"));
            }

            Console.WriteLine(string.Concat("Task.DisplayAs=".PadRight(padRightNumber), toReturn.DisplayAs ?? ""));
            Console.WriteLine(string.Concat("Task.Preventive=".PadRight(padRightNumber), toReturn.Preventive.ToString()));
            Console.WriteLine(string.Concat("Task.Routine=".PadRight(padRightNumber), toReturn.Routine.ToString()));
            Console.WriteLine(string.Concat("Task.Corrective=".PadRight(padRightNumber), toReturn.Corrective.ToString()));
            Console.WriteLine(string.Concat("Task.Default=".PadRight(padRightNumber), toReturn.Default.ToString()));
            Console.WriteLine(string.Concat("Task.Symptom=".PadRight(padRightNumber), toReturn.Symptom.ToString()));
            Console.WriteLine(string.Concat("Task.CompletionTime=".PadRight(padRightNumber), toReturn.CompletionTime.ToString()));

            if (toReturn.Specialty != null)
            {
                Console.WriteLine(string.Concat("Task.Specialty.Id=".PadRight(padRightNumber), toReturn.Specialty.Id.ToString()));
                Console.WriteLine(string.Concat("Task.Specialty.DisplayAs=".PadRight(padRightNumber), toReturn.Specialty.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("Task.Specialty.Instructions=".PadRight(padRightNumber), toReturn.Specialty.Instructions));
            }

            if (toReturn.PunchList != null)
            {
                Console.WriteLine(string.Concat("Task.PunchList.Id=".PadRight(padRightNumber), toReturn.PunchList.Id.ToString()));
                Console.WriteLine(string.Concat("Task.PunchList.DisplayAs=".PadRight(padRightNumber), toReturn.PunchList.DisplayAs ?? ""));
            }

            if (toReturn.Priority != null)
            {
                Console.WriteLine(string.Concat("Task.Priority.Id=".PadRight(padRightNumber), toReturn.Priority.Id.ToString()));
                Console.WriteLine(string.Concat("Task.Priority.DisplayAs=".PadRight(padRightNumber), toReturn.Priority.DisplayAs ?? ""));
            }

            if (toReturn.SelfHelpType != null)
            {
                Console.WriteLine(string.Concat("Task.SelfHelpType=".PadRight(padRightNumber), toReturn.SelfHelpType.ToString()));
            }

            Console.WriteLine(string.Concat("Task.Instructions=".PadRight(padRightNumber), toReturn.Instructions ?? ""));
            Console.WriteLine(string.Concat("Task.SelfHelpContent=".PadRight(padRightNumber), toReturn.SelfHelpContent ?? ""));
            Console.WriteLine(string.Concat("Task.PeopleRequired=".PadRight(padRightNumber), toReturn.PeopleRequired.ToString()));
            Console.WriteLine(string.Concat("Task.SkillLevel=".PadRight(padRightNumber), toReturn.SkillLevel.ToString()));

            Console.WriteLine(string.Concat("Task.GlAccount=".PadRight(padRightNumber), toReturn.GlAccount ?? ""));
            Console.WriteLine(string.Concat("Task.Number=".PadRight(padRightNumber), toReturn.Number ?? ""));

            if (toReturn.Currencies != null)
            {
                for (int i = 0; i < toReturn.Currencies.Length; i++)
                {
                    Console.WriteLine(string.Concat($"Task.Currencies[{i}].Nte=".PadRight(padRightNumber), toReturn.Currencies[i].Nte?.ToString() ?? ""));
                }
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #15
0
        public static WoActionLog Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve WoActionLog with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.WoActionLog,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "Id",
                        "WorkOrderId",
                        "TypeId",
                        "Actor.*",
                        "ActionDate",
                        "Comment",
                        "ActionReasonId",
                        "UiTypeId",
                        "TimeZone",
                        "SystemDateUtc",
                        "ObjectId",
                        "Properties.*"
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            WoActionLog toReturn = result as WoActionLog;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 45;

            Console.WriteLine(string.Concat("WoActionLog.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.WorkOrderId=".PadRight(padRightNumber), toReturn.WorkOrderId.ToString()));

            var wo = service.Retrieve(new EntitySpecifier {
                EntityType = EntityType.WorkOrder, Id = toReturn.WorkOrderId
            }, new AllProperties()) as WorkOrder;

            if (wo != null)
            {
                Console.WriteLine(string.Concat("WorkOrder.Number= ".PadRight(padRightNumber), $"'{wo.Number}'"));
            }

            Console.WriteLine(string.Concat("WoActionLog.TypeId=".PadRight(padRightNumber), toReturn.TypeId.ToString()));

            if (toReturn.Actor != null)
            {
                Console.WriteLine(string.Concat("WoActionLog.Actor.Id=".PadRight(padRightNumber), toReturn.Actor.Id.ToString()));
                Console.WriteLine(string.Concat("WoActionLog.Actor.DisplayAs=".PadRight(padRightNumber), toReturn.Actor.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("WoActionLog.Actor.TypeId=".PadRight(padRightNumber), toReturn.Actor.TypeId.ToString()));
            }

            Console.WriteLine(string.Concat("WoActionLog.ActionDate=".PadRight(padRightNumber), toReturn.ActionDate.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.Comment=".PadRight(padRightNumber), toReturn.Comment ?? ""));
            Console.WriteLine(string.Concat("WoActionLog.ActionReasonId=".PadRight(padRightNumber), toReturn.ActionReasonId.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.UiTypeId=".PadRight(padRightNumber), toReturn.UiTypeId.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.TimeZone=".PadRight(padRightNumber), toReturn.TimeZone.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.SystemDateUtc=".PadRight(padRightNumber), toReturn.SystemDateUtc.ToString()));
            Console.WriteLine(string.Concat("WoActionLog.ObjectId=".PadRight(padRightNumber), toReturn.ObjectId.ToString()));

            int i = 0;

            if (toReturn.Properties != null && toReturn.Properties.Length > 0)
            {
                foreach (var property in toReturn.Properties)
                {
                    Console.WriteLine(string.Concat($"WoActionLog.Properties[{i}].Id=".PadRight(padRightNumber), property.Id));
                    Console.WriteLine(string.Concat($"WoActionLog.Properties[{i}].TypeId=".PadRight(padRightNumber), property.TypeId));
                    Console.WriteLine(string.Concat($"WoActionLog.Properties[{i}].ValueStr=".PadRight(padRightNumber), property.ValueStr ?? ""));
                    Console.WriteLine(string.Concat($"WoActionLog.Properties[{i}].ValueInt=".PadRight(padRightNumber), property.ValueInt));
                    i++;
                }
            }

            Console.WriteLine();

            return(toReturn);
        }
예제 #16
0
        public static WoLastAction Retrieve(CorrigoService service, int id)
        {
            Console.WriteLine();
            Console.WriteLine($"Retrieve WoLastAction with id={id}");
            CorrigoEntity result = null;

            try
            {
                result = service.Retrieve(
                    new EntitySpecifier
                {
                    EntityType = EntityType.WoLastAction,
                    Id         = id
                },
                    new PropertySet
                {
                    Properties = new string[]
                    {
                        "*",
                        "LastAction.*", "LastAction.Actor.*",
                        "EmergencyReason.*",
                        "Reason.*",
                        "Invoice.*",
                        "BilledTotal.*",
                    }
                }
                    //new AllProperties()
                    );
            }
            catch (Exception e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            WoLastAction toReturn = result as WoLastAction;

            if (toReturn == null)
            {
                Console.WriteLine("Retrieve failed");
                return(null);
            }

            int padRightNumber = 45;

            Console.WriteLine(string.Concat("WoLastAction.Id=".PadRight(padRightNumber), toReturn.Id.ToString()));
            Console.WriteLine(string.Concat("WoLastAction.WorkOrderId=".PadRight(padRightNumber), toReturn.WorkOrderId.ToString()));

            var wo = service.Retrieve(new EntitySpecifier {
                EntityType = EntityType.WorkOrder, Id = toReturn.WorkOrderId
            }, new AllProperties()) as WorkOrder;

            if (wo != null)
            {
                Console.WriteLine(string.Concat("WorkOrder.Number= ".PadRight(padRightNumber), $"'{wo.Number}'"));
            }

            if (toReturn.EmergencyReason != null)
            {
                Console.WriteLine(string.Concat("WoLastAction.EmergencyReason.Id=".PadRight(padRightNumber), toReturn.EmergencyReason.Id.ToString()));
                Console.WriteLine(string.Concat("WoLastAction.EmergencyReason.DisplayAs=".PadRight(padRightNumber), toReturn.EmergencyReason.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("WoLastAction.EmergencyReason.ReasonId=".PadRight(padRightNumber), toReturn.EmergencyReason.ReasonId.ToString()));
            }

            if (toReturn.Reason != null)
            {
                Console.WriteLine(string.Concat("WoLastAction.Reason.Id=".PadRight(padRightNumber), toReturn.Reason.Id.ToString()));
                Console.WriteLine(string.Concat("WoLastAction.Reason.DisplayAs=".PadRight(padRightNumber), toReturn.Reason.DisplayAs ?? ""));
                Console.WriteLine(string.Concat("WoLastAction.Reason.ReasonId=".PadRight(padRightNumber), toReturn.Reason.ReasonId.ToString()));
            }

            Console.WriteLine(string.Concat("WoLastAction.BillStatus=".PadRight(padRightNumber), toReturn.BillStatus.ToString()));

            if (toReturn.Invoice != null)
            {
                Console.WriteLine(string.Concat("WoLastAction.Invoice.Id=".PadRight(padRightNumber), toReturn.Invoice.Id.ToString()));
                Console.WriteLine(string.Concat("WoLastAction.Invoice.Comments=".PadRight(padRightNumber), toReturn.Invoice.Comments ?? ""));
                Console.WriteLine(string.Concat("WoLastAction.Invoice.Number=".PadRight(padRightNumber), toReturn.Invoice.Number ?? ""));
            }


            Console.WriteLine(string.Concat("WoLastAction.BilledTotal.Value= ".PadRight(padRightNumber), toReturn.BilledTotal?.Value.ToString() ?? ""));
            Console.WriteLine(string.Concat("WoLastAction.Xnumber= ".PadRight(padRightNumber), toReturn.XNumber ?? ""));


            Console.WriteLine();

            return(toReturn);
        }