private List <PlWorkingInfo> OnRefreshSublistViewData()
        {
            var operations = GetDefaultOperations();

            Works.Clear();
            var workings = GetWorkingsByOperations(operations, null);

            if (workings.Length == 0)
            {
                return(new List <PlWorkingInfo>());
            }

            var workIds = workings.Where(p => p.WORKID_R.HasValue).Select(p => p.WORKID_R.Value).Distinct().ToArray();

            using (var mgr = IoC.Instance.Resolve <IBaseManager <Work> >())
            {
                foreach (var workid in workIds)
                {
                    Works[workid] = mgr.Get(workid, GetModeEnum.Partial);
                }
            }

            return(workings.Where(p => p.WORKID_R.HasValue)
                   .Select(p => new PlWorkingInfo(p, Works[p.WORKID_R.Value].Get <string>("VOPERATIONNAME")))
                   .ToList());
        }
예제 #2
0
        private void FilterWorks()
        {
            Works.Clear();
            NotPeriodicWorks.Clear();
            List <WorksWithFlagDataModel> periodic   = CarStorage.Instance.CarWorks.Where(p => p.IsPeriodic == 1).ToList();
            List <WorksWithFlagDataModel> unperiodic = CarStorage.Instance.CarWorks.Where(p => p.IsPeriodic == 0).ToList();



            foreach (var item in periodic)
            {
                bool add = true;
                if (SearchText != null)
                {
                    if (item.Name.ToUpper().IndexOf(SearchText.ToUpper()) == -1)
                    {
                        add = false;
                    }
                }
                if (add)
                {
                    Works.Add(new ViewCarWorkModel
                    {
                        Periodic = true,
                        Name     = item.Name,
                        Id       = item.id,
                        id_Class = item.id_Class,
                        NHours   = item.NH,
                        WGUID    = item.WGUID
                    });
                }
            }

            foreach (var item in unperiodic)
            {
                bool add = true;
                if (SearchText != null)
                {
                    if (item.Name.ToUpper().IndexOf(SearchText.ToUpper()) == -1)
                    {
                        add = false;
                    }
                }
                if (add)
                {
                    NotPeriodicWorks.Add(new ViewCarWorkModel
                    {
                        Periodic = false,
                        Name     = item.Name,
                        Id       = item.id,
                        id_Class = item.id_Class,
                        NHours   = item.NH,
                        WGUID    = item.WGUID
                    });
                }
            }
        }
예제 #3
0
 public override void Clear()
 {
     base.Clear();
     foreach (var work in Works)
     {
         GameFramework.ReferencePool.Release(work);
     }
     Works.Clear();
     CurrentWorkIndex = 0;
 }
예제 #4
0
 public ServiceViewModel(ServiceBaseDataModel model)
 {
     _id             = model.ID;
     Name            = model.Name;
     CurentDate      = model.CurentDate.ToDateTime().ToShortDateString();
     BasePeriod      = model.BasePeriod;
     PeriodDimension = model.PeriodDimension;
     Period          = string.Format("{0} {1}", model.BasePeriod, model.PeriodDimension);
     Duration        = model.Duration.ToTime().ToString("c");
     DistanceToMake  = model.DistanceToMake;
     Price           = model.Price;
     Comment         = model.Comment;
     Works.Clear();
     model.Works.ForEach(o => Works.Add(new ServiceViewModel(o)));
 }
예제 #5
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            ErrorVisible = false;

            ErrorItemsVisible = false;

            IsBusy = true;

            try
            {
                await Task.Delay(100);

                Works.Clear();
                var works = await WorkStore.GetItemsAsync(Category.Id, true);

                if (works.Count() == 0)
                {
                    IsBusy            = false;
                    ErrorItemsVisible = true;
                    return;
                }
                foreach (var work in works)
                {
                    Works.Add(work);
                }
                IsBusy = false;
            }
            catch (Exception)
            {
                IsBusy       = false;
                Content      = false;
                ErrorVisible = true;
            }
        }
예제 #6
0
 void DeleteDateCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         if (Changeovers.Any(c => c.DateID == Date.ID))
         {
             Changeovers.Remove(Changeovers.FirstOrDefault(c => c.DateID == Date.ID));
         }
         Tree.Years.
         First(c => c.Year == Date.DateContent.Year.ToString()).
         Months.First(c => c.Month == CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Date.DateContent.Month)).
         Days.First(c => c.Day == Date).Remove();
         if (Tree.Years.Count != 0)
         {
             Tree.Years.Last().Months.Last().Days.Last().IsSelected = true;
         }
         else
         {
             Date = null;
             if (Works != null)
             {
                 Works.Clear();
             }
             if (Attendances != null)
             {
                 Attendances.Clear();
             }
         }
     }
     else
     {
         ErrorProvider.ShowError(e.Error, Navigator);
     }
     dataClient.DeleteDateCompleted -= DeleteDateCompleted;
     Busy = false;
 }