private void ReBuildTable() { const string METHOD_NAME = "ReBuildTable"; try { int crop_year = Convert.ToInt16(ddlCropYear.Text); string shid = txtSHID.Text; List <Contract> contractList = BeetDataContract.GetContracts(shid, crop_year, 0); if (contractList != null && contractList.Count > 0) { TableHeaderRow headerRow = new TableHeaderRow(); TableHeaderCell h1 = new TableHeaderCell(); h1.Text = "Contract No"; headerRow.Cells.Add(h1); TableHeaderCell h2 = new TableHeaderCell(); h2.Text = "PAC Dues"; headerRow.Cells.Add(h2); contractTable.Rows.Add(headerRow); for (int i = 0; i < contractList.Count; i++) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = Convert.ToString(contractList[i].contractNo); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = Convert.ToString(contractList[i].pacDues); row.Cells.Add(cell2); contractTable.Rows.Add(row); } } if (IndTable.Count > 0) { TableHeaderRow headerRow = new TableHeaderRow(); TableHeaderCell hshid = new TableHeaderCell(); hshid.Text = "SHID"; headerRow.Cells.Add(hshid); TableHeaderCell h1 = new TableHeaderCell(); h1.Text = "Sort"; headerRow.Cells.Add(h1); TableHeaderCell h2 = new TableHeaderCell(); h2.Text = "Individual"; headerRow.Cells.Add(h2); TableHeaderCell hEmail = new TableHeaderCell(); hEmail.Text = "Email"; headerRow.Cells.Add(hEmail); TableHeaderCell h3 = new TableHeaderCell(); h3.Text = "Individual Id"; h3.Attributes.Add("style", "display: none"); headerRow.Cells.Add(h3); TableHeaderCell h4 = new TableHeaderCell(); h4.Text = "Percent"; headerRow.Cells.Add(h4); TableHeaderCell h5 = new TableHeaderCell(); h5.Text = "Signature Date"; headerRow.Cells.Add(h5); TableHeaderCell h6 = new TableHeaderCell(); h6.Text = "Remove"; headerRow.Cells.Add(h6); indTable.Rows.Add(headerRow); for (int i = 0; i < this.IndTable.Count; i++) { var ind = PACData.GetPACIndividuals(this.IndTable[i].IndividualID, null)[0]; TableRow row = new TableRow(); TableCell cellshid = new TableCell(); cellshid.Text = GetShid(ind.SHID.ToString()); row.Cells.Add(cellshid); TableCell cell1 = new TableCell(); TextBox Sort = new TextBox(); Sort.ID = "Sort_" + i; Sort.Width = 15; Sort.MaxLength = 1; Sort.Attributes.Add("runat", "server"); Sort.Attributes.Add("class", "sort"); Sort.Text = Convert.ToString(this.IndTable[i].Sort).Trim(); cell1.Controls.Add(Sort); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = ind.FullName; cell2.Width = 150; row.Cells.Add(cell2); TableCell cellEmail = new TableCell(); cellEmail.Text = ind.Email; cellEmail.Width = 150; row.Cells.Add(cellEmail); TableCell cell3 = new TableCell(); HtmlInputHidden IndId = new HtmlInputHidden(); IndId.ID = "IndividualID_" + i; IndId.Value = Convert.ToString(this.IndTable[i].IndividualID); IndId.Attributes.Add("class", "individualid"); cell3.Controls.Add(IndId); cell3.Attributes.Add("style", "display: none"); row.Cells.Add(cell3); TableCell cell4 = new TableCell(); TextBox Percentage = new TextBox(); Percentage.ID = "Percentage_" + i; Percentage.Width = 25; Percentage.MaxLength = 5; Percentage.Attributes.Add("runat", "server"); Percentage.Attributes.Add("class", "percentage"); Percentage.Text = Convert.ToString(this.IndTable[i].Percentage); cell4.Controls.Add(Percentage); row.Cells.Add(cell4); /* * TableCell cell4 = new TableCell(); * HtmlInputCheckBox Signed = new HtmlInputCheckBox(); * Signed.ID = "Signed_" + i; * Signed.Checked = this.IndTable[i].Signed; * Signed.Attributes.Add("runat", "server"); * Signed.Attributes.Add("class", "signed"); * cell4.Controls.Add(Signed); * row.Cells.Add(cell4); */ TableCell cell5 = new TableCell(); HtmlInputText SignedDate = new HtmlInputText(); SignedDate.ID = "SignedDate_" + i; SignedDate.Size = 10; if (this.IndTable[i].Signed) { SignedDate.Value = this.IndTable[i].SignedDate.ToString("MM/dd/yyyy"); } SignedDate.Attributes.Add("class", "signedDate"); SignedDate.Attributes.Add("onclick", "JavaScript:LaunchDatePicker(this);"); cell5.Controls.Add(SignedDate); row.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Attributes.Add("style", "text-align: center;"); HtmlAnchor anchor = new HtmlAnchor(); anchor.HRef = "javascript:void(0);"; anchor.InnerText = "X"; anchor.Attributes.Add("onclick", "DeleteIndRow(this);"); cell6.Controls.Add(anchor); row.Cells.Add(cell6); indTable.Rows.Add(row); } } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void ReBuildTable() { int crop_year = Convert.ToInt16(ddlCropYear.Text); string shid = txtSHID.Text; List <Contract> contractList = BeetDataContract.GetContracts(shid, crop_year, 0); if (contractList != null && contractList.Count > 0) { TableHeaderRow headerRow = new TableHeaderRow(); TableHeaderCell h1 = new TableHeaderCell(); h1.Text = "Contract No"; headerRow.Cells.Add(h1); TableHeaderCell h2 = new TableHeaderCell(); h2.Text = "PAC Dues"; headerRow.Cells.Add(h2); contractTable.Rows.Add(headerRow); for (int i = 0; i < contractList.Count; i++) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = Convert.ToString(contractList[i].contractNo); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.Text = Convert.ToString(contractList[i].pacDues); row.Cells.Add(cell2); contractTable.Rows.Add(row); } } if (IndTable.Count > 0) { TableHeaderRow headerRow = new TableHeaderRow(); TableHeaderCell hshid = new TableHeaderCell(); hshid.Text = "SHID"; headerRow.Cells.Add(hshid); TableHeaderCell h1 = new TableHeaderCell(); h1.Text = "Sort"; headerRow.Cells.Add(h1); TableHeaderCell h2 = new TableHeaderCell(); h2.Text = "Individual"; headerRow.Cells.Add(h2); TableHeaderCell h3 = new TableHeaderCell(); h3.Text = "Individual Id"; h3.Attributes.Add("style", "display: none"); headerRow.Cells.Add(h3); TableHeaderCell h4 = new TableHeaderCell(); h4.Text = "Assigned Percentage"; headerRow.Cells.Add(h4); TableHeaderCell h5 = new TableHeaderCell(); h5.Text = "Signature Date"; headerRow.Cells.Add(h5); TableHeaderCell h6 = new TableHeaderCell(); h6.Text = "Remove"; headerRow.Cells.Add(h6); grdIndividuals.Rows.Add(headerRow); for (int i = 0; i < this.IndTable.Count; i++) { TableRow row = new TableRow(); TableCell cellshid = new TableCell(); TextBox SHID = new TextBox(); SHID.ID = "SHID_" + i; SHID.Width = 50; SHID.MaxLength = 6; SHID.Attributes.Add("runat", "server"); SHID.Attributes.Add("class", "shid"); SHID.Text = Convert.ToString(this.IndTable[i].SHID).Trim(); if (SHID.Text == "0") { SHID.Text = this.MySHID; } cellshid.Controls.Add(SHID); row.Cells.Add(cellshid); TableCell cell1 = new TableCell(); TextBox Sort = new TextBox(); Sort.ID = "Sort_" + i; Sort.Width = 15; Sort.MaxLength = 1; Sort.Attributes.Add("runat", "server"); Sort.Attributes.Add("class", "sort"); Sort.Text = Convert.ToString(this.IndTable[i].Sort).Trim(); cell1.Controls.Add(Sort); row.Cells.Add(cell1); TableCell cell2 = new TableCell(); string fName = this.IndTable[i].FullName; if (fName == null || fName.Length == 0) { List <Individual> inds = PACData.GetPACIndividuals(this.IndTable[i].IndividualID, null); if (inds != null && inds.Count > 0) { fName = ((Individual)inds[0]).FullName; } } cell2.Text = fName; row.Cells.Add(cell2); TableCell cell3 = new TableCell(); HtmlInputHidden IndId = new HtmlInputHidden(); IndId.ID = "IndividualID_" + i; IndId.Value = Convert.ToString(this.IndTable[i].IndividualID); IndId.Attributes.Add("class", "individualid"); cell3.Controls.Add(IndId); cell3.Attributes.Add("style", "display: none"); row.Cells.Add(cell3); TableCell cell4 = new TableCell(); TextBox Percentage = new TextBox(); Percentage.ID = "Percentage_" + i; Percentage.Width = 25; Percentage.MaxLength = 5; Percentage.Attributes.Add("runat", "server"); Percentage.Attributes.Add("class", "percentage"); Percentage.Text = Convert.ToString(this.IndTable[i].Percentage); cell4.Controls.Add(Percentage); row.Cells.Add(cell4); /* * TableCell cell4 = new TableCell(); * HtmlInputCheckBox Signed = new HtmlInputCheckBox(); * Signed.ID = "Signed_" + i; * Signed.Checked = this.IndTable[i].Signed; * Signed.Attributes.Add("runat", "server"); * Signed.Attributes.Add("class", "signed"); * cell4.Controls.Add(Signed); * row.Cells.Add(cell4); */ TableCell cell5 = new TableCell(); HtmlInputText SignedDate = new HtmlInputText(); SignedDate.ID = "SignedDate_" + i; SignedDate.Size = 10; if (this.IndTable[i].Signed) { SignedDate.Value = this.IndTable[i].SignedDate.ToString("MM/dd/yyyy"); } SignedDate.Attributes.Add("class", "signedDate"); SignedDate.Attributes.Add("onclick", "JavaScript:LaunchDatePicker(this);"); cell5.Controls.Add(SignedDate); row.Cells.Add(cell5); TableCell cell6 = new TableCell(); cell6.Attributes.Add("style", "text-align: center;"); HtmlAnchor anchor = new HtmlAnchor(); anchor.HRef = "javascript:void(0);"; anchor.InnerText = "X"; anchor.Attributes.Add("onclick", "DeleteIndRow(this);"); cell6.Controls.Add(anchor); row.Cells.Add(cell6); grdIndividuals.Rows.Add(row); } } }