Ejemplo n.º 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                m_jobId = Convert.ToInt32(Request.QueryString["JobId"]);
            }
            catch {}

            if (!IsPostBack)
            {
                cboCallIns.Attributes.Add("onChange", "javascript:SelectCallIn()");

                if (m_jobId > 0)
                {
                    // Retrieve and populate the call in selector.
                    using (Facade.IInstruction facInstruction = new Facade.Instruction())
                    {
                        DataSet instructions = facInstruction.GetInstructionsForCallInSelection(m_jobId);
                        if (instructions.Tables[0].Rows.Count == 0)
                        {
                            cboCallIns.Visible = false;
                        }
                        else
                        {
                            DataView data = new DataView(instructions.Tables[0]);
                            if (m_hidePendingCallIns)
                            {
                                data.RowFilter = "InstructionActualId IS NOT NULL";
                            }

                            cboCallIns.DataValueField = "InstructionId";
                            cboCallIns.DataTextField  = "Description";
                            cboCallIns.DataSource     = data;
                            cboCallIns.DataBind();

                            cboCallIns.Items.Insert(0, new ListItem("-- Please select --", "0"));
                            if (cboCallIns.Items.Count == 1)
                            {
                                cboCallIns.Visible = false;
                            }
                        }
                    }
                }
                else
                {
                    cboCallIns.Visible = false;
                }
            }
        }