Exemple #1
0
        private (string, string) GetWorkersInfo(AffairCacheItem affair)
        {
            string info = null;
            string cns  = null;

            foreach (var aw in affair.Workers)
            {
                var worker = WorkManager.GetWorker(aw.WorkerId);
                cns  += worker.Cn;
                info += string.Format("{0} ", worker.Name);
            }
            return(info, cns);
        }
Exemple #2
0
 public AffairWorkDto SetAffair(AffairCacheItem affair, string wpName, bool altCheck)
 {
     AltCheck = altCheck;
     Today    = DateTime.Now.ToString("yyyy-MM-dd");
     if (affair != null)
     {
         AffairId      = affair.Id;
         Content       = affair.Content;
         WorkplaceId   = affair.WorkplaceId;
         WorkplaceName = wpName;
         StartTime     = affair.StartTime;
         EndTime       = affair.EndTime;
     }
     return(this);
 }
Exemple #3
0
        public AffairCacheItem FindCheckinAffairByWorkerId(int workerId)
        {
            int depotId = GetWorkerDepotId(workerId);

            AffairCacheItem found = null;

            foreach (var affair in _affairCache.Get(DateTime.Now.Date, depotId))
            {
                if (!ClcUtils.NowInTimeZone(affair.StartTime, affair.EndTime))
                {
                    continue;
                }

                var allcheckin = true;
                found = null;
                foreach (var worker in affair.Workers)
                {
                    if (worker.CheckoutTime.HasValue)
                    {
                        continue;
                    }
                    if (worker.WorkerId == workerId)
                    {
                        found = affair;
                    }

                    if (!worker.CheckinTime.HasValue)
                    {
                        allcheckin = false;
                    }
                }

                if (found != null && allcheckin)
                {
                    return(found);
                }
            }
            return(null);
        }
Exemple #4
0
        public (AffairCacheItem, AffairWorkerCacheItem) GetAffairWorker(DateTime carryoutDate, int depotId, int workerId)
        {
            var list = Get(carryoutDate, depotId);

            if (list.Count == 0)
            {
                return(null, null);
            }

            AffairCacheItem a = null;

            foreach (var affair in (List <AffairCacheItem>)list)
            {
                a = affair;
                foreach (var worker in affair.Workers)
                {
                    if (worker.WorkerId == workerId)
                    {
                        return(affair, worker);
                    }
                }
            }
            return(a, null);
        }