public static void DeleteRepairCode(CorrigoService service, int repairCodeId) => Delete.Execute(service, repairCodeId);
public static CorrigoEntity[] RetrieveMultiple(CorrigoService service) { var list = service.RetrieveMultiple( new QueryByProperty { EntityType = EntityType.Document, //PropertySet = new AllProperties(), PropertySet = new PropertySet { Properties = new string[] { "Id", "ActorId", "ActorTypeId", "Description", "Title", "DocType.*", "EndDate", "StartDate", "UpdatedDate", "ExtensionId", "StorageTypeId", "MimeType", "UpdatedBy.*", "WonId", "WonMemberId", "Blob.*" } }, Conditions = new PropertyValuePair[0], Orders = new[] { new OrderExpression { OrderType = OrderType.Ascending, PropertyName = "Id" } }, }); Console.WriteLine(); Console.WriteLine("Documents: Retrieve Multiple"); if (list == null || list.Length == 0) { return(list); } Console.WriteLine(string.Concat("#".PadLeft(4), "|", "Id".PadLeft(4), "|", "ActorId".PadLeft(7), "|", "Title".PadRight(40), "|", "Description".PadRight(55), "|", "DocType.DisplayAs".PadRight(17), "|", "MimeType".PadRight(45), "|", "ActorTypeId".PadRight(15), "|", "File Name".PadRight(35))); int i = 0; foreach (Document item in list) { i++; Console.WriteLine(string.Concat(i.ToString().PadLeft(4), "|", item.Id.ToString().PadLeft(4), "|", item.ActorId.ToString().PadLeft(7), "|", item.Title.PadRight(40), "|", item.Description.PadRight(55), "|", item.DocType.DisplayAs.PadRight(17), "|", item.MimeType.PadRight(45), "|", item.ActorTypeId.ToString().PadRight(15), "|", item.Blob?.FileName ?? "")); } Console.WriteLine(); return(list); }
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); }
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); }
public static int?ReadActionReasonLookup(CorrigoService service, int workOrderId) => Read.Retreive(service, workOrderId);
public static void Cancel(CorrigoService service, int id, int actionReasonId = 1794) { WoCancelCommand_Execute(service, id, actionReasonId); }
public static WorkOrderCostId Execute(CorrigoService service) { var workOrder = CreateWorkOrder(service); workOrder.WorkOrderCost.CustomerNte.Value = 28.98m; workOrder.WorkOrderCost.CustomerNte.CurrencyTypeId = CurrencyType.USD; //workOrder.WorkOrderCost.CostState = CostState.Pending; workOrder.WorkOrderCost.BillingRule = BillingRule.NotBilled; //workOrder.WorkOrderCost.BillToType = BillToType.Customer; //workOrder.WorkOrderCost.BillingAccount = new BillingAccount //{ //}; //workOrder.WorkOrderCost.ChargeCode = new ChargeCodeLookup { Code = "some charge code", Id = 0 }; //workOrder.WorkOrderCost.TaxStatus = TaxValidationStatus.Success; //workOrder.WorkOrderCost.Items = new[] { new FinancialItem //{ // CostCategoryId = CostCategory.Services, // Quantity = 10, // Amount = 56.23m, //} }; //var workOrderCost = new WorkOrderCost //{ // CustomerNte = 28.98m, // CostState = CostState.Pending, // BillToType = BillToType.Customer, // //ChargeCode = new ChargeCodeLookup // //{ // // DisplayAs = "display as charge code", // // Code = "some charge code", // //}, // //Items = new[] // // { // // new FinancialItem // // { // // CostCategoryId = CostCategory.Services, // // Quantity = 10, // // Amount = 56.23m, // // } // // } //}; var command = new UpdateCommand { Entity = workOrder, //PropertySet = new PropertySet { Properties = new[] { "WorkOrderCost.*" } } PropertySet = new PropertySet { Properties = new[] { "WorkOrderCost.CustomerNte", "WorkOrderCost.BillingRule", //"WorkOrderCost.ChargeCode.*", //"WorkOrderCost.Items.*", } } }; var response = service.Execute(command) as OperationCommandResponse; var woCostId = response?.EntitySpecifier?.Id ?? 0; Debug.Print(response?.ErrorInfo?.Description ?? $"Successfully created {nameof(WorkOrder.WorkOrderCost)} with id '{woCostId}'" + $" for WorkOrder with id '{workOrder.Id}'"); return(new WorkOrderCostId { WoId = workOrder.Id, CostId = woCostId }); }
public static void CreateWorkOrderAndUpdateCustomFields(CorrigoService service) { WorkOrder createdWo = Create.Execute(service, true, true); var cfResponse = Update.SetCustomFieldValueToWO(service, createdWo); }
public static WorkOrder Execute(CorrigoService service, bool computeAssignment, bool computeSchedule) { //WorkOrder requires WorkZone for its creation //default time zone is UTC-12, therefore provide WorkOrder with time zone from WorkZone var workZone = (WorkZone)service.Retrieve( new EntitySpecifier { Id = WorkZoneId, EntityType = EntityType.WorkZone }, new PropertySet { Properties = new[] { "Id", "TimeZone" } }); var workOrder = new WorkOrder { Items = new[] //required { new WoItem { Asset = new Location { Id = SpaceUnitSubAssetId }, //required Task = new Task { Id = TaskId } //required } }, Customer = new Customer { Id = CustomerId }, //required //WorkZone = workZone, //TimeZone = workZone.TimeZone, //Priority = new WoPriority { Id = 1 }, //MainAsset = new Location { Id = SpaceUnitAssetId }, SubType = new WorkOrderType { Id = SubTypeId }, //required //StatusId = WorkOrderStatus.New, //ContactName = "John Smith", ContactAddress = new ContactInfo //required for request at least { Address = "San Francisco", //required //ActorTypeId = ActorType.Asset, AddrTypeId = ContactAddrType.Contact //required }, TypeCategory = WOType.Request, //required //CreatedDateUtc = DateTime.UtcNow, //DueDateUtc = DateTime.UtcNow, //DtUtcOnSiteBy = DateTime.UtcNow, //DtScheduledStart = DateTime.UtcNow, //ScheduledStartUtc = DateTime.UtcNow, }; var command = new WoCreateCommand { WorkOrder = workOrder, Comment = string.Empty, ComputeAssignment = computeAssignment, ComputeSchedule = computeSchedule, SkipBillToLogic = false }; var response = service.Execute(command) as WoActionResponse; if (response.ErrorInfo != null) { Debug.Print(response.ErrorInfo.Description); } return(response?.Wo); }
public static WoActionResponse DeleteWorkOrder(CorrigoService service, int id) { return(Delete.Execute(service, id)); }
public static int CreateCustomFieldForWorkOrder(CorrigoService service, int woid) => Operations.CustomFields.Create.Execute(service, woid);
public static WorkOrder RetrieveWorkOrder(CorrigoService service, int id) { return(Read.Execute(service, id)); }
public static int CreateRepairCode(CorrigoService service, int repairCategoryId) => Create.Execute(service, repairCategoryId, "Repair Code Z");
public static int CreateRepairCategory(CorrigoService service) => Create.Execute(service, 0, "Repair Category Y");
public static void Reopen(CorrigoService service, int id) { WoReopenCommand_Execute(service, id); }
public static CorrigoEntity[] RetrieveByQuery(CorrigoService service, int countNumber = 500) { var list = service.RetrieveMultiple( new QueryExpression { Count = countNumber, EntityType = EntityType.AssetTree, PropertySet = new PropertySet { Properties = new string[] { "Id", "ParentId", "ChildId", "Child.*", "Child.Address.*", "Distance" } }, Criteria = new FilterExpression { Conditions = new ConditionExpression[] { new ConditionExpression { PropertyName = "Child.Address.City", Operator = ConditionOperator.NotNull, //Values = new object[] {"CA"} }, new ConditionExpression { PropertyName = "Child.Address.City", Operator = ConditionOperator.NotIn, Values = new object[] { "", " ", " ", " " } } }, FilterOperator = LogicalOperator.And }, Orders = new[] { new OrderExpression { OrderType = OrderType.Descending, PropertyName = "Id" } }, }); Console.WriteLine(); Console.WriteLine($"AssetTrees: Retrieve by query - Top {countNumber} Child assets which reside in cities"); if (list == null || list.Length == 0) { return(list); } Console.WriteLine(string.Concat("#".PadLeft(4), "|", "Id".PadLeft(4), "|", "ParentId".PadRight(10), "|", "ChildId".PadRight(10), "|", "Child.Name".PadRight(40), "|", "Child.Address.City".PadRight(40))); int i = 0; foreach (AssetTree item in list) { i++; Console.WriteLine(string.Concat(i.ToString().PadLeft(4), "|", item.Id.ToString().PadLeft(4), "|", item.ParentId.ToString().PadRight(10), "|", item.ChildId.ToString().PadRight(10), "|", item.Child.Name.PadRight(40), "|", item.Child.Address?.City ?? "".PadRight(40))); } Console.WriteLine(); return(list); }
public static void OnHold(CorrigoService service, int id, int actionReasonId = 1286) { WoOnHoldCommand_Execute(service, id, actionReasonId); }
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); }
public static void Complete(CorrigoService service, int id, int repairCodeId = 6) { WoCompleteCommand_Execute(service, id, repairCodeId); }
public static Employee Execute(CorrigoService service) { Debug.Print("Creating Employee"); Console.WriteLine("Creating Employee"); Random rnd = new Random(); int randNmbr = rnd.Next(0, 25); char[] alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); string suffix = String.Concat("_", alpha[randNmbr], randNmbr.ToString()); var toCreate = new Employee { FirstName = "FN" + suffix, LastName = "LN" + suffix, DisplayAs = "FN.LN_" + suffix + $".ByWSDK.{DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}", Username = "******" + suffix, Password = "******" + suffix + "!Hey-Ya!", ActorTypeId = ActorType.Employee, WonServiceRadius = 1, Role = new Role { Id = 1 }, Number = "Number" + suffix, FederalId = "FederalId" + suffix, ExternalId = "ExternalId" + suffix }; var resultData = service.Execute(new CreateCommand { Entity = toCreate }); if (resultData == null) { Debug.Print("Creation of new Employee failed"); Console.WriteLine("Creation of new Employee failed"); Console.WriteLine(); return(null); } var commandResponse = resultData as OperationCommandResponse; int?id = (commandResponse != null && commandResponse.EntitySpecifier != null) ? commandResponse.EntitySpecifier.Id : null; if (id.HasValue && resultData.ErrorInfo == null) { toCreate.Id = id.Value; Debug.Print($"Created new Employee with Id={id.ToString()}"); Console.WriteLine($"Created new Employee with Id={id.ToString()}"); Console.WriteLine(); return(toCreate); } Debug.Print("Creation of new Employee failed"); Console.WriteLine("Creation of new Employee failed"); Console.WriteLine(); if (resultData.ErrorInfo != null && !string.IsNullOrEmpty(resultData.ErrorInfo.Description)) { Debug.Print(resultData.ErrorInfo.Description); Console.WriteLine(resultData.ErrorInfo.Description); } return(null); }
private static WorkOrder CreateWorkOrder(CorrigoService service) { var workZone = (WorkZone)service.Retrieve( new EntitySpecifier { Id = 28, EntityType = EntityType.WorkZone }, new PropertySet { Properties = new[] { "Id", "TimeZone" } }); var workOrder = new WorkOrder { Items = new[] { new WoItem { Asset = new Location { Id = 173 }, Task = new Task { Id = 14096 } } }, Customer = new Customer { Id = 14 }, WorkZone = workZone, TimeZone = workZone.TimeZone, //WorkOrderCost = workOrderCost, Priority = new WoPriority { Id = 2 }, MainAsset = new Location { Id = 173 }, SubType = new WorkOrderType { Id = 4 }, StatusId = WorkOrderStatus.New, ContactName = "Somerset Moehm", ContactAddress = new ContactInfo { Address = "San Francisco", ActorTypeId = ActorType.Asset, AddrTypeId = ContactAddrType.Contact }, TypeCategory = WOType.Request, //required }; var command = new WoCreateCommand { WorkOrder = workOrder, Comment = string.Empty, ComputeAssignment = true, ComputeSchedule = false, SkipBillToLogic = false }; var response = service.Execute(command) as WoActionResponse; return(response?.Wo); }
public static void Assign(CorrigoService service, int id) { WoAssignCommand_Execute(service, id); }
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); }
public static void PickUp(CorrigoService service, int id) { WoPickUpCommand_Execute(service, id); }
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); }
public static void Start(CorrigoService service, int id) { WoStartCommand_Execute(service, id); }
public static CorrigoEntity[] RetrieveByQuery(CorrigoService service) { var list = service.RetrieveMultiple( new QueryExpression { EntityType = EntityType.Document, //PropertySet = new AllProperties(), PropertySet = new PropertySet { Properties = new string[] { "Id", "ActorId", "ActorTypeId", "Description", "Title", "DocType.*", "EndDate", "StartDate", "UpdatedDate", "ExtensionId", "StorageTypeId", "MimeType", "UpdatedBy.*", "WonId", "WonMemberId", "Blob.*" } }, Criteria = new FilterExpression { Conditions = new ConditionExpression[] { new ConditionExpression { PropertyName = "StorageTypeId", Operator = ConditionOperator.Equal, Values = new object[] { DocumentStorageType.URL } } }, FilterOperator = LogicalOperator.Or }, Orders = new[] { new OrderExpression { OrderType = OrderType.Descending, PropertyName = "Id" } }, }); Console.WriteLine(); Console.WriteLine("Documents: Retrieve by query - Links"); if (list == null || list.Length == 0) { return(list); } Console.WriteLine(string.Concat("#".PadLeft(4), "|", "Id".PadLeft(4), "|", "ActorId".PadLeft(7), "|", "Title".PadRight(30), "|", "Description".PadRight(30), "|", "DocType.DisplayAs".PadRight(17), "|", "MimeType".PadRight(25), "|", "ActorTypeId".PadRight(15), "|", "File Name".PadRight(35))); int i = 0; foreach (Document item in list) { i++; Console.WriteLine(string.Concat(i.ToString().PadLeft(4), "|", item.Id.ToString().PadLeft(4), "|", item.ActorId.ToString().PadLeft(7), "|", item.Title.PadRight(30), "|", item.Description.PadRight(30), "|", item.DocType.DisplayAs.PadRight(17), "|", item.MimeType.PadRight(25), "|", item.ActorTypeId.ToString().PadRight(15), "|", item.Blob?.FileName ?? "")); } Console.WriteLine(); return(list); }
public static void Pause(CorrigoService service, int id) { WoPauseCommand_Execute(service, id); }
public static CorrigoEntity[] RetrieveByQuery(CorrigoService service) { var list = service.RetrieveMultiple( new QueryExpression { EntityType = EntityType.WorkZone, PropertySet = new PropertySet { Properties = new string[] { "Id", "DisplayAs", "TimeZone", "Contract.*", "TaxRegion.*", "Asset.*", "Number" } }, Criteria = new FilterExpression { Conditions = new ConditionExpression[] { new ConditionExpression { PropertyName = "Contract.Id", Operator = ConditionOperator.GreaterThan, Values = new object[] { 0 } } }, FilterOperator = LogicalOperator.Or }, Orders = new[] { new OrderExpression { OrderType = OrderType.Descending, PropertyName = "Id" } }, }); Console.WriteLine(); Console.WriteLine("WorkZones: Retrieve by query - having contract"); if (list == null || list.Length == 0) { return(list); } Console.WriteLine(string.Concat("#".PadLeft(4), "|", "Id".PadLeft(4), "|", "DisplayAs".PadRight(50), "|", "Asset.Id".PadRight(10), "|", "TimeZone".PadRight(10), "|", "Number".PadRight(40), "|", "Contract.Id".PadRight(20), "|", "TaxRegion.Id".PadRight(20))); int i = 0; foreach (WorkZone item in list) { i++; Console.WriteLine(string.Concat(i.ToString().PadLeft(4), "|", item.Id.ToString().PadLeft(4), "|", item.DisplayAs.PadRight(50), "|", item.Asset.Id.ToString().PadRight(10), "|", item.TimeZone.ToString().PadRight(10), "|", (item.Number ?? "").PadRight(40), "|", item.Contract?.Id.ToString().PadRight(20), "|", (item.TaxRegion == null ? "" : item.TaxRegion.Id.ToString()).PadRight(20))); } Console.WriteLine(); return(list); }
public static RepairCode RetrieveRepairCode(CorrigoService service, int repairCodeId) => Read.Retrieve(service, repairCodeId);