internal RequiredInventoryElement GetRequiredInventoryElement() { var requiredInventoryElement = new RequiredInventoryElement(); requiredInventoryElement.type = Type; requiredInventoryElement.quantity = Quantity; requiredInventoryElement.model = (Model != null) ? Model : null; return requiredInventoryElement; }
internal RequiredInventoryElement GetRequiredInventoryElement() { var requiredInventoryElement = new RequiredInventoryElement(); requiredInventoryElement.type = Type; requiredInventoryElement.quantity = Quantity; requiredInventoryElement.model = (Model != null) ? Model : null; return(requiredInventoryElement); }
/// /// This method is only used within toa client to create AppointmentElement object /// internal AppointmentElement GetActivityElement() { var activity = new AppointmentElement(); //key fields activity.customer_number = _customerNumber; activity.appt_number = _apptNumber; //mandatory fields activity.worktype = _workType; //Other fields if (null != _name) { activity.name = _name; } activity.action_if_completed = ToaStringsUtil.GetString(_actionIfCompleted); if (null != _address) { activity.address = _address; } if (null != _cell) { activity.cell = _cell; } if (null != _city) { activity.city = _city; } if (null != _coordinateX) { activity.coordx = _coordinateX; } if (null != _coordinateY) { activity.coordy = _coordinateY; } if (null != _email) { activity.email = _email; } if (null != _duration) { activity.duration = _duration; } if (null != _language) { activity.language = _language; } if (null != _points) { activity.points = _points.ToString(); } if (null != _phone) { activity.phone = _phone; } if (null != _reminderTime) { activity.reminder_time = _reminderTime.ToString(); } if (null != _serviceWindowStart) { activity.service_window_start = _serviceWindowStart; } if (null != _serviceWindowEnd) { activity.service_window_end = _serviceWindowEnd; } //if(null != _slaWindowStart) // activity.sla_window_start = _slaWindowStart.ToString("yyyy'-'MM'-'dd HH':'mm"); if (null != _slaWindowEnd) { activity.sla_window_end = ((DateTime)_slaWindowEnd).ToString("yyyy'-'MM'-'dd HH':'mm"); //Below 2 null checks and fix is required as ETA is not behaving correctly. //If it has sla_window_end parameter then it should override the date and timeslot as mandatory fields in Inbound Request. //But it is not doing so, hence we are explictly required to send TimeSlot and Date. //If we do not provide them and if they are empty then activity creation fails in ETA. if (null == TimeSlot) { TimeSlot = ActivityProperty.ALL_DAY_TIME_SLOT_LABEL; } if (null == AssignedDate) { AssignedDate = ""; } } if (null != _state) { activity.state = _state; } if (null != _teamId) { activity.team_id = _teamId; } if (null != _timeSlot) { activity.time_slot = _timeSlot; } if (null != _timeZone) { activity.time_zone = _timeZone; } //activity.worktype = _workType; //Below code is for using worktype label. We plan to use only WorkType and not the label. //if (null != _workTypeLabel) // activity.worktype_label = _workTypeLabel; if (null != _zip) { activity.zip = _zip; } // Activity Properties if (null != Properties) { var noOfInventories = Properties.Count; var propertyElements = new PropertyElement[noOfInventories]; foreach (var property in Properties) { var propertyElement = new PropertyElement(); propertyElement.label = property.Key; propertyElement.value = property.Value; propertyElements[--noOfInventories] = propertyElement; } activity.properties = propertyElements; } // Activity Inventories if (null != _inventories) { var noOfInventories = _inventories.Count; var inventoryElements = new InventoryElement[noOfInventories]; foreach (var inventoryModel in _inventories) { var inventoryElement = inventoryModel.GetInventoryElement(); inventoryElements[--noOfInventories] = inventoryElement; } activity.inventories = inventoryElements; } // Preference Provideres if (null != _providerPreferences) { var noOfProviders = _providerPreferences.Count; var providers = new ProviderPreferenceElement[noOfProviders]; foreach (var providerModel in _providerPreferences) { var ProviderPreferenceElement = providerModel.GetProviderPreferenceElement(); providers[--noOfProviders] = ProviderPreferenceElement; } activity.provider_preferences = providers; } // Required Inventories if (null != _requiredInventories && _requiredInventories.Count > 0) { var noOfRequiedInventories = _requiredInventories.Count; var requiredInventoryElements = new RequiredInventoryElement[noOfRequiedInventories]; foreach (var requiredInventoryModel in _requiredInventories) { var requiredInventory = requiredInventoryModel.GetRequiredInventoryElement(); requiredInventoryElements[--noOfRequiedInventories] = requiredInventory; } activity.required_inventories = requiredInventoryElements; } if (null != UserData && UserData.Trim().Length > 0) { activity.userdata = UserData; } return(activity); }
/// /// This method is only used within toa client to create AppointmentElement object /// internal AppointmentElement GetActivityElement() { var activity = new AppointmentElement(); //key fields activity.customer_number = _customerNumber; activity.appt_number = _apptNumber; //mandatory fields activity.worktype = _workType; //Other fields if (null != _name) activity.name = _name; activity.action_if_completed = ToaStringsUtil.GetString(_actionIfCompleted); if (null != _address) activity.address = _address; if (null != _cell) activity.cell = _cell; if (null != _city) activity.city = _city; if (null != _coordinateX) activity.coordx = _coordinateX; if (null != _coordinateY) activity.coordy = _coordinateY; if (null != _email) activity.email = _email; if (null != _duration) activity.duration = _duration; if (null != _language) activity.language = _language; if (null != _points) activity.points = _points.ToString(); if (null != _phone) activity.phone = _phone; if (null != _reminderTime) activity.reminder_time = _reminderTime.ToString(); if (null != _serviceWindowStart) activity.service_window_start = _serviceWindowStart; if (null != _serviceWindowEnd) activity.service_window_end = _serviceWindowEnd; //if(null != _slaWindowStart) // activity.sla_window_start = _slaWindowStart.ToString("yyyy'-'MM'-'dd HH':'mm"); if (null != _slaWindowEnd) { activity.sla_window_end = ((DateTime)_slaWindowEnd).ToString("yyyy'-'MM'-'dd HH':'mm"); //Below 2 null checks and fix is required as ETA is not behaving correctly. //If it has sla_window_end parameter then it should override the date and timeslot as mandatory fields in Inbound Request. //But it is not doing so, hence we are explictly required to send TimeSlot and Date. //If we do not provide them and if they are empty then activity creation fails in ETA. if (null == TimeSlot) { TimeSlot = ActivityProperty.ALL_DAY_TIME_SLOT_LABEL; } if (null == AssignedDate) { AssignedDate = ""; } } if (null != _state) activity.state = _state; if (null != _teamId) activity.team_id = _teamId; if (null != _timeSlot) activity.time_slot = _timeSlot; if (null != _timeZone) activity.time_zone = _timeZone; //activity.worktype = _workType; //Below code is for using worktype label. We plan to use only WorkType and not the label. //if (null != _workTypeLabel) // activity.worktype_label = _workTypeLabel; if (null != _zip) activity.zip = _zip; // Activity Properties if (null != Properties) { var noOfInventories = Properties.Count; var propertyElements = new PropertyElement[noOfInventories]; foreach (var property in Properties) { var propertyElement = new PropertyElement(); propertyElement.label = property.Key; propertyElement.value = property.Value; propertyElements[--noOfInventories] = propertyElement; } activity.properties = propertyElements; } // Activity Inventories if (null != _inventories) { var noOfInventories = _inventories.Count; var inventoryElements = new InventoryElement[noOfInventories]; foreach (var inventoryModel in _inventories) { var inventoryElement = inventoryModel.GetInventoryElement(); inventoryElements[--noOfInventories] = inventoryElement; } activity.inventories = inventoryElements; } // Preference Provideres if (null != _providerPreferences) { var noOfProviders = _providerPreferences.Count; var providers = new ProviderPreferenceElement[noOfProviders]; foreach (var providerModel in _providerPreferences) { var ProviderPreferenceElement = providerModel.GetProviderPreferenceElement(); providers[--noOfProviders] = ProviderPreferenceElement; } activity.provider_preferences = providers; } // Required Inventories if (null != _requiredInventories && _requiredInventories.Count > 0) { var noOfRequiedInventories = _requiredInventories.Count; var requiredInventoryElements = new RequiredInventoryElement[noOfRequiedInventories]; foreach (var requiredInventoryModel in _requiredInventories) { var requiredInventory = requiredInventoryModel.GetRequiredInventoryElement(); requiredInventoryElements[--noOfRequiedInventories] = requiredInventory; } activity.required_inventories = requiredInventoryElements; } if (null != UserData && UserData.Trim().Length > 0) { activity.userdata = UserData; } return activity; }