Exemplo n.º 1
0
        private void BindInstruction()
        {
            Entities.Instruction instruction = null;

            // Get the instruction to work with.
            using (Facade.IInstruction facInstruction = new Facade.Instruction())
            {
                if (m_instructionId == 0)
                {
                    // Get the job's next instruction.
                    instruction = facInstruction.GetNextInstruction(m_jobId);
                }
                else
                {
                    // Get the specific instruction.
                    instruction = facInstruction.GetInstruction(m_instructionId);
                }
            }

            if (instruction != null)
            {
                m_pointId = instruction.PointID;
                ViewState[C_POINT_ID_VS] = m_pointId;
            }
        }
        public void Populate()
        {
            GetSessionIDFromQueryString();

            rtsCallIn.Tabs.Clear();

            m_jobId         = Convert.ToInt32(Request.QueryString["jobId"]);
            m_instructionId = Convert.ToInt32(Request.QueryString["instructionId"]);

            // Get the instruction to work with.
            if (m_instructionId == 0)
            {
                using (Facade.IInstruction facInstruction = new Facade.Instruction())
                {
                    Entities.Instruction instruction = facInstruction.GetNextInstruction(m_jobId);
                    if (instruction != null)
                    {
                        m_instructionId = instruction.InstructionID;
                    }
                }
            }

            rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[0], "CallIn", 0));

            var instructionType = (from i in EF.DataContext.Current.InstructionSet
                                   where i.InstructionId == m_instructionId
                                   select i.InstructionType.InstructionTypeId).FirstOrDefault();

            if (instructionType == 2)
            {
                rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[1], "Refusal", 1));
                rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[2], "Shortage", 2));
            }

            rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[3], "tabReturns", 3));

            if (!((Entities.CustomPrincipal) this.Page.User).IsInRole(((int)eUserRole.SubConPortal).ToString()))
            {
                rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[4], "tabPCVS", 4));
                rtsCallIn.Tabs.Add(CreateTab(m_tabTexts[5], "tabProgress", 5));
            }

            int selectedTabID = 0;

            int.TryParse(Request.QueryString["t"], out selectedTabID);
            if (selectedTabID > -1 && rtsCallIn.Tabs.FindTabByText(m_tabTexts[selectedTabID]) != null)
            {
                rtsCallIn.Tabs.FindTabByText(m_tabTexts[selectedTabID]).Selected = true;
            }
        }