Пример #1
0
        /// <summary>
        /// Fetches the Work Order Areas for a particular zipcode
        /// </summary>
        /// <param name="zipCode">Zipcode</param>
        public void getWorkOrderArea(String zipCode)
        {
            _log.Notice("Inside getWorkOrderArea. ZipCode: " + zipCode);
            CapacityModel capacityModel = new CapacityModel();

            capacityModel.DetermineLocationByWorkZone          = true;
            capacityModel.DetermineLocationByWorkZoneSpecified = true;

            ActivityField zipField = new ActivityField();

            zipField.Name  = "czip";
            zipField.Value = zipCode;

            DateTime[] dateTimes = new DateTime[] {
                DateTime.Today,
            };
            capacityModel.QuotaDates = dateTimes;

            List <ActivityField> activityFields = new List <ActivityField>();

            activityFields.Add(zipField);

            capacityModel.ActivityField = activityFields.ToArray();

            ICapacityService service = CapacityService.GetService();

            if (service != null)
            {
                _log.Notice("Got CapacityService Object");
                service.GetWorkOrderArea(capacityModel, WorkOrderAreaCallback);
            }
        }
        /// <summary>
        /// Get the quota for a given month
        /// </summary>
        public ToaRequestResultCode getQuotaForMonth()
        {
            _log.Notice("Inside getQuotaForMonth");
            CapacityModel request = new CapacityModel();

            request.QuotaDates                   = getQuotaDates();
            request.CalculateDuration            = true;
            request.CalculateDurationSpecified   = true;
            request.CalculateTravelTime          = true;
            request.CalculateTravelTimeSpecified = true;
            request.CalculateWorkSkill           = true;
            request.CalculateWorkSkillSpecified  = true;
            request.ReturnTimeSlotInfo           = true;
            request.ReturnTimeSlotInfoSpecified  = true;
            request.Location = new string[] { Bucket };

            ActivityField zipField = new ActivityField();

            zipField.Name  = "czip";
            zipField.Value = PostalCode;

            ActivityField workType = new ActivityField();

            workType.Name  = "aworktype";
            workType.Value = WorkOrderType;

            List <ActivityField> activityFields = new List <ActivityField>();

            activityFields.Add(zipField);
            activityFields.Add(workType);

            request.ActivityField = activityFields.ToArray();

            ICapacityService service  = CapacityService.GetService();
            ToaRequestResult response = service.GetQuotaForMonth(request);

            if (response.ResultCode == ToaRequestResultCode.Failure)
            {
                return(response.ResultCode);
            }

            CapacityModel model = (CapacityModel)response.DataModels[0];

            monthlyQuota = null;
            monthlyQuota = model.DayQuota;

            List <string> timeSlots = new List <string>();

            timeSlots.Add("All Slots");
            timeSlots.AddRange(model.Timeslots);

            TimeSlotItems = new ObservableCollection <string>(timeSlots);

            CurrentTimeSlot = "All Slots";
            //CurrentDateSelected = DisplayDate;
            this.showQuotaForTimeSlots();
            //this.RequestRefresh();
            return(response.ResultCode);
        }