Beispiel #1
0
        public SageWorkOrderItem[] EditWorkOrderItem(SageWorkOrderItem workOrderItem)
        {
            var properties = new Dictionary <string, string>();

            properties.Add("ItemType", workOrderItem.ItemType ?? string.Empty);
            properties.Add("Employee", workOrderItem.Employee ?? string.Empty);
            properties.Add("Quantity", workOrderItem.Quantity.ToString() ?? string.Empty);
            properties.Add("WorkDate", workOrderItem.WorkDate.ToString() ?? string.Empty);
            properties.Add("UnitSale", workOrderItem.UnitSale.ToString() ?? string.Empty);
            properties.Add("WorkOrder", workOrderItem.WorkOrder.ToString() ?? string.Empty);
            properties.Add("WorkOrderItem", workOrderItem.WorkOrderItem.ToString() ?? string.Empty);

            if (workOrderItem.ItemType == "Labor")
            {
                properties.Add("CostQuantity", workOrderItem.CostQuantity.ToString() ?? string.Empty);
                properties.Add("Repair", workOrderItem.Repair.ToString() ?? string.Empty);
            }
            if (workOrderItem.ItemType == "Parts")
            {
                properties.Add("Part", workOrderItem.Part.ToString() ?? string.Empty);
            }

            var propertiesStr = string.Empty;

            foreach (var property in properties)
            {
                propertiesStr += string.Format(Messages.Property, property.Key, property.Value.Sanitize());
            }

            var messages       = string.Format(Messages.EditWorkOrderItem, propertiesStr);
            var response       = SendMessage(messages);
            var workOrderItems = (response as MessageResponses).MessageResponse.ReturnParams.ReturnParam.WorkOrderItems;

            return(workOrderItems);
        }
Beispiel #2
0
 public SageResponse <SageWorkOrderItem> AddOrEditWorkOrderItem(SageWorkOrderItem workOrderItem)
 {
     if (workOrderItem.WorkOrderItem == 0)
     {
         return(Add(workOrderItem, EndPoints.AddWorkOrderItem));
     }
     else
     {
         return(Edit(workOrderItem, EndPoints.EditWorkOrderItem));
     }
 }
Beispiel #3
0
 public SageResponse <SageWorkOrderItem> EditEquipment(SageWorkOrderItem workOrderItem)
 {
     try
     {
         var result = new SageResponse <SageWorkOrderItem> {
             IsSucceed = true, Entity = serviceManager.EditWorkOrderItem(workOrderItem).Single()
         };
         return(result);
     }
     catch (ResponseException exception)
     {
         var result = new SageResponse <SageWorkOrderItem> {
             IsSucceed = false, ErrorMassage = exception.Error.Message
         };
         return(result);
     }
 }
Beispiel #4
0
 public SageResponse <SageWorkOrderItem> EditWorkOrderItem(SageWorkOrderItem workOrderItem)
 {
     return(Edit(workOrderItem, EndPoints.EditWorkOrderItem));
 }
Beispiel #5
0
 public SageResponse <SageWorkOrderItem> AddWorkOrderItem(SageWorkOrderItem workOrderItem)
 {
     return(Add(workOrderItem, EndPoints.AddWorkOrderItem));
 }