Exemplo n.º 1
0
        public HttpResponseMessage Putlic([FromBody] InProgress inProgress, int id)
        {
            try
            {
                string username = Thread.CurrentPrincipal.Identity.Name;
                using (DatabaseEntities entities = new DatabaseEntities())
                {
                    if (username != "")
                    {
                        var Item = entities.InProgresses.Where(e => e.IdItem == id).FirstOrDefault();
                        Item.ActualPrice = inProgress.ActualPrice;

                        entities.SaveChanges();
                        return(Request.CreateResponse(HttpStatusCode.OK, "UPDATED"));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.BadRequest));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Exemplo n.º 2
0
        private void Testbutton_Click(object sender, EventArgs e)
        {
            // Bu buton ile white box testi işlemi gerçekleştirilmiştir.
            // Scrum Task Board a konulan bir test butonu yardımı ile To do listesinde bulunan
            //       projelerden birisi rastgele seçilecek ve In Progress butonu tıklatması
            //   yapılarak rastgele seçilen projenin In Progress listesine geçirilmesi test edilmiştir.
            string secim;
            int    adet = TodoList.Items.Count;
            Random rnd  = new Random();
            int    sayi = rnd.Next(0, adet);

            //to do listesinden rastgele bir eleman seçilmiştir.
            TodoList.SelectedIndex = sayi;
            secim = TodoList.SelectedItem.ToString();
            // to do listesinden ın progress listesine task ların geçirilmesini sağlayan butona click işlemi yaptırılmıştır.
            InProgress.PerformClick();

            //in progress listesinde seçilip taşınan task aranmaktadır.
            for (int i = 0; i < InprogressList.Items.Count; i++)
            {
                if (InprogressList.Items[i].ToString().ToLower().Contains(secim.ToLower()))
                {
                    MessageBox.Show("To do listesinden rastgele bir eleman seçilip in progress listesine taşıma testi başarıyla gerçekleştirildi.");
                }
            }
        }
Exemplo n.º 3
0
 public void Clear()
 {
     ToDo.Clear();
     InProgress.Clear();
     Done.Clear();
     Cancelled.Clear();
 }
        public Vector3Int GetPosition()
        {
            if (WalkingTo == StorageType.Crate)
            {
                foreach (var location in ClosestLocations)
                {
                    if (!LastCratePosition.Contains(location) &&
                        !InProgress.Contains(location) &&
                        StorageFactory.CrateLocations[Job.Owner].TryGetValue(location, out var inv) &&
                        inv.IsAlmostFull &&
                        inv.StorageTypeLookup[StorageType.Stockpile].Count > 0)
                    {
                        CurrentCratePosition = location;
                        InProgress.Add(location);
                        break;
                    }
                }

                // No new goal. go back to job pos.
                if (CurrentCratePosition == Vector3Int.invalidPos)
                {
                    return(PorterJob.OriginalPosition);
                }

                return(CurrentCratePosition);
            }
            else
            {
                return(StorageFactory.GetStockpilePosition(Job.Owner).Position);
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var waitingStartState = new WaitingStart(DateTime.Now);

            var content = new Content(
                id: Guid.NewGuid(),
                "Computational Technology and Thinking in Schools",
                "Science and Technology",
                ContentType.Article,
                waitingStartState);

            content.ShowCurrentStateDescription();

            var inProgressState = new InProgress(
                DateTime.Now,
                true,
                "Lucas Gabriel");

            content.TransitionTo(inProgressState);
            content.ShowCurrentStateDescription();

            var finishedState = new Finished(DateTime.Now);

            content.TransitionTo(finishedState);
            content.ShowCurrentStateDescription();

            Console.ReadKey();
        }
        void WorkerLoop(byte id, CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                try
                {
                    InProgress.TryAdd(id, string.Empty);
                    RavenTransportMessage message;
                    var found = _workQueue.TryTake(out message, ConsensusHeartbeat);
                    if (!found)
                    {
                        continue;
                    }
                    InProgress.TryUpdate(id, message.Id, string.Empty);

                    var time = Utilities.Time(() => Work(message));
                    //Console.WriteLine("Worker {0} Time: {1:N0}", id, time.TotalMilliseconds);
                }
                finally
                {
                    string trash;
                    InProgress.TryRemove(id, out trash);
                }
            }
        }
 private void OnTriggerExit2D(Collider2D col)
 {
     if (col.gameObject.tag == "PLAYER" || col.gameObject.tag == "NPC")
     {
         isOn = false;
         InProgress?.Invoke(false);
     }
 }
Exemplo n.º 8
0
 public void StartQuest(Quest quest)
 {
     Unstarted.Remove(quest);
     InProgress.Add(quest);
     quest.StartQuest();
     Debug.Log("Quest " + quest.QuestName + " has started");
     Debug.Log("Next task " + quest.CurrentTask());
 }
Exemplo n.º 9
0
 // id is user data.
 public Lane(ulong id, int slots)
 {
     Out      = new PendingOut[slots];
     Progress = new InProgress[slots];
     Done     = new Done[slots];
     Acks     = new uint[slots];
     Id       = id;
     LagMsMin = 0;
     ResendMs = 200;
 }
Exemplo n.º 10
0
        private void InProgress_MouseDown(object sender, MouseEventArgs e)
        {
            Point nokta1 = new Point(e.X, e.Y);

            sira2 = InProgress.IndexFromPoint(nokta1);
            if (e.Button == MouseButtons.Left)
            {
                InProgress.DoDragDrop(InProgress.Items[sira2], DragDropEffects.All);
            }
        }
Exemplo n.º 11
0
			// id is user data.
			public Lane(ulong id, int slots)
			{
				Out = new PendingOut[slots];
				Progress = new InProgress[slots];
				Done = new Done[slots];
				Acks = new uint[slots];
				Id = id;
				LagMsMin = 0;
				ResendMs = 200;
			}
Exemplo n.º 12
0
        /// <summary>
        ///     Worker has finished a task, he push it to done in the TaskManager
        /// </summary>
        /// <param name="task"></param>
        public void SetDone(SymuTask task)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (!task.IsAssigned)
            {
                // Task has been cancelled
                return;
            }

            task.UnAssign();
            var todo       = ToDo.Contains(task);
            var inProgress = InProgress.Contains(task);

            if (todo)
            {
                ToDo.Remove(task);
            }
            else if (inProgress)
            {
                InProgress.Remove(task);
            }
            else
            {
                return;
            }

            task.SetDone();
            if (_debug)
            {
                Done.Add(task);
            }

            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            if (todo)
            {
                TaskResult.ToDo--;
            }
            else
            {
                TaskResult.InProgress--;
            }

            TaskResult.Done++;
            TaskResult.WeightDone    += task.Weight;
            TaskResult.Incorrectness += (int)task.Incorrectness;
        }
Exemplo n.º 13
0
        public IActionResult InProgressTasks()
        {
            var inProgressTasks = _John.ToDos.Where(t => t.Status == Status.InProgress).ToList();

            InProgress inProgress = new InProgress()
            {
                InProgressTodos = inProgressTasks
            };

            return(View(inProgress));
        }
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (!isOn)
     {
         if (col.gameObject.tag == "PLAYER" || col.gameObject.tag == "NPC")
         {
             isOn = true;
             InProgress?.Invoke(true);
         }
     }
 }
Exemplo n.º 15
0
        public void Defect_Close_ShouldBeFixed()
        {
            //Arrange
            State  inProgressState = new InProgress();
            Defect defect          = new Defect(inProgressState);

            //Act
            defect.Close();
            //Assert
            defect.State.ShouldBeOfType(typeof(Fixed));
        }
Exemplo n.º 16
0
        public IActionResult InProgressTasks()
        {
            var inProgressTasks = Db.Users.FirstOrDefault(u => u.FirstName == "John")
                                  .ToDos.Where(t => t.Status == Status.InProgress).ToList();

            InProgress inProgress = new InProgress()
            {
                InProgressTodos = inProgressTasks
            };

            return(View(inProgress));
        }
Exemplo n.º 17
0
        public void Track(ushort step, TasksManager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }

            ToDo.Add(step, manager.ToDo.Count);
            InProgress.Add(step, manager.InProgress.Count);
            Done.Add(step, manager.Done.Count);
            Cancelled.Add(step, manager.Cancelled.Count);
        }
Exemplo n.º 18
0
        /// <summary>
        ///     agent stop working and must finished properly the tasks
        ///     All tasks in the task manager are set done,
        ///     Blockers are cleared
        /// </summary>
        public void SetAllTasksDone()
        {
            foreach (var task in ToDo.ToArray())
            {
                SetDone(task);
            }

            foreach (var task in InProgress.ToArray())
            {
                task.ClearBlockers();
                SetDone(task);
            }
        }
 private async void InitializeAsync()
 {
     InProgress.TurnOn();
     ProgressMessage.Value = "初期情報取得中";
     try
     {
         await Model.InitializeAsync();
     }
     finally
     {
         InProgress.TurnOff();
     }
 }
Exemplo n.º 20
0
        /// <summary>
        ///     CancelBlocker a task :
        ///     remove a task from either To do or in progress
        /// </summary>
        /// <param name="task"></param>
        public void Cancel(SymuTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (!task.IsAssigned)
            {
                return;
            }

            var todo       = ToDo.Contains(task);
            var inProgress = InProgress.Contains(task);

            if (todo)
            {
                ToDo.Remove(task);
            }
            else if (inProgress)
            {
                InProgress.Remove(task);
            }
            else
            {
                return;
            }

            task.Cancel();
            if (_debug)
            {
                Cancelled.Add(task);
            }

            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            if (todo)
            {
                TaskResult.ToDo--;
            }
            else
            {
                TaskResult.InProgress--;
            }

            TaskResult.Cancelled++;
        }
Exemplo n.º 21
0
        public Vector3Int GetPosition()
        {
            if (WalkingTo == StorageType.Crate)
            {
                // check for full crates. ensure they get serviced first
                foreach (var location in ClosestLocations)
                {
                    if (!LastCratePosition.Contains(location) &&
                        !InProgress.Contains(location) &&
                        StorageFactory.CrateLocations[Job.Owner].TryGetValue(location, out var inv) &&
                        inv.IsAlmostFull &&
                        inv.StorageTypeLookup[StorageType.Stockpile].Count > 0)
                    {
                        CurrentCratePosition = location;
                        InProgress.Add(location);
                        break;
                    }
                }

                // No new goal. just take anything
                if (CurrentCratePosition == Vector3Int.invalidPos)
                {
                    foreach (var location in ClosestLocations)
                    {
                        if (!LastCratePosition.Contains(location) &&
                            !InProgress.Contains(location) &&
                            StorageFactory.CrateLocations[Job.Owner].TryGetValue(location, out var inv) &&
                            inv.StorageTypeLookup[StorageType.Stockpile].Count > 0)
                        {
                            CurrentCratePosition = location;
                            InProgress.Add(location);
                            break;
                        }
                    }
                }

                // everything is empty stand at job.
                if (CurrentCratePosition == Vector3Int.invalidPos)
                {
                    return(PorterJob.OriginalPosition);
                }

                return(CurrentCratePosition);
            }
            else
            {
                return(StorageFactory.GetStockpilePosition(Job.Owner).Position);
            }
        }
Exemplo n.º 22
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (IssuedBy?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Status?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DateIssued?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ApprovedBySonae.GetHashCode());
            hashCode = hashCode * -1521134295 + (ApprovedBySupplier.GetHashCode());
            hashCode = hashCode * -1521134295 + (InProgress.GetHashCode());
            hashCode = hashCode * -1521134295 + (Active.GetHashCode());
            hashCode = hashCode * -1521134295 + (UnderRevision.GetHashCode());
            return(hashCode);
        }
Exemplo n.º 23
0
        public HttpResponseMessage Post([FromBody] InProgress inProgress, int dni)
        {
            try
            {
                string username = Thread.CurrentPrincipal.Identity.Name;
                using (DatabaseEntities entities = new DatabaseEntities())
                {
                    var entity = entities.Users.Where(e => e.Email.Equals(username)).FirstOrDefault();
                    int item   = entities.Items.Where(e => e.IdSeller == entity.Id).Max(u => u.Id);

                    if (username != "")
                    {
                        if (inProgress.Type.Equals("Kup teraz") && ((Convert.ToInt32(inProgress.ItemsLeft) < 1)) || (Convert.ToDouble(inProgress.PriceForOne) <= 0))
                        {
                            entities.Items.Remove(entities.Items.Where(e => e.Id.Equals(item)).FirstOrDefault());

                            throw new Exception("Złe dane");
                        }
                        if (inProgress.Type.Equals("Licytacja") && ((Convert.ToDouble(inProgress.ActualPrice) > (Convert.ToDouble(inProgress.PriceForOne))) || (Convert.ToDouble(inProgress.PriceForOne) <= 0)))
                        {
                            entities.Items.Remove(entities.Items.Where(e => e.Id.Equals(item)).FirstOrDefault());
                            throw new Exception("Złe dane");
                        }
                        inProgress.IdItem      = item;
                        inProgress.ItemsLeft   = Convert.ToInt32((inProgress.ItemsLeft).ToString());
                        inProgress.PriceForOne = Convert.ToDouble((inProgress.PriceForOne).ToString());
                        inProgress.ActualPrice = Convert.ToDouble((inProgress.ActualPrice).ToString());
                        inProgress.EndDate     = DateTime.Now.AddDays(dni);

                        entities.InProgresses.Add(inProgress);
                        entities.SaveChanges();
                        var message = Request.CreateResponse(HttpStatusCode.Created, inProgress);

                        return(message);
                    }
                    else
                    {
                        entities.Items.Remove(entities.Items.Where(e => e.Id.Equals(item)).FirstOrDefault());
                        return(Request.CreateResponse(HttpStatusCode.BadRequest));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Exemplo n.º 24
0
        /// <summary>
        ///     Cancel tasks that have expired based on TimeToLive
        /// </summary>
        /// <param name="step"></param>
        public void CancelExpiredTasks(ushort step)
        {
            bool Match(SymuTask t)
            {
                return(t.TimeToLive != -1 && step >= t.Created + t.TimeToLive);
            }

            foreach (var task in ToDo.FindAll(Match))
            {
                Cancel(task);
            }

            foreach (var task in InProgress.FindAll(Match))
            {
                Cancel(task);
            }
        }
Exemplo n.º 25
0
 /// <summary>
 /// Распределение задач по коллекциям
 /// </summary>
 private void Distribution()
 {
     foreach (PlannerTask task in Queue)
     {
         if (task.TaskStatus == State.Waiting)
         {
             Waiting.Add(task);
         }
         if (task.TaskStatus == State.InProgress)
         {
             InProgress.Add(task);
         }
         if (task.TaskStatus == State.Perfomed)
         {
             Perfomed.Add(task);
         }
     }
 }
Exemplo n.º 26
0
 // Показать форму загрузки
 private void CheckLW_Click(object sender, RoutedEventArgs e)
 {
     if (_inProgress == null)
     {
         _inProgress = new InProgress("Удаление")
         {
             Owner = this,
             WindowStartupLocation = WindowStartupLocation.CenterOwner
         };
         _inProgress.Show();
     }
     else
     {
         _inProgress.ChangeMessage("Форматирвание");
         // Задаем владельца формы
         _inProgress.Show();
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// Показать анимацию загрузки
 /// </summary>
 /// <param name="message">Сообщение</param>
 private void ShowWorkInProgress(string message)
 {
     if (_inProgress == null)
     {
         _inProgress = new InProgress(message)
         {
             Owner = this,
             WindowStartupLocation = WindowStartupLocation.CenterOwner
         };
         _inProgress.Show();
     }
     else
     {
         _inProgress.ChangeMessage(message);
         // Задаем владельца формы
         _inProgress.Show();
     }
 }
Exemplo n.º 28
0
        /// <summary>
        ///     Add a task directly in AverageInProgress
        /// </summary>
        /// <param name="task"></param>
        public void AddInProgress(SymuTask task)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            InProgress.Add(task);
            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            TaskResult.TotalTasksNumber++;
            TaskResult.InProgress++;
            task.SetTasksManager(this);
        }
Exemplo n.º 29
0
        /// <summary>
        ///     Push the task in progress
        /// </summary>
        /// <param name="task"></param>
        public void SetInProgress(SymuTask task)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            ToDo.Remove(task);
            InProgress.Add(task);
            OnAfterSetTaskInProgress?.Invoke(this, new TaskEventArgs(task));
            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            TaskResult.ToDo--;
            TaskResult.InProgress++;
        }
        public async Task <bool> AssignInProgress(string projectId, InProgressViewModel model)
        {
            var project = await _NoDb.FindAsync(projectId, projectId);

            var inprogress = new InProgress
            {
                Id          = Guid.NewGuid().ToString(),
                Descreption = model.Descreption,
                Name        = model.Name,
                StartDate   = model.StartDate,
                EndDate     = model.EndDate
            };

            project.Framework.Id = Guid.NewGuid().ToString();
            project.Framework.InProgress.Add(inprogress);
            var result = await _NoDb.UpdateAsync(project);

            return(result.IsSuccess);
        }
Exemplo n.º 31
0
        /// <summary>
        ///     Check that Task Manager is ok
        /// </summary>
        public void TasksCheck(ushort step)
        {
            bool Match(SymuTask t)
            {
                return(t.Weight > Tolerance && t.WorkToDo < Tolerance);
            }

            // Check tasks stuck in a list
            if (ToDo.Exists(Match))
            {
                throw new ArgumentException("Task is blocked in TODO column");
            }

            if (InProgress.Exists(Match))
            {
                throw new ArgumentException("Task is blocked in INPROGRESS column");
            }

            CancelExpiredTasks(step);
        }
Exemplo n.º 32
0
        private void doneWithInProgress( InProgress ip, bool fSuccess )
        {
            if ( ip.TimeEstimator!=null )
                Global.Preferences.FTPSpeed =
                    (Global.Preferences.FTPSpeed + (int)(ip.TimeEstimator.UnitsPerSecond / 1024)) / 2;
            _dicInProgress.Remove( ip.Path );
            ugProgress.G.DataRows.Remove( ip.Row );

            if ( fSuccess )
            {
                PlataDM.Skola skola;
                if ( Global.Skola != null && string.Compare( ip.Path, Global.Skola.HomePath, true ) == 0 )
                    skola = Global.Skola;
                else
                {
                    skola = new PlataDM.Skola( null, 0 );
                    skola.Open( ip.Path );
                }
                skola.BackupWhen = vdUsr.DateHelper.YYYYMMDDHHMM( Global.Now );
                skola.save( true );
            }
        }
Exemplo n.º 33
0
        private InProgress go( vdFtpWorkUnit w, string strPath )
        {
            var skola = new PlataDM.Skola( null, 0 );
            skola.Open( strPath );
            var f = w.addFolder( skola.OrderNr );

            var excludeThese = findFilesToExclude( skola );
            foreach ( var strFullFN in Directory.GetFiles( skola.HomePath ) )
            {
                var plainFileName = Path.GetFileName( strFullFN ).ToLower();
                switch ( plainFileName )
                {
                    case "!fotoorder.emf":
                        break;
                    case "!order.plata":
                        if ( skola.Verifierad )
                            goto default;
                        f.AddLocalItem(
                            strFullFN,
                            string.Format( "!order_{0:yyyyMMddHHmmss}.plata", Global.Now ) );
                        break;
                    default:
                        if ( !excludeThese.Contains( plainFileName ) )
                            f.AddLocalItem( strFullFN, plainFileName );
                        break;
                }
            }

            var strZZLast = Path.Combine( skola.HomePath, "zzlast" );
            Util.safeKillFile( strZZLast );
            if ( skola.Verifierad )
                f.AddLocalItem(
                    strZZLast,
                    "zzlast" ).FileType = vdFtpFileType.EndFileForOneFolder;

            var row = ugProgress.addRow();
            row.Cells[0].Value = skola.OrderNr;
            row.Cells[1].Value = skola.Namn;
            row.Cells[2].Value = skola.Ort;
            row.EndEdit();

            var ip = new InProgress();
            f.Tag = ip;
            ip.Path = strPath;
            ip.Folder = f;
            ip.Row = row;
            ip.Work = w;
            ip.IsBackup = !skola.Verifierad;
            row.Tag = ip;
            _dicInProgress.Add( strPath, ip );
            return ip;
        }