protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            int         index = Convert.ToInt32(e.CommandArgument);
            GridViewRow gvr   = GridView1.Rows[index];
            string      seqno = Server.HtmlDecode(gvr.Cells[1].Text);
            string      proj  = Server.HtmlDecode(gvr.Cells[3].Text);
            txtWOno.Text    = seqno;
            txtReqType.Text = proj;

            DsktpData DtopData = new DsktpData();
            if (!string.IsNullOrEmpty(txtWOno.Text) && !string.IsNullOrEmpty(txtReqType.Text))
            {
                if (DtopData.checkExistWOrecord(Convert.ToInt32(txtWOno.Text), proj))
                {
                    int wonum = Convert.ToInt32(txtWOno.Text);

                    clearPage();
                    WOdetailRecord dRec = new WOdetailRecord();
                    dRec = DtopData.getWOdetailData(wonum, proj);

                    WOresponseRecord rRec = new WOresponseRecord();
                    rRec = DtopData.getWOresponseData(wonum, proj);

                    WOstatusRecord sRec = new WOstatusRecord();
                    sRec = DtopData.getWOstatusData(wonum, proj);

                    bindWORecords(dRec, rRec, sRec);

                    LoadView4(wonum, proj);

                    //DataSet ds = DtopData.getSpDepElections(ssn);
                    //grvElections.DataSource = ds;
                    //grvElections.DataBind();

                    //int empno = Convert.ToInt32(txtXrefEmpno.Text);
                    //DataSet ds2 = DtopData.getSpDepNotes(empno, ssn);
                    //grvNotes.DataSource = ds2;
                    //grvNotes.DataBind();
                }
                else
                {
                    infoDiv1.Visible = true;
                    lblInfo.Text     = "There were no records returned for the search criteria.";
                }
            }
        }
    }
    protected void bindWORecords(WOdetailRecord dRec, WOresponseRecord rRec, WOstatusRecord sRec)
    {
        lblEmpHeading.Text = "WO #: " + dRec.SeqNo.ToString() + " / "
                             + dRec.WOname.ToString().ToUpper();

        txtWOno.Text          = dRec.SeqNo.ToString();
        txtReqType.Text       = dRec.Type;
        txtTitle.Text         = dRec.WOname;
        txtReqDate.Text       = (dRec.ReqDt.ToShortDateString() == "1/1/0001" ? "" : dRec.ReqDt.ToShortDateString());
        txtRespDueDt.Text     = (dRec.RespDt.ToShortDateString() == "1/1/0001" ? "" : dRec.RespDt.ToShortDateString());
        txtAuthor.Text        = dRec.AuthorID;
        txtLvl.Text           = dRec.ReqLvl.ToString();
        txtPriority.Text      = dRec.Priority;
        txtDescription.Text   = dRec.Description;
        txtJustification.Text = dRec.Justif;
        txtComments.Text      = dRec.Comments;

        txtProjName.Text       = rRec.ProjName;
        txtAnalyst.Text        = rRec.Analyst;
        txtAssignDt.Text       = (rRec.AssignDt.ToShortDateString() == "1/1/0001" ? "" : rRec.AssignDt.ToShortDateString());
        txtCompDt.Text         = (rRec.CompleteDt.ToShortDateString() == "1/1/0001" ? "" : rRec.CompleteDt.ToShortDateString());
        txtResults.Text        = rRec.Results;
        txtMonths.Text         = (rRec.ManMonth == 0 ? "" : rRec.ManMonth.ToString());
        txtHours.Text          = (rRec.ManHours == 0 ? "" : rRec.ManHours.ToString());
        txtConsiderations.Text = rRec.Considerations;
        txtRisks.Text          = rRec.Risks;

        txtStatus.Text       = sRec.Descr;
        txtStatDt.Text       = (sRec.StatusDt.ToShortDateString() == "1/1/0001" ? "" : sRec.StatusDt.ToShortDateString());
        txtApproval.Text     = (sRec.Approved.ToString() == "1" ? "Yes" : (sRec.Approved.ToString() == "0" ? "Not Reported" : ""));
        txtApproveDt.Text    = (sRec.ReqApprovalDt.ToShortDateString() == "1/1/0001" ? "" : sRec.ReqApprovalDt.ToShortDateString());
        txtStatAssignDt.Text = (sRec.ProjAssignDt.ToShortDateString() == "1/1/0001" ? "" : sRec.ProjAssignDt.ToShortDateString());
        txtProjLead.Text     = sRec.Developer;
        txtReqDefDt.Text     = (sRec.ReqDefDt.ToShortDateString() == "1/1/0001" ? "" : sRec.ReqDefDt.ToShortDateString());
        txtTechSpecDt.Text   = (sRec.TechSpecDt.ToShortDateString() == "1/1/0001" ? "" : sRec.TechSpecDt.ToShortDateString());
        txtDevComplDt.Text   = (sRec.StartDt.ToShortDateString() == "1/1/0001" ? "" : sRec.StartDt.ToShortDateString());
        txtTestComplDt.Text  = (sRec.CloseDt.ToShortDateString() == "1/1/0001" ? "" : sRec.CloseDt.ToShortDateString());
        txtProdApprovDt.Text = (sRec.GoDt.ToShortDateString() == "1/1/0001" ? "" : sRec.GoDt.ToShortDateString());
        txtStatComments.Text = sRec.Comments;
    }