/// <summary>
        /// Adds the specified child phase to the collection AND sets the parent phase property of the specified child phase
        /// </summary>
        /// <param name="parentPhaseModel">The phase parentPhaseModel which is to receive the child phase</param>
        /// <param name="childPhase">The child phase to add to the parent's collection</param>
        public static void AddChildPhase(this PhaseModel parentPhaseModel, PhaseModel childPhase)
        {
            if (childPhase == null)
            {
                return;
            }

            childPhase.ParentPhase = parentPhaseModel;
            parentPhaseModel.ChildPhases.Add(childPhase);
        }
Exemple #2
0
        public IActionResult ChangePhase(PhaseModel pm, int phaseId)
        {
            Phase updatePhase = _projManager.GetPhase(phaseId);

            updatePhase.Description = pm.Description;
            updatePhase.StartDate   = pm.StartDate;
            updatePhase.EndDate     = pm.EndDate;

            _projManager.EditPhase(updatePhase);
            return(RedirectToAction("CollectProject", "Platform", new { id = updatePhase.Project.Id }));
        }
    // Use this for initialization
    void Start () {
        winText.text = "";
        turn = 1;
		pm = GameObject.FindObjectOfType<PhaseModel> ();
        if (pm == null)
        {
            Debug.LogError("Cannot find any PhaseModels in Scene. Please add a PhaseModel and try again.");
        }
        currentPhase = InnerPhase.INITIATE_GAME;
		skipDefendButton.gameObject.SetActive (false);
		simpleAttackButton.gameObject.SetActive (false);
    }
        /// <summary>
        /// Adds the specified child phases to the collection AND sets the parent phase property of the specified child phases
        /// </summary>
        /// <param name="parentPhaseModel">The phase which is to receive the child phases</param>
        /// <param name="childPhaseCollection">The child phases to add to the parent's collection</param>
        public static void AddMultipleChildPhases(this PhaseModel parentPhaseModel, IList <PhaseModel> childPhaseCollection)
        {
            if (childPhaseCollection == null)
            {
                return;
            }

            foreach (var childPhase in childPhaseCollection)
            {
                parentPhaseModel.AddChildPhase(childPhase);
            }
        }
Exemple #5
0
        public ImportMachineRequestWindow()
        {
            bwLoad                     = new BackgroundWorker();
            bwLoad.DoWork             += new DoWorkEventHandler(bwLoad_DoWork);
            bwLoad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoad_RunWorkerCompleted);

            phaseSelected             = new PhaseModel();
            phaseList                 = new List <PhaseModel>();
            machineList               = new List <MachineModel>();
            machineList_PhaseSelected = new List <MachineModel>();

            InitializeComponent();
        }
        /// <summary>
        /// Create project select list
        /// </summary>
        /// <returns></returns>
        private async Task <TaskViewModel> PrepareData()
        {
            TaskViewModel        viewModel = new TaskViewModel();
            IList <ProjectModel> projects  = await EzTask.Project.GetProjects(Context.CurrentAccount.AccountId);

            if (projects.Any())
            {
                viewModel.Project = projects.First();
                PhaseModel features = await EzTask.Phase.GetOpenFeaturePhase(viewModel.Project.ProjectId);

                viewModel.Phase = features;
            }

            viewModel.ProjectItems = BuildProjectSelectList(projects);

            return(viewModel);
        }
Exemple #7
0
        public IActionResult AddPhase(PhaseModel pm, int projectId)
        {
            if (pm == null)
            {
                return(BadRequest("Phase cannot be null"));
            }

            Phase p = new Phase()
            {
                Project     = _projManager.GetProject(projectId, false),
                Description = pm.Description,
                StartDate   = pm.StartDate,
                EndDate     = pm.EndDate
            };

            _projManager.MakePhase(p);

            return(RedirectToAction("CollectProject", "Platform", new { id = projectId }));
        }
Exemple #8
0
        /// <summary>
        /// Delete phase
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <ResultModel <PhaseModel> > Delele(PhaseModel model)
        {
            ResultModel <PhaseModel> result = new ResultModel <PhaseModel>();

            if (!IsOwner(model.ProjectId))
            {
                result.Status = ActionStatus.UnAuthorized;
            }
            else
            {
                UnitOfWork.PhaseRepository.Delete(model.Id);
                int iResult = await UnitOfWork.CommitAsync();

                if (iResult > 0)
                {
                    result.Status = ActionStatus.Ok;
                }
            }

            return(result);
        }
Exemple #9
0
        public async Task <IActionResult> CreateOrUpdatePhase(PhaseViewModel viewmodel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(Context.GetStringResource("CreatePhaseError", StringResourceType.TaskPage)));
            }

            PhaseModel model = new PhaseModel()
            {
                StartDate = DateTimeUtilities.ParseFromString(viewmodel.StartDate),
                EndDate   = DateTimeUtilities.ParseFromString(viewmodel.EndDate),
                Id        = viewmodel.PhaseId,
                PhaseName = viewmodel.PhaseName,
                ProjectId = viewmodel.ProjectId,
                IsDefault = viewmodel.IsDefault,
                PhaseGoal = viewmodel.PhaseGoal,
                Status    = viewmodel.Status.ToEnum <PhaseStatus>()
            };

            if (model.EndDate < model.StartDate)
            {
                return(BadRequest(Context.GetStringResource("DateRange", StringResourceType.Error)));
            }

            ResultModel <PhaseModel> iResult = await EzTask.Phase.Save(model);

            if (iResult.Status == ActionStatus.Ok)
            {
                return(await LoadPhaseListAsync(model.ProjectId));
            }

            if (model.Id > 0)
            {
                return(BadRequest(Context.GetStringResource("UpdatePhaseError", StringResourceType.TaskPage)));
            }
            return(BadRequest(Context.GetStringResource("CreatePhaseError", StringResourceType.TaskPage)));
        }
Exemple #10
0
 public void Switch_Toggled(PhaseModel phase)
 {
     phase.IsSelected = !phase.IsSelected;
     this.Vm.ValidateStageSelection();
 }
 public TaskViewModel()
 {
     ProjectItems = new List <SelectListItem>();
     Project      = new ProjectModel();
     Phase        = new PhaseModel();
 }
        /// <summary>
        /// Compare changes of old and new task
        /// </summary>
        /// <param name="newData"></param>
        /// <param name="oldData"></param>
        /// <returns></returns>
        public async Task <string> CompareChangesAsync(TaskItemModel newData, TaskItemModel oldData)
        {
            if (newData.TaskId != oldData.TaskId)
            {
                return(string.Empty);
            }

            string content = string.Empty;

            if (newData.TaskTitle != oldData.TaskTitle)
            {
                content += FormartHistoryContent("Title", oldData.TaskTitle, newData.TaskTitle);
            }

            if (newData.TaskDetail != oldData.TaskDetail)
            {
                content += FormartHistoryContent("Detail", oldData.TaskDetail, newData.TaskDetail);
            }

            if (newData.Phase.Id != oldData.Phase.Id)
            {
                string oldItem = "Open Features";
                string newItem = "Open Features";
                if (newData.Phase.Id > 0)
                {
                    PhaseModel phase = await _phase.GetPhaseById(newData.Phase.Id);

                    newItem = phase.PhaseName;
                }
                if (oldData.Phase.Id > 0)
                {
                    PhaseModel phase = await _phase.GetPhaseById(oldData.Phase.Id);

                    oldItem = phase.PhaseName;
                }
                content += FormartHistoryContent("Phase", oldItem, newItem);
            }

            if (newData.Assignee.AccountId != oldData.Assignee.AccountId)
            {
                string oldItem = "Non-Assigned";
                string newItem = "Non-Assigned";
                if (newData.Assignee.AccountId > 0)
                {
                    AccountInfoModel account = await _account.GetAccountInfo(newData.Assignee.AccountId);

                    newItem = account.DisplayName;
                }
                if (oldData.Assignee.AccountId > 0)
                {
                    AccountInfoModel account = await _account.GetAccountInfo(oldData.Assignee.AccountId);

                    oldItem = account.DisplayName;
                }
                content += FormartHistoryContent("Assignee", oldItem, newItem);
            }

            if (newData.Priority != oldData.Priority)
            {
                string oldItem = oldData.Priority.ToString();
                string newItem = newData.Priority.ToString();
                content += FormartHistoryContent("Priority", oldItem, newItem);
            }

            if (newData.Status != oldData.Status)
            {
                string oldItem = oldData.Status.ToString();
                string newItem = newData.Status.ToString();
                content += FormartHistoryContent("Status", oldItem, newItem);
            }

            if (newData.PercentCompleted != oldData.PercentCompleted)
            {
                string oldItem = oldData.PercentCompleted.ToString();
                string newItem = newData.PercentCompleted.ToString();
                content += FormartHistoryContent("Percent Completed", oldItem, newItem);
            }

            return(content);
        }
Exemple #13
0
        private void cbPhase_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            phaseSelected             = cbPhase.SelectedItem as PhaseModel;
            machineList_PhaseSelected = machineList.Where(w => w.PhaseID == phaseSelected.PhaseID).ToList();

            // show machine
            var machineListActList = machineList_PhaseSelected.Where(w => w.IsMachine == true).ToList();

            grbMachine.Header = String.Format("Input Machine Request for: {0}", phaseSelected.PhaseName);

            gridMachine.Children.Clear();
            int countColumn = gridMachine.ColumnDefinitions.Count();
            int countRow    = countRow = machineListActList.Count / countColumn;

            if (machineListActList.Count % countColumn != 0)
            {
                countRow = machineListActList.Count / countColumn + 1;
            }
            gridMachine.RowDefinitions.Clear();

            for (int i = 1; i <= countRow; i++)
            {
                RowDefinition rd = new RowDefinition
                {
                    Height = new GridLength(1, GridUnitType.Star),
                };
                gridMachine.RowDefinitions.Add(rd);
            }

            for (int i = 0; i <= machineListActList.Count() - 1; i++)
            {
                MachineModel machine    = machineListActList[i];
                StackPanel   stkMachine = new StackPanel();
                stkMachine.Orientation = Orientation.Vertical;

                stkMachine.Margin = new Thickness(4, 0, 4, 0);
                if (i / countColumn > 0)
                {
                    stkMachine.Margin = new Thickness(4, 4, 4, 0);
                }

                TextBlock txtMachineName = new TextBlock();
                txtMachineName.Text       = machine.MachineName;
                txtMachineName.FontWeight = FontWeights.SemiBold;

                TextBox txtMachineID = new TextBox();
                txtMachineID.Tag         = machine;
                txtMachineID.BorderBrush = Brushes.Black;
                txtMachineID.Foreground  = Brushes.Blue;
                txtMachineID.VerticalContentAlignment = VerticalAlignment.Center;
                //txtMachineID.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(txtMachineID_LostKeyboardFocus);

                stkMachine.Children.Add(txtMachineName);
                stkMachine.Children.Add(txtMachineID);
                Grid.SetColumn(stkMachine, i % countColumn);
                Grid.SetRow(stkMachine, i / countColumn);

                gridMachine.Children.Add(stkMachine);
            }
            // show worker
            var machineIsWorkerListAct = machineList_PhaseSelected.Where(w => w.PhaseID == phaseSelected.PhaseID && w.IsMachine == false).ToList();

            for (int i = 0; i <= machineIsWorkerListAct.Count() - 1; i++)
            {
                var machine = machineIsWorkerListAct[i];
            }
        }