protected void btnRetrieve_Click(object sender, EventArgs e) { DsktpData DtopData = new DsktpData(); if (!string.IsNullOrEmpty(txtSSNo.Text)) { if (DtopData.checkExistRecord(txtSSNo.Text)) { string ssn = txtSSNo.Text; clearPage(); SpDepRecord dRec = new SpDepRecord(); dRec = DtopData.getSpDepData(ssn); bindSpDepRecord(dRec); 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 { clearPage(); infoDiv1.Visible = true; lblInfo.Text = "There were no records returned for the search criteria."; } } }
protected void bindSpDepRecord(SpDepRecord pRec1) { lblEmpHeading.Text = "Employee - " + pRec1.EmpNum.ToString() + "/" + pRec1.LastName + ", " + pRec1.FirstName + " " + pRec1.MiddleInitial; txtXrefEmpno.Text = pRec1.EmpNum.ToString(); txtFirstName.Text = pRec1.FirstName; txtLastName.Text = pRec1.LastName; txtAddr1.Text = pRec1.Address1; txtAddr2.Text = pRec1.Address2; txtCity.Text = pRec1.City; txtState.Text = pRec1.State; txtZip.Text = pRec1.Zip; txtDob.Text = pRec1.DOB.ToShortDateString(); txtRelCd.Text = pRec1.RelCode; txtPhone.Text = pRec1.Phone; txtOrgCd.Text = pRec1.OrgCode; txtSSNo.Text = pRec1.SSN.PadLeft(9, '0'); string s = pRec1.SexCode; if (s.Equals("M")) { txtSexCd.Text = "Male"; } else if (s.Equals("F")) { txtSexCd.Text = "Female"; } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow gvr = GridView1.Rows[index]; string dssn = Server.HtmlDecode(gvr.Cells[3].Text); txtSSNo.Text = dssn; DsktpData DtopData = new DsktpData(); if (!string.IsNullOrEmpty(txtSSNo.Text)) { if (DtopData.checkExistRecord(txtSSNo.Text)) { string ssn = txtSSNo.Text; clearPage(); SpDepRecord dRec = new SpDepRecord(); dRec = DtopData.getSpDepData(ssn); bindSpDepRecord(dRec); 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."; } } } }