Example #1
0
        /// <summary>
        /// Max priorytet = 10
        /// Nie mozna zmienic SP zadania, ktore jest Completed.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="SP"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public Job ChangeJobPriority(Job obj, double?priority, User user)
        {
            //Jak nie jest completed
            double value = 0;

            if (obj.Priority.HasValue)
            {
                value = obj.Priority.Value;
            }

            if (obj.BacklogStatus != 4 && priority.HasValue && priority.Value != value) // usunieto && priority.Value != obj.Priority.Value
            {
                //Edit zadania robi wpis w HJ
                HistoryJob hj = new HistoryJob();
                hj.Date   = DateTime.Today;
                hj.IdJob  = obj.IdJob;
                hj.IdUser = user.IdUser;
                double?pr = obj.Priority.HasValue ? obj.Priority.Value : 0;
                priority     = priority > 10 ? 10 : priority;
                hj.Comment   = "Zmiana priorytetu zadania " + obj.Title + " z " + pr + " na " + priority.Value + " przez " + user.Name;
                obj.Priority = priority;
                hjRepo.AddHistoryJob(hj);
                EditJob(obj);
                return(obj);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var entityType        = GetArchetypeChunkEntityType();
            var damagehistoryType = GetArchetypeChunkBufferType <DamageHistory>();

            var historyJob = new HistoryJob
            {
                Time              = Time.time,
                DamageEvents      = m_DamageEventsQuery.ToComponentDataArray <DamageEvent>(Allocator.TempJob),
                EntityType        = entityType,
                DamageHistoryType = damagehistoryType
            };
            var historyHandle = historyJob.Schedule(m_HistoryQuery, inputDeps);

            var addDamageStackJob = new AddDamageStackJob
            {
                ECB = m_EndSim.CreateCommandBuffer().ToConcurrent(),
                DamageStackBuffer = GetBufferFromEntity <DamageStack>()
            };
            var addDamageStackHandle = addDamageStackJob.Schedule(this, historyHandle);

            m_EndSim.AddJobHandleForProducer(addDamageStackHandle);

            var processDamageStackJob    = new ProcessDamage();
            var processDamageStackHandle = processDamageStackJob.Schedule(this, addDamageStackHandle);

            var tagDeadJob = new TagDeadJob {
                EntityCommandBuffer = m_EndSim.CreateCommandBuffer().ToConcurrent()
            };
            var tagDeadHandle = tagDeadJob.Schedule(this, processDamageStackHandle);

            m_EndSim.AddJobHandleForProducer(tagDeadHandle);
            return(tagDeadHandle);
        }
Example #3
0
        public int AddHistoryJob(HistoryJob hj)
        {
            ctx.Set <HistoryJob>().Add(hj);
            ctx.SaveChanges();
            int id = hj.IdHistoryJob;

            return(id);
        }
Example #4
0
 public bool ChangeJobTable(Job job, User user, int table)
 {
     if (job.TableStatus != (int)typeTable.Done)
     {
         if (job.TableStatus == (int)typeTable.ToDo && table != (int)typeTable.Doing)
         {
             return(false);
         }
         HistoryJob hj = new HistoryJob
         {
             Date        = DateTime.Today,
             FromBacklog = job.BacklogStatus,
             FromTable   = job.TableStatus,
             ToBacklog   = job.BacklogStatus,
             ToTable     = table,
             IdJob       = job.IdJob,
             IdUser      = user.IdUser,
             Comment     = "Przeniesiono zadanie \"" + job.Title + "\" do rejestru " + Enum.GetName(typeof(Content.typeTable), table) + " przez użytkownika "
                           + user.Name
         };
         if (table == (int)typeTable.Done)
         {
             hj.ToBacklog      = (int)typeBacklog.Completed;
             job.BacklogStatus = (int)typeBacklog.Completed;
         }
         if (table == (int)typeTable.Doing)
         {
             hj.ToBacklog      = (int)typeBacklog.Scheduled;
             job.BacklogStatus = (int)typeBacklog.Scheduled;
         }
         if (table == (int)typeTable.ToDo)
         {
             hj.ToBacklog      = (int)typeBacklog.Ready;
             job.BacklogStatus = (int)typeBacklog.Ready;
         }
         if (table == (int)typeTable.Review)
         {
             hj.ToBacklog      = (int)typeBacklog.Scheduled;
             job.BacklogStatus = (int)typeBacklog.Scheduled;
         }
         hjRepo.AddHistoryJob(hj);
         job.TableStatus = table;
         return(EditJob(job));
     }
     else
     {
         return(false);
     }
 }
Example #5
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                var cell = tableView.DequeueReusableCell(ReusableMemosTableCellID) ?? new UITableViewCell(UITableViewCellStyle.Value1, ReusableMemosTableCellID);

                HistoryJob j = new HistoryJob();

                j = _jobHistory[indexPath.Row];
                cell.TextLabel.Text = String.Format("{0}   {1}",
                                                    j.JobDate.ToString("dd/MM/yyyy"),
                                                    j.JobType

                                                    /*, j.JobPerformedBy.ToString() */);
                cell.DetailTextLabel.Text = String.Format("Collected on the day: ${0}", j.MoneyCollected);
                // cell.DetailTextLabel.Text = ""; // apparently, there's nothing else to display about a job that has been done in the past
                return(cell);
            }
Example #6
0
        public bool AddHistoryJob(string comment, Job job, User user)
        {
            HistoryJob hj = new HistoryJob
            {
                Date   = DateTime.Today,
                IdUser = user.IdUser,
                IdJob  = job.IdJob
            };

            if (comment == null || comment.Equals(""))
            {
                return(false);
            }
            else
            {
                return(AddHistoryJob(hj) > 0);
            }
        }
Example #7
0
 /// <summary>
 /// Nie mozna zmienic SP zadania, ktore jest Completed.
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="SP"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public Job ChangeJobSP(Job obj, double SP, User user)
 {
     //Jak nie jest completed
     //Albo nie zmieniamy na takie, co byly
     if (obj.BacklogStatus != (int)typeBacklog.Completed && obj.SP != SP)
     {
         //Edit zadania robi wpis w HJ
         HistoryJob hj = new HistoryJob();
         hj.Date   = DateTime.Today;
         hj.IdJob  = obj.IdJob;
         hj.IdUser = user.IdUser;
         //W przypadku jak nigdy wczesniej nie mial SP
         if (obj.BacklogStatus == (int)typeBacklog.New) //czyli jest w New
         {
             hj.FromBacklog    = obj.BacklogStatus;
             hj.ToBacklog      = (int)typeBacklog.Ready; //Zmiana na Ready
             obj.BacklogStatus = (int)typeBacklog.Ready;
             hj.FromTable      = obj.TableStatus;
             hj.ToTable        = (int)typeTable.ToDo; //do tablicy To-do
             obj.TableStatus   = (int)typeTable.ToDo;
             obj.SP            = SP;
             hj.Comment        = "Przeniesiono zadanie \"" + obj.Title + "\" do rejestru " + Enum.GetName(typeof(Content.typeBacklog), 2) + " przez użytkownika "
                                 + user.Name + "\n";
         }
         else
         {
             hj.FromBacklog = hj.ToBacklog = obj.BacklogStatus;
             hj.FromTable   = hj.ToTable = obj.TableStatus;
         }
         hj.Comment   = (hj.Comment == null ? "" : hj.Comment) + "Zmiana SP na " + SP + " przez użytkownika " + user.Name;
         obj.SP       = SP;
         obj.IdSprint = sprintRepo.GetLastSprintForProject(obj.IdProject).IdSprint;
         hjRepo.AddHistoryJob(hj);
         EditJob(obj);
         return(obj);
     }
     else
     {
         return(null);
     }
 }
Example #8
0
        /// <summary>
        /// Zwraca id nowego zadania
        /// </summary>
        /// <param name="job"></param>
        /// <returns></returns>
        public int AddJob(Job job)
        {
            job.SP       = job.SP == 0 ? null : job.SP;
            job.IdSprint = sprintRepo.GetLastSprintForProject(job.IdProject).IdSprint;
            ctx.Set <Job>().Add(job);
            ctx.SaveChanges();
            int id = job.IdJob;
            //W momencie utworzenia zadania tworzy sie log
            HistoryJob hj = new HistoryJob();

            hj.FromBacklog = (int)typeBacklog.New;
            hj.ToBacklog   = (int)typeBacklog.New;
            hj.FromTable   = (int)typeTable.None;
            hj.ToTable     = (int)typeTable.None;
            hj.IdJob       = job.IdJob;
            hj.IdUser      = job.IdUser;
            hj.Date        = DateTime.Today;
            hj.Comment     = "Utworzono zadanie \"" + job.Title + "\" przez użytkownika " + userRepo.Users.SingleOrDefault(U => U.IdUser == job.IdUser).Name;

            ctx.SaveChanges();
            hjRepo.AddHistoryJob(hj);
            return(id);
        }
Example #9
0
 public void EditHistoryJob(HistoryJob obj)
 {
     ctx.Entry <HistoryJob>(obj).CurrentValues.SetValues(obj);
     ctx.SaveChanges();;
 }
Example #10
0
 public void DeleteHistoryJob(HistoryJob obj)
 {
     ctx.Set <HistoryJob>().Remove(obj);
     ctx.SaveChanges();
 }