예제 #1
0
        private void GetJobAndInstructions()
        {
            // Get the job.
            using (Facade.IInstruction facInstruction = new Facade.Instruction())
            {
                _endInstruction = facInstruction.GetInstruction(_instructionId);

                // Try and get the job from the cache
                _job = (Entities.Job)Cache.Get("JobEntityForJobId" + _jobId.ToString());

                if (_job == null)
                {
                    Facade.IJob facJob = new Facade.Job();
                    _job = facJob.GetJob(_jobId);

                    // Job was not in the cache thus get the instruction collection from the db
                    _instructions = new Facade.Instruction().GetForJobId(_jobId);

                    // Get the previous instruction
                    _startInstruction = _instructions.GetPreviousInstruction(_instructionId);
                }
                else
                {
                    // Job is in the cache, check for instructions

                    if (_job.Instructions != null)
                    {
                        // We have instructions
                        _instructions = _job.Instructions;

                        // use the instruction collection from the cached job
                        _startInstruction = _instructions.GetPreviousInstruction(_instructionId);
                    }
                    else
                    {
                        // otherwise get a fresh instruction collection
                        _instructions = new Facade.Instruction().GetForJobId(_jobId);

                        // Get the previous instruction
                        _startInstruction = _instructions.GetPreviousInstruction(_instructionId);
                    }
                }
            }
        }
예제 #2
0
        private void PopulateForm()
        {
            Facade.IInstruction facInstruction = new Facade.Instruction();
            m_instruction = facInstruction.GetInstruction(m_instructionID);

            bool canRemoveTrunkPoint = false;

            if (m_instruction != null)
            {
                if (m_instruction.InstructionTypeId == (int)eInstructionType.Trunk && (m_instruction.CollectDrops.Count == 0 || m_instruction.CollectDrops[0].OrderID == 0))
                {
                    canRemoveTrunkPoint = true; // This instruction is either a trunk or a trunk that has zero orders.
                }
                // Get the previous instruction.
                Entities.InstructionCollection instructions = facInstruction.GetForJobId(m_instruction.JobId);
                m_previousInstruction = instructions.GetPreviousInstruction(m_instruction.InstructionID);
            }

            pnlConfirmation.Visible      = canRemoveTrunkPoint;
            pnlCannotRemoveTrunk.Visible = !canRemoveTrunkPoint;
            btnRemoveTrunk.Visible       = canRemoveTrunkPoint;
        }