/// <summary>
        /// Load history data from DB converting to List of IWorkOrderModel
        /// Out errorMessage if data not loaded
        /// </summary>
        public IEnumerable <IOrderViewModel> GetMasterOrder(int orderId, string accessToken, out string errorMessage)
        {
            errorMessage = string.Empty;

            var result = new List <IOrderViewModel>();

            var order = WebApiWorker.GetResult <LaborDetail.Item>(apiLaborDetail + "/LaborDetail/Get/" + orderId, accessToken, out errorMessage);

            if (string.IsNullOrEmpty(errorMessage))
            {
                var labor = new BasicWorkViewModel(_directoryManager, _orderItemFactory);
                labor.ConvertToViewModel(order);
                result.Add(labor);
                foreach (var item in order.SubLaborDetails)
                {
                    var additionalLabor = new AdditionalWorkViewModel(_directoryManager, _orderItemFactory);
                    additionalLabor.ConvertToViewModel(item);
                    result.Add(additionalLabor);
                }

                if (order.ManualOperations.Count > 0 || order.Employees.Count > 0)
                {
                    var manual = new ManualWorkViewModel(_directoryManager, _orderItemFactory);
                    manual.ConvertToViewModel(order);
                    result.Add(manual);
                }

                foreach (var i in result)
                {
                    i.Index = result.IndexOf(i);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void BasicWorkViewModel_ObjectItemExist_True()
        {
            _basicWorkViewModel = new BasicWorkViewModel(_directoryManager, _orderItemFactory);

            var objectItem = _basicWorkViewModel.DataCollection.FirstOrDefault(x => x is ObjectItemViewModel);

            Assert.IsNotNull(objectItem);
        }
Ejemplo n.º 3
0
        public void BasicWorkViewModel_ValidDataItemCount_True()
        {
            _basicWorkViewModel = new BasicWorkViewModel(_directoryManager, _orderItemFactory);

            var itemsCount = _basicWorkViewModel.DataCollection.Count;

            Assert.AreEqual(4, itemsCount);
        }