public void getWorkOrderByCustomerId() { #region Authenticate and create proxies Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var workforceService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(ah); #endregion //Instantiate the request object and define filter criteria //GetWorkOrdersRequest implements the BaseQueryRequest, so you can filter, sort, //and page the returned records. //You can use the properties of WorkOrder to filter and sort. GetWorkOrdersRequest request = new GetWorkOrdersRequest(); request.FilterCriteria.Add("CustomerId", 16190); request.FilterCriteria.Add("WorkOrderStatusId", 1); #region Get the customer's work orders and display the results. WorkOrderCollection coll = workforceService.GetWorkOrders(request); if (coll != null && coll.Items.Count > 0) { foreach (WorkOrder w in coll) { Console.WriteLine("Found Work Order ID = {0}; Create Date = {1}", w.Id, w.RegisteredDateTime); } } else { Console.WriteLine("Sorry--No work orders found."); } Console.ReadLine(); #endregion }
public WorkOrderCollection GetTop5WorkOrders() { WorkOrderCollection workOrderCollection = new WorkOrderCollection(); using (IDataReader dr = new WorkOrderDataAdapter().GetTop5WorkOrders()) { while (dr.Read()) { workOrderCollection.Add(PopulateReader(dr)); } dr.Close(); } return workOrderCollection; }
public void getWorkOrderUpdateWorkOrder() { #region Authenticate and create proxies Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var workforceService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceService>(ah); #endregion //Instantiate the request object and define filter criteria //GetWorkOrdersRequest implements the BaseQueryRequest, so you can filter, sort, //and page the returned records. //You can use the properties of WorkOrder to filter and sort. GetWorkOrdersRequest request = new GetWorkOrdersRequest(); request.FilterCriteria.Add("CustomerId", 16190); request.FilterCriteria.Add("WorkOrderStatusId", 1); #region Get the customer's work orders and display the results. WorkOrderCollection coll = workforceService.GetWorkOrders(request); if (coll != null && coll.Items.Count > 0) { foreach (WorkOrder w in coll) { Console.WriteLine("Found Work Order ID = {0}; Create Date = {1}", w.Id, w.RegisteredDateTime); } } else { Console.WriteLine("Sorry--No work orders found."); } Console.ReadLine(); #endregion //Now, instantiate a new WorkOrder and call GetWorkOrder to populate it with the // values of the work order you want to change. //"1333" is the ID of the work order you want to change. WorkOrder workOrder = workforceService.GetWorkOrder(1333); //Pass in the values you want to change. //workOrder.ServiceProviderId = 32086; //workOrder.AddressId = 1215; workOrder.ProblemDescription = "bbbbbbbbbbbbbbbbbbbbbbb"; //"0" is the default reason. ICC throws an error if a default reason is not configured. //int reasonKey = 0; int reasonKey = 12; // for update problem description field //Call UpdateWorkOrder to update the work order and display the results. WorkOrder updatedWorkOrder = workforceService.UpdateWorkOrder(workOrder, reasonKey); Console.WriteLine("Updated WorkOrder ID {0}; Service Provider ID = {1}", updatedWorkOrder.Id, updatedWorkOrder.ServiceProviderId); Console.ReadLine(); }
public WorkOrderCollection GetTop5Materials() { WorkOrderCollection workOrderCollection = new WorkOrderCollection(); using (IDataReader dr = new WorkOrderDataAdapter().GetTop5Materials()) { while (dr.Read()) { WorkOrder workOrder = new WorkOrder(); workOrder.MaterialId = dr["MaterialId"].ToString(); workOrderCollection.Add(workOrder); } dr.Close(); } return workOrderCollection; }
public WorkOrderCollection GetTop5Customers() { WorkOrderCollection workOrderCollection = new WorkOrderCollection(); using (IDataReader dr = new WorkOrderDataAdapter().GetTop5Customers()) { while (dr.Read()) { WorkOrder workOrder = new WorkOrder(); workOrder.CustomerId = Convert.ToInt32(dr["CustomerId"]); workOrderCollection.Add(workOrder); } dr.Close(); } return workOrderCollection; }
public async Task <bool> InsertWorkOrderCollectionAsync() { try { var date = DateTime.UtcNow; var coll = _mongoDB.GetCollection <WorkOrderCollection>("RITEWorkOrderCollection"); List <WorkOrderCollection> woCollection = new List <WorkOrderCollection>(); WorkOrderCollection col1 = new WorkOrderCollection(); WorkOrder wo = new WorkOrder() { WorkOrderId = 9629787, MaintenanceId = "MNT9629787", WOType = "MNT", Status = "PL", TestCode = "SL", TestLevel = 1, AssignedTo = "vgade2", WOSource = "RITE-UI", CreationDate = date, CreatedBy = "vgade2", LastModifieBy = "vgade2", LastModifiedDate = date, WODate = date }; WorkOrderAsset woa = new WorkOrderAsset() { EquipmentId = 2547362, Equipment_Code = "1-23ZA", Serial_No = "RITECOLO", Part_No = "1-23ZA", CreationDate = date, CreatedBy = "vgade2", LastModifieBy = "vgade2", LastModifiedDate = date }; WorkOrderPart wop = new WorkOrderPart() { PartId = 1, Part_No = "1-23ZA", Fr_No = "FR1234", CreationDate = date, CreatedBy = "vgade2", LastModifieBy = "vgade2", LastModifiedDate = date }; Organization o = new Organization() { AU = 715123, AUDesc = "BRLC-WL10", CreationDate = date, CreatedBy = "vgade2", LastModifieBy = "vgade2", LastModifiedDate = date }; col1.WORKORDER = wo; col1.EQUIPMENT = woa; col1.PART = wop; col1.ORGANIZATION_DETAILS = o; col1.DELETED = false; col1.PACKET_RECEIVED_DATE = DateTime.UtcNow; col1.TotalCount = 1; woCollection.Add(col1); await Task.Delay(100); WorkOrderCollection col2 = new WorkOrderCollection(); WorkOrder wo1 = new WorkOrder() { WorkOrderId = 9629788, MaintenanceId = "MNT9629788", WOType = "MNT", Status = "PL", TestCode = "SL", TestLevel = 1, AssignedTo = "ppanda2", WOSource = "RITE-UI", CreationDate = date, CreatedBy = "ppanda2", LastModifieBy = "ppanda2", LastModifiedDate = date, WODate = date }; WorkOrderAsset woa1 = new WorkOrderAsset() { EquipmentId = 2547340, Equipment_Code = "USIS-B", Serial_No = "23Jan2020", Part_No = "100127894", CreationDate = date, CreatedBy = "ppanda2", LastModifieBy = "ppanda2", LastModifiedDate = date }; WorkOrderPart wop1 = new WorkOrderPart() { PartId = 2, Part_No = "100127894", Fr_No = "FR123456", CreationDate = date, CreatedBy = "ppanda2", LastModifieBy = "ppanda2", LastModifiedDate = date }; Organization o1 = new Organization() { AU = 713436, AUDesc = "INRJ-WL10", CreationDate = date, CreatedBy = "ppanda2", LastModifieBy = "ppanda2", LastModifiedDate = date }; col1.WORKORDER = wo; col1.EQUIPMENT = woa; col1.PART = wop; col1.ORGANIZATION_DETAILS = o; col1.DELETED = false; col1.PACKET_RECEIVED_DATE = DateTime.UtcNow; col1.TotalCount = 2; woCollection.Add(col2); coll.InsertMany(woCollection); } catch (Exception e) { return(false); } return(true); }
public bool InsertAndUpdateWorkOrder(WorkOrderCollection equipment) { throw new NotImplementedException(); }
public WorkOrderCollection GetWorkOrdersByCustomerName(string name) { WorkOrderCollection workOrderCollection = new WorkOrderCollection(); using (IDataReader dr = new WorkOrderDataAdapter().GetWorkOrdersByCustomerName(name)) { while (dr.Read()) { workOrderCollection.Add(PopulateReader(dr)); } dr.Close(); } return workOrderCollection; }