/// <summary> /// generates a footer row containing an insert functionality /// </summary> /// <param name="reader"></param> /// <param name="counter"></param> /// <returns></returns> private TableFooterRow GenerateFooterRow(SqlDataReader reader, ref int counter) { TableFooterRow row = new TableFooterRow(); TableCell cell; for (int i = 0; i < reader.FieldCount; i++) { cell = new TableCell(); if (i > 0) { switch (reader.GetFieldType(i).ToString()) { case "System.Int32": cell.Controls.Add(GenerateTextBox("", counter++, false)); cell.ToolTip = ""; break; case "System.String": cell.Controls.Add(GenerateTextBox("", counter++, false)); cell.ToolTip = ""; break; case "System.Boolean": cell.Controls.Add(GenerateCheckBox(false, false)); break; } } cell.CssClass = "table-footer-cell"; row.Controls.Add(cell); } return(row); }
/// <summary> /// Renders the table for text count /// </summary> protected void RenderTextTable() { //Convert Dictionary<string, int> to KeyValuePair<string, int> for easier sorting. Sort the pairs by value descending. Take the top 7. List <KeyValuePair <string, int> > list = textDict.ToList(); list.Sort((pair1, pair2) => pair2.Value.CompareTo(pair1.Value)); var topSevenItems = list.Take(7); //Create a TableRow with TableCells for each KeyValuePair. Populate our Table with these new rows. foreach (var item in topSevenItems) { TableRow tr = new TableRow { BorderStyle = BorderStyle.Groove }; TableCell tc1 = new TableCell { Text = item.Key, HorizontalAlign = HorizontalAlign.Left }; TableCell tc2 = new TableCell { Text = item.Value.ToString(), HorizontalAlign = HorizontalAlign.Left }; tr.Cells.Add(tc1); tr.Cells.Add(tc2); tblData.Rows.Add(tr); } TableFooterRow trf = new TableFooterRow(); TableCell tc = new TableCell { Text = String.Format("Total number of words: {0}", wordCount.ToString()), ColumnSpan = 2 }; trf.Cells.Add(tc); tblData.Rows.Add(trf); tblData.Visible = true; }
protected void grdvUser_PreRender(object sender, EventArgs e) { int j = 0; j = grdvUser.Rows.Count; if (j > 0) { grdvUser.UseAccessibleHeader = false; grdvUser.HeaderRow.TableSection = TableRowSection.TableHeader; grdvUser.FooterRow.TableSection = TableRowSection.TableFooter; int CellCount = grdvUser.FooterRow.Cells.Count; grdvUser.FooterRow.Cells.Clear(); grdvUser.FooterRow.Cells.Add(new TableCell()); grdvUser.FooterRow.Cells[0].ColumnSpan = CellCount - 1; grdvUser.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right; grdvUser.FooterRow.Cells.Add(new TableCell()); TableFooterRow tfr = new TableFooterRow(); for (int i = 0; i < CellCount; i++) { tfr.Cells.Add(new TableCell()); grdvUser.FooterRow.Controls[1].Controls.Add(tfr); } } }
protected void gvPartyDetails_PreRender(object sender, EventArgs e) { try { if (gvPartyDetails.Rows.Count > 0) { gvPartyDetails.UseAccessibleHeader = false; gvPartyDetails.HeaderRow.TableSection = TableRowSection.TableHeader; gvPartyDetails.FooterRow.TableSection = TableRowSection.TableFooter; int CellCount = gvPartyDetails.FooterRow.Cells.Count; gvPartyDetails.FooterRow.Cells.Clear(); gvPartyDetails.FooterRow.Cells.Add(new TableCell()); gvPartyDetails.FooterRow.Cells[0].ColumnSpan = CellCount - 1; gvPartyDetails.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right; gvPartyDetails.FooterRow.Cells.Add(new TableCell()); TableFooterRow tfr = new TableFooterRow(); for (int i = 0; i < CellCount; i++) { tfr.Cells.Add(new TableCell()); } gvPartyDetails.FooterRow.Controls[1].Controls.Add(tfr); } } catch (Exception ex) { ErrorLog.saveerror(ex); } }
private void AdicionarLinhaMunicipio(string pNomeMunicipio) { TableFooterRow LinhaMunicipio = new TableFooterRow(); LinhaMunicipio.Font.Bold = true; LinhaMunicipio.BackColor = System.Drawing.Color.LightGray; TableCell ColunaMunicipioMercado = new TableCell(); ColunaMunicipioMercado.HorizontalAlign = HorizontalAlign.Center; ColunaMunicipioMercado.Text = pNomeMunicipio; LinhaMunicipio.Cells.Add(ColunaMunicipioMercado); TableCell ColunaMunicipioTotalVendedores = new TableCell(); ColunaMunicipioTotalVendedores.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioTotalVendedores.Text = MunicipioTotalVendedores.ToString(); LinhaMunicipio.Cells.Add(ColunaMunicipioTotalVendedores); TableCell ColunaMunicipioPresencas = new TableCell(); ColunaMunicipioPresencas.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioPresencas.Text = MunicipioTotalPresencas.ToString(); LinhaMunicipio.Cells.Add(ColunaMunicipioPresencas); TableCell ColunaMunicipioAusencias = new TableCell(); ColunaMunicipioAusencias.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioAusencias.Text = MunicipioTotalAusencias.ToString(); LinhaMunicipio.Cells.Add(ColunaMunicipioAusencias); TableCell ColunaMunicipioTaxas = new TableCell(); ColunaMunicipioTaxas.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioTaxas.Text = MunicipioTotalTaxas.ToString("#,###,##0.00"); LinhaMunicipio.Cells.Add(ColunaMunicipioTaxas); TableCell ColunaMunicipioValorPago = new TableCell(); ColunaMunicipioValorPago.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioValorPago.Text = MunicipioTotalPagamentos.ToString("#,###,##0.00"); LinhaMunicipio.Cells.Add(ColunaMunicipioValorPago); TableCell ColunaMunicipioValorDevido = new TableCell(); ColunaMunicipioValorDevido.HorizontalAlign = HorizontalAlign.Right; ColunaMunicipioValorDevido.Text = MunicipioTotalDevido.ToString("#,###,##0.00"); LinhaMunicipio.Cells.Add(ColunaMunicipioValorDevido); TableDados.Rows.Add(LinhaMunicipio); // MunicipioTotalVendedores = 0; MunicipioTotalPresencas = 0; MunicipioTotalAusencias = 0; MunicipioTotalTaxas = 0; MunicipioTotalPagamentos = 0; MunicipioTotalDevido = 0; }
private void AdicionarRodape() { TableFooterRow LinhaRodape = new TableFooterRow(); LinhaRodape.Font.Bold = true; LinhaRodape.BackColor = System.Drawing.Color.CadetBlue; LinhaRodape.ForeColor = System.Drawing.Color.White; TableCell ColunaRodapeTotais = new TableCell(); ColunaRodapeTotais.HorizontalAlign = HorizontalAlign.Center; ColunaRodapeTotais.Text = "Totais"; LinhaRodape.Cells.Add(ColunaRodapeTotais); TableCell ColunaRodape2 = new TableCell(); ColunaRodape2.HorizontalAlign = HorizontalAlign.Right; ColunaRodape2.Text = " "; LinhaRodape.Cells.Add(ColunaRodape2); TableCell ColunaRodape3 = new TableCell(); ColunaRodape3.HorizontalAlign = HorizontalAlign.Right; ColunaRodape3.Text = " "; LinhaRodape.Cells.Add(ColunaRodape3); TableCell ColunaRodape4 = new TableCell(); ColunaRodape4.HorizontalAlign = HorizontalAlign.Right; ColunaRodape4.Text = " "; LinhaRodape.Cells.Add(ColunaRodape4); TableCell ColunaRodape5 = new TableCell(); ColunaRodape5.HorizontalAlign = HorizontalAlign.Right; ColunaRodape5.Text = " "; LinhaRodape.Cells.Add(ColunaRodape5); TableCell ColunaRodape6 = new TableCell(); ColunaRodape6.HorizontalAlign = HorizontalAlign.Right; ColunaRodape6.Text = " "; LinhaRodape.Cells.Add(ColunaRodape6); TableCell ColunaRodapeTotal = new TableCell(); ColunaRodapeTotal.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeTotal.Text = VendaAtual.ValorTotal.Value.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeTotal); TableCell ColunaRodapeExcluir = new TableCell(); ColunaRodapeExcluir.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeExcluir.Text = " "; LinhaRodape.Cells.Add(ColunaRodapeExcluir); TableDados.Rows.Add(LinhaRodape); }
private void AdicionarRodape() { TableFooterRow LinhaRodape = new TableFooterRow(); LinhaRodape.Font.Bold = true; LinhaRodape.BackColor = System.Drawing.Color.CadetBlue; LinhaRodape.ForeColor = System.Drawing.Color.White; TableDados.Rows.Add(LinhaRodape); }
private void AdicionarRodape() { TableFooterRow LinhaRodape = new TableFooterRow(); LinhaRodape.Font.Bold = true; LinhaRodape.BackColor = System.Drawing.Color.CadetBlue; LinhaRodape.ForeColor = System.Drawing.Color.White; TableCell ColunaRodapeArea = new TableCell(); ColunaRodapeArea.HorizontalAlign = HorizontalAlign.Center; ColunaRodapeArea.Text = "Totais"; LinhaRodape.Cells.Add(ColunaRodapeArea); TableCell ColunaRodapeTotalVendedores = new TableCell(); ColunaRodapeTotalVendedores.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeTotalVendedores.Text = RodapeTotalVendedores.ToString(); LinhaRodape.Cells.Add(ColunaRodapeTotalVendedores); TableCell ColunaRodapePresencas = new TableCell(); ColunaRodapePresencas.HorizontalAlign = HorizontalAlign.Right; ColunaRodapePresencas.Text = RodapeTotalPresencas.ToString(); LinhaRodape.Cells.Add(ColunaRodapePresencas); TableCell ColunaRodapeAusencias = new TableCell(); ColunaRodapeAusencias.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeAusencias.Text = RodapeTotalAusencias.ToString(); LinhaRodape.Cells.Add(ColunaRodapeAusencias); TableCell ColunaRodapeTaxas = new TableCell(); ColunaRodapeTaxas.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeTaxas.Text = RodapeTotalTaxas.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeTaxas); TableCell ColunaRodapeValorPago = new TableCell(); ColunaRodapeValorPago.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeValorPago.Text = RodapeTotalPagamentos.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeValorPago); TableCell ColunaRodapeValorDevido = new TableCell(); ColunaRodapeValorDevido.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeValorDevido.Text = RodapeTotalDevido.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeValorDevido); TableDados.Rows.Add(LinhaRodape); }
/// <summary> /// checks if insert row is full (recursively) /// </summary> /// <param name="row"></param> /// <param name="index"></param> /// <returns></returns> private bool InsertRowFull(TableFooterRow row, int index) { if (index >= row.Controls.Count) { return(true); } if (row.Controls[index].Controls[0] is TextBox) { index++; return(((TextBox)row.Controls[index - 1].Controls[0]).Text.Length > 0 && InsertRowFull(row, index)); } else { index++; return(InsertRowFull(row, index)); } }
/// <summary> /// Generates the t foot. /// </summary> /// <returns>TableFooterRow.</returns> public TableFooterRow GenerateTFoot() { var tableFootRow = new TableFooterRow { TableSection = TableRowSection.TableFooter }; foreach (var dataPt in Properties.Data) { var cell = new TableCell { Text = dataPt.ToString() }; tableFootRow.Cells.Add(cell); } return(tableFootRow); }
public static string Table(IDataReader rd, string title = null, int?maxrows = null, string excellink = null) { var t = PythonModel.HtmlTable(rd, title, maxrows); var sb = new StringBuilder(); if (excellink.HasValue()) { var tc = new TableCell() { ColumnSpan = rd.FieldCount, Text = excellink, }; var tr = new TableFooterRow(); tr.Cells.Add(tc); t.Rows.Add(tr); } t.RenderControl(new HtmlTextWriter(new StringWriter(sb))); return(sb.ToString()); }
protected void grdvUser_PreRender(object sender, EventArgs e) { try { int j = 0; j = grdvUser.Rows.Count; if (j > 0) { grdvUser.UseAccessibleHeader = false; grdvUser.HeaderRow.TableSection = TableRowSection.TableHeader; grdvUser.FooterRow.TableSection = TableRowSection.TableFooter; int CellCount = grdvUser.FooterRow.Cells.Count; grdvUser.FooterRow.Cells.Clear(); grdvUser.FooterRow.Cells.Add(new TableCell()); grdvUser.FooterRow.Cells[0].ColumnSpan = CellCount - 1; grdvUser.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right; grdvUser.FooterRow.Cells.Add(new TableCell()); TableFooterRow tfr = new TableFooterRow(); for (int i = 0; i < CellCount; i++) { tfr.Cells.Add(new TableCell()); grdvUser.FooterRow.Controls[1].Controls.Add(tfr); } } } catch (Exception ex) { AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "grdvUser_PreRender"; String MODULE_NAME = "KPIEntry.aspx"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); } }
protected void GridView1_PreRender(object sender, EventArgs e) { if (GridView1.Rows.Count > 0) { GridView1.UseAccessibleHeader = false; GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; GridView1.FooterRow.TableSection = TableRowSection.TableFooter; int CellCount = GridView1.FooterRow.Cells.Count; GridView1.FooterRow.Cells.Clear(); GridView1.FooterRow.Cells.Add(new TableCell()); GridView1.FooterRow.Cells[0].ColumnSpan = CellCount - 1; GridView1.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right; GridView1.FooterRow.Cells.Add(new TableCell()); TableFooterRow tfr = new TableFooterRow(); for (int i = 0; i < CellCount; i++) { tfr.Cells.Add(new TableCell()); } GridView1.FooterRow.Controls[1].Controls.Add(tfr); } }
private void UCViewInformation(List <R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadExtendedStructure> YourLst) { try { while (TblLoadCapacitorLoads.Rows.Count > 1) { TblLoadCapacitorLoads.Rows.RemoveAt(1); } for (int Loopx = 0; Loopx <= YourLst.Count - 1; Loopx++) { TableRow tempRow = new TableRow(); TableCell tempCell = null; tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].StrAddress; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].StrDescription; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].StrBarName; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].StrPriceSug.ToString(); tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].nCarNumKol.ToString(); tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].LoaderTypeTitle; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].LoadTargetTitle; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].GoodTitle; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); tempCell.Text = YourLst[Loopx].dDateElam + " - " + YourLst[Loopx].dTimeElam; tempRow.Cells.Add(tempCell); tempCell = new TableCell(); LinkButton myLbnEstelamId = new LinkButton(); myLbnEstelamId.Click += LinkButtons_ClickHandler; myLbnEstelamId.ForeColor = Color.Red; myLbnEstelamId.Text = YourLst[Loopx].nEstelamId.ToString(); tempCell.Controls.Add(myLbnEstelamId); tempRow.Cells.Add(tempCell); TblLoadCapacitorLoads.Rows.Add(tempRow); } TableFooterRow tempFooterRow = new TableFooterRow(); tempFooterRow.BackColor = Color.LightBlue; tempFooterRow.BorderColor = Color.LightBlue; TblLoadCapacitorLoads.Rows.Add(tempFooterRow); } catch (Exception ex) { throw new Exception(MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + "/n/r" + ex.Message); } }
private TableFooterRow GetFooterRow(bool showRequiredTable) { TableFooterRow footerRow = new TableFooterRow(); TableCell cell = new TableCell(); cell.ColumnSpan = this.RepeatColumns * 2; Control container = ((showRequiredTable && (this.Theme != MasterPageTheme.Modern)) ? MagicForm.AddRequiredTable(cell) : cell); container.Controls.Add(this.UpdateButton); AutoGeneratedButtonsField.InsertButtonSeparator(container); if (this.ShowCloseButtonSeparate) { container.Controls.Add(this.CloseButton); AutoGeneratedButtonsField.InsertButtonSeparator(container); } container.Controls.Add(this.CancelLink); footerRow.Cells.Add(cell); return(footerRow); }
private void ViewProcesses() { try { var InstanceLogin = new ATISWebMClassLoginManager(); var Lst = R2CoreMClassWebProcessesManagement.GetWebProcesses(InstanceLogin.GetNSSCurrentUser()); int X = Lst.Count - 1; while (X >= 0) { TableRow tempRow = new TableRow(); if (X >= 0) { tempRow.Cells.Add(GetTempCell(Lst[X])); } if (X - 1 >= 0) { tempRow.Cells.Add(GetTempCell(Lst[X - 1])); } if (X - 2 >= 0) { tempRow.Cells.Add(GetTempCell(Lst[X - 2])); } if (X - 3 >= 0) { tempRow.Cells.Add(GetTempCell(Lst[X - 3])); } TblProcesses.Rows.Add(tempRow); X = X - 4; } TableFooterRow tempFooterRow = new TableFooterRow(); tempFooterRow.BackColor = Color.LightBlue; tempFooterRow.BorderColor = Color.LightBlue; TblProcesses.Rows.Add(tempFooterRow); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + "." + ex.Message + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"]); int locationId = Convert.ToInt32(Request.QueryString["location"]); if (Request.QueryString["id"] != null && Request.QueryString["location"] != null) { string invoicetype = ""; try { invoicetype = Request.QueryString["invoicetype"].ToString(); } catch (Exception) { } Entities.Register.SalesDeliveryNote sr = new Entities.Register.SalesDeliveryNote(); sr = Entities.Register.SalesDeliveryNote.GetDetails(id, locationId); dynamic setting = Entities.Application.Settings.GetFeaturedSettings(); lblCurrency.Text = Convert.ToString(setting.CurrencySymbol); Entities.Master.Company c = new Entities.Master.Company(); c = Entities.Master.Company.GetDetailsByLocation(locationId); lblCompRegNo.Text = c.RegId1; imgLogo.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; //lblCustName.Text = sr.Customer; lblCustomer.Text = sr.CustomerName; lblCustomerAddress1.Text = sr.BillingAddress[0].Address1; lblCustomerAddress2.Text = sr.BillingAddress[0].Address2; lblCustPh.Text = sr.BillingAddress[0].Phone1; lblCustEmail.Text = sr.BillingAddress[0].Email; lblCustTRN.Text = sr.CustomerTaxNo; lblComp.Text = sr.Company; lblTerms.Text = sr.TermsandConditon; lblJob.Text = sr.JobName; lblCompAddr1.Text = c.Address1; lblCompAddr2.Text = c.Address2; lblCompPh.Text = c.MobileNo1; lblCompEmail.Text = c.Email; lblCustPhone.Text = sr.BillingAddress[0].Phone1; lblCompanyEmail.Text = c.Email; lblLocName.Text = sr.Location; lblLocAddr1.Text = sr.LocationAddress1; lblLocAddr2.Text = sr.LocationAddress2; lblWords.Text = NumberToWords(Convert.ToDouble(sr.NetAmount)); //lblCustName.Text = sr.Customer; //lblDiscount.Text = Convert.ToString(sr.Discount); //lblFreight.Text = Convert.ToString(sr.FreightAmount); lblLocPhone.Text = sr.LocationPhone; lblDate.Text = sr.EntryDateString; lblInvoiceNo.Text = sr.DeliveryNoteNumber; lblTax.Text = Convert.ToString(sr.TaxAmount); lblGross.Text = Convert.ToString(sr.Gross); lblroundOff.Text = Convert.ToString(sr.RoundOff); //lblNet.Text = Convert.ToString(sr.NetAmount); lblAmountinWords.Text = Convert.ToString(sr.NetAmount); lblComp.Text = sr.Company; //lblDuedate.Text = sr.EntryDateString; lblCompanyPhone.Text = c.OfficeNo; //lblAddress.Text = sr.CustomerAddress; //lblCustName.Text = sr.Customer; lblCustPhone.Text = sr.BillingAddress[0].Phone1; //lblTfn.Text = sr.CustomerTaxNo; lblProjectName.Text = sr.JobName; lblDeduction.Text = Convert.ToString(sr.Discount); lblMainHead.Text = "Delivery Note"; //lblTrn.Text = sr.CustomerTaxNo; tAndC.Text = sr.TermsandConditon; //Entities.Application.Settings.GetSetting(148); if (invoicetype == "delivery") { thRate.Visible = false; thTotal.Visible = false; for (int i = 0; i < sr.Products.Count; i++) { TableRow r = new TableRow(); TableCell t1 = new TableCell(); t1.Text = (i + 1).ToString(); r.Cells.Add(t1); //TableCell t2 = new TableCell(); //t2.Text = sr.Products[i].ItemCode; //r.Cells.Add(t2); if (setting.EnableDescription)//Enabled Description { TableCell t3 = new TableCell(); t3.Width = 500; string itemName = "<b>"; itemName += sr.Products[i].Name; itemName += "</b><br/>"; itemName += sr.Products[i].Description; t3.Text = itemName; r.Cells.Add(t3); } else { TableCell t3 = new TableCell(); t3.Text = sr.Products[i].Name; r.Cells.Add(t3); } TableCell t4 = new TableCell(); t4.Text = sr.Products[i].Quantity.ToString(); t4.Style.Add("text-align", "right"); r.Cells.Add(t4); TableCell t5 = new TableCell(); t5.Text = sr.Products[i].Unit.ToString(); t5.Style.Add("text-align", "right"); r.Cells.Add(t5); //TableCell t5 = new TableCell(); //t5.Text = sr.Products[i].MRP.ToString(); //r.Cells.Add(t5); //TableCell t6 = new TableCell(); //t6.Text = sr.Products[i].SellingPrice.ToString(); //r.Cells.Add(t6); //TableCell t7 = new TableCell(); //t7.Text = sr.Products[i].TaxPercentage.ToString(); //r.Cells.Add(t7); //TableCell t8 = new TableCell(); //t8.Text = sr.Products[i].Gross.ToString(); //r.Cells.Add(t8); //TableCell t9 = new TableCell(); //t9.Text = sr.Products[i].TaxAmount.ToString(); //r.Cells.Add(t9); //TableCell t10 = new TableCell(); //t10.Text = sr.Products[i].NetAmount.ToString(); //r.Cells.Add(t10); listTable.Rows.Add(r); } } else { for (int i = 0; i < sr.Products.Count; i++) { TableRow r = new TableRow(); TableCell t1 = new TableCell(); t1.Text = (i + 1).ToString(); r.Cells.Add(t1); //TableCell t2 = new TableCell(); //t2.Text = sr.Products[i].ItemCode; //r.Cells.Add(t2); if (setting.EnableDescription)//Enabled Description { TableCell t3 = new TableCell(); t3.Width = 500; string itemName = "<b>"; itemName += sr.Products[i].Name; itemName += "</b><br/>"; itemName += sr.Products[i].Description; t3.Text = itemName; r.Cells.Add(t3); } else { TableCell t3 = new TableCell(); t3.Text = sr.Products[i].Name; r.Cells.Add(t3); } TableCell t4 = new TableCell(); t4.Text = sr.Products[i].Quantity.ToString(); t4.Style.Add("text-align", "right"); r.Cells.Add(t4); TableCell t5 = new TableCell(); t5.Text = sr.Products[i].Unit.ToString(); t5.Style.Add("text-align", "right"); r.Cells.Add(t5); //TableCell t5 = new TableCell(); //t5.Text = sr.Products[i].MRP.ToString(); //r.Cells.Add(t5); TableCell t6 = new TableCell(); t6.Text = sr.Products[i].CostPrice.ToString(); t6.Style.Add("text-align", "right"); r.Cells.Add(t6); //TableCell t7 = new TableCell(); //t7.Text = sr.Products[i].TaxPercentage.ToString(); //r.Cells.Add(t7); //TableCell t8 = new TableCell(); //t8.Text = sr.Products[i].Gross.ToString(); //r.Cells.Add(t8); //TableCell t9 = new TableCell(); //t9.Text = sr.Products[i].TaxAmount.ToString(); //r.Cells.Add(t9); TableCell t10 = new TableCell(); t10.Text = sr.Products[i].Gross.ToString(); t10.Style.Add("text-align", "right"); r.Cells.Add(t10); listTable.Rows.Add(r); } TableFooterRow tf = new TableFooterRow(); TableFooterRow TaxAmountcell = new TableFooterRow(); TableFooterRow SubTotal = new TableFooterRow(); tf.CssClass = "inv-footer beige"; TaxAmountcell.CssClass = "inv-footer beige"; SubTotal.CssClass = "inv-footer "; TableCell tfc1 = new TableCell(); tfc1.Text = "<b>VAT AMOUNT</b>"; tfc1.ColumnSpan = 5; tfc1.HorizontalAlign = HorizontalAlign.Right; TaxAmountcell.Cells.Add(tfc1); TableCell tfc2 = new TableCell(); tfc2.Text = "<b>" + Convert.ToString(sr.TaxAmount) + "</b>"; tfc2.HorizontalAlign = HorizontalAlign.Right; TaxAmountcell.Cells.Add(tfc2); listTable.Rows.Add(TaxAmountcell); TableCell tfc3 = new TableCell(); tfc3.Text = "<b>SUB TOTAL</b>"; tfc3.ColumnSpan = 5; tfc3.HorizontalAlign = HorizontalAlign.Right; SubTotal.Cells.Add(tfc3); TableCell tfc4 = new TableCell(); tfc4.Text = "<b>" + Convert.ToString(sr.Gross) + "</b>"; tfc4.HorizontalAlign = HorizontalAlign.Right; SubTotal.Cells.Add(tfc4); listTable.Rows.Add(SubTotal); TableCell tfc5 = new TableCell(); tfc5.Text = "<b>GRAND TOTAL ( " + setting.CurrencySymbol + " )</b>"; tfc5.ColumnSpan = 5; tfc5.HorizontalAlign = HorizontalAlign.Right; tf.Cells.Add(tfc5); TableCell tfc6 = new TableCell(); tfc6.Text = "<b>" + Convert.ToString(sr.NetAmount) + "</b>"; tfc6.HorizontalAlign = HorizontalAlign.Right; tf.Cells.Add(tfc6); listTable.Rows.Add(tf); } } } catch (Exception ex) { Entities.Application.Helper.LogException(ex, "Quote | Page_Load(object sender, EventArgs e)"); Response.Write("<script> alert('" + ex.Message + "') </script>"); } }
private void FillgvFields() { try { CUSTOMRP.Model.SOURCEVIEWCOLUMN svc = null; string tblviewname = this.ddlTblViewName.SelectedValue; int sourcetype = dbViewList.Where(x => x.TblViewName == tblviewname).First().SourceType; string[] strAllColumns = sourcetype == 2 ? CUSTOMRP.BLL.AppHelper.GetColumnNamesForStoredProc(me.ID, me.DatabaseNAME, tblviewname).OrderBy(x => x).ToArray() : CUSTOMRP.BLL.AppHelper.GetColumnNamesForTblView(me.ID, me.DatabaseNAME, tblviewname).OrderBy(x => x).ToArray(); //v1.8.2 Ben 2018.02.22 - Add to store actual columns name from DB Session[strSessionViewNew_strAllColumns] = strAllColumns; TableRow tr = null; TableHeaderRow thead = null; TableFooterRow tfoot = null; TableHeaderCell th = null; TableCell td = null; HtmlGenericControl span = null; HtmlInputText txt = null; HtmlInputCheckBox cb = null; string safeColName = null; // refresh column data if ((myView != null) && (myView.TBLVIEWNAME == tblviewname)) { if (!IsPostBack) { //v1.7.0 Ben 2017.08.21 - Does not show hidden column in default and hence checkbox must be checked //myColumns = WebHelper.bllSOURCEVIEWCOLUMN.GetModelsForSourceView(me.ID, myView.ID).OrderBy(x => x.COLUMNNAME).ToList(); myColumns = WebHelper.bllSOURCEVIEWCOLUMN.GetModelsForSourceView(me.ID, myView.ID, true).OrderBy(x => x.COLUMNNAME).ToList(); Session[strSessionViewNew_myColumns] = myColumns; } } gvFields.Rows.Clear(); #region Header thead = new TableHeaderRow(); thead.TableSection = TableRowSection.TableHeader; th = new TableHeaderCell(); th.Text = "Field Name"; thead.Cells.Add(th); th = new TableHeaderCell(); th.Text = "Display Name"; thead.Cells.Add(th); th = new TableHeaderCell(); th.Text = "Visible"; thead.Cells.Add(th); this.gvFields.Rows.Add(thead); #endregion #region Body foreach (string colname in strAllColumns) { if (myColumns != null) { svc = myColumns.Where(x => x.COLUMNNAME == colname).OrderByDescending(x => x.ID).FirstOrDefault(); } safeColName = HttpUtility.HtmlEncode(colname.Replace(' ', '_')); tr = new TableRow(); tr.TableSection = TableRowSection.TableBody; tr.Attributes.Add("data-colname", colname); td = new TableCell(); span = new HtmlGenericControl("SPAN"); span.InnerHtml = colname; td.Controls.Add(span); tr.Cells.Add(td); td = new TableCell(); td.Attributes.Add("data-fieldname", "DISPLAYNAME"); td.Attributes.Add("data-fieldvalue", (svc != null) ? svc.DISPLAYNAME : String.Empty); txt = new HtmlInputText(); txt.ID = "txtDisplayName_" + safeColName; txt.Attributes.Add("class", "form-inline input-sm form-control"); txt.Attributes.Add("placeholder", "Enter Display Name here..."); txt.Value = (svc != null) ? svc.DISPLAYNAME : String.Empty; td.Controls.Add(txt); //span = new HtmlGenericControl("SPAN"); //span.InnerHtml = (svc != null) ? svc.DISPLAYNAME : String.Empty; //td.Controls.Add(span); tr.Cells.Add(td); td = new TableCell(); td.Style.Add("text-align", "center"); td.Attributes.Add("data-fieldname", "HIDDEN"); td.Attributes.Add("data-fieldvalue", ((svc == null) || (!svc.HIDDEN)) ? "true" : "false"); cb = new HtmlInputCheckBox(); cb.ID = "cbHidden_" + safeColName; cb.Attributes.Add("class", "form-inline input-sm"); cb.Checked = ((svc == null) || (!svc.HIDDEN)); td.Controls.Add(cb); //span = new HtmlGenericControl("SPAN"); //span.InnerHtml = ((svc == null) || (!svc.HIDDEN)) ? "True" : "False"; //td.Controls.Add(span); tr.Cells.Add(td); this.gvFields.Rows.Add(tr); } #endregion #region Footer tfoot = new TableFooterRow(); tfoot.TableSection = TableRowSection.TableFooter; th = new TableHeaderCell(); th.Text = "Field Name"; tfoot.Cells.Add(th); th = new TableHeaderCell(); th.Text = "Display Name"; tfoot.Cells.Add(th); td = new TableCell(); tfoot.Cells.Add(td); this.gvFields.Rows.Add(tfoot); #endregion } catch (Exception e) { throw e; // don't throw error here } }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { /*=============================*/ try { string lec_code = Request.QueryString["lecturer"]; SysUser lec = new SysUser().getSysUser(lec_code); bool authorized = false; if (autro_obj.CheckGroupUser(login_data, group_var.lecturer)) { if (lec_code == login_data.Nation_ID) { authorized = true; } else { authorized = false; } } else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { authorized = true; } else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); foreach (string dep in department_authorized) { if (dep == lec.DepartmentCode) { authorized = true; break; } } } if (authorized == true) { string academic_year = Request.QueryString["year"]; string semester = Request.QueryString["semester"]; string prev_course = ""; int prev_sec = 0; int prev_subsec = 0; List <LecturerTableData> lecturerData = new List <LecturerTableData>(); lecturerData = new LecturerTable().getAllDegreeLecturerTable(academic_year, semester, lec_code); headLecturer.Text = new AcademicPosition().getAcademicPosition(lec.AcademicPositionCode).AcademicPositionThName + " " + lec.ThName + " " + lec.ThSurName; // Head Table string[] ar = { "ลำดับ", "ชื่อวิชา", "ตอนเรียน", "วัน", "เวลา", "ตัวคูณ", "หน่วยกิต", "ชั่วโมงอ้างอิง" }; Table tb1 = new Table(); tb1.Attributes.Add("class", "table table-bordered table-striped table-hover"); tb1.Attributes.Add("id", "dt_basic"); TableHeaderRow tRowHead = new TableHeaderRow(); tRowHead.TableSection = TableRowSection.TableHeader; for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++) { TableHeaderCell cellHead = new TableHeaderCell(); cellHead.Text = ar[cellCtr - 1]; cellHead.Attributes.Add("class", "text-center"); tRowHead.Cells.Add(cellHead); } tb1.Rows.Add(tRowHead); int num = 1; float totalCredit = 0; float totalHourRef = 0; SubCreditData subcredit = new SubCreditData(); TableCell cellDay = new TableCell(); TableCell cellTime = new TableCell(); foreach (LecturerTableData data in lecturerData) { //if ((prev_course == "") || (prev_course != data.Course_Code) || (prev_sec != data.Sec_No) || (prev_subsec != data.SubSec_No)) // { CourseData course_data = new CourseData(); course_data = new Course().getCourse(data.Course_Code); TableRow tRowBody = new TableRow(); tRowBody.TableSection = TableRowSection.TableBody; TableCell cellNum = new TableCell(); cellNum.Attributes.Add("class", "text-center"); cellNum.Attributes.Add("style", "vertical-align:middle"); cellNum.Text = num.ToString(); tRowBody.Cells.Add(cellNum); TableCell cellCourseName = new TableCell(); cellCourseName.Attributes.Add("style", "vertical-align:middle"); cellCourseName.Text = course_data.Course_Code + " " + course_data.Course_Engname; tRowBody.Cells.Add(cellCourseName); string course_type = ""; string course_sec = ""; if (data.Course_Type == "1") { course_type = "S."; } else if (data.Course_Type == "2") { course_type = "L."; } else if (data.Course_Type == "4") { course_type = "T."; } else if (data.Course_Type == "5") { course_type = "M."; } else if (data.Course_Type == "6") { course_type = "SP."; } else if (data.Course_Type == "7") { course_type = "D."; } if (data.SubSec_No != 0) { course_sec = data.SubSec_No.ToString(); } else { course_sec = data.Sec_No.ToString(); } TableCell cellSec = new TableCell(); cellSec.Attributes.Add("class", "text-center"); cellSec.Attributes.Add("style", "vertical-align:middle"); cellSec.Text = course_type + course_sec; tRowBody.Cells.Add(cellSec); string day = ""; if (data.Teaching_Day == "1") { day = "Mon"; } else if (data.Teaching_Day == "2") { day = "Tue"; } if (data.Teaching_Day == "3") { day = "Wed"; } if (data.Teaching_Day == "4") { day = "Thu"; } if (data.Teaching_Day == "5") { day = "Fri"; } if (data.Teaching_Day == "6") { day = "Sat"; } if (data.Teaching_Day == "7") { day = "Sun"; } cellDay = new TableCell(); cellDay.Attributes.Add("class", "text-center"); cellDay.Attributes.Add("style", "vertical-align:middle"); cellDay.Text = day; tRowBody.Cells.Add(cellDay); string teach_time = data.Teaching_Start_Time + " - " + data.Teaching_End_Time; cellTime = new TableCell(); cellTime.Attributes.Add("class", "text-center"); cellTime.Attributes.Add("style", "vertical-align:middle"); cellTime.Text = teach_time; tRowBody.Cells.Add(cellTime); subcredit = new SubCredit().getSubCredit(data.AcademicYear, data.Semester, data.Course_Code, data.Sec_No, data.SubSec_No, data.Lecturer, data.Teaching_Day, data.Teaching_Start_Time, data.Teaching_End_Time, data.Course_Degree_Char); float credit = subcredit.SubCredit; totalCredit += subcredit.SubCredit; HourReferData hour_data = new HourReferData(); float hour_ref = 0; if (course_data.Course_DegreeLevel == "01")// ปวช. { hour_data = new HourRefer().getHourRefer("U", data.Course_Type); hour_ref = hour_data.HourRefer * credit; } else if (course_data.Course_DegreeLevel == "02") //ป.ตรี { hour_data = new HourRefer().getHourRefer("B", data.Course_Type); hour_ref = hour_data.HourRefer * credit; } else { // บัณฑิต hour_data = new HourRefer().getHourRefer("M", data.Course_Type); hour_ref = hour_data.HourRefer * credit; } totalHourRef += hour_ref; TableCell cellMultiply = new TableCell(); cellMultiply.Attributes.Add("class", "text-center"); cellMultiply.Attributes.Add("style", "vertical-align:middle"); cellMultiply.Text = hour_data.HourRefer.ToString(); tRowBody.Cells.Add(cellMultiply); TableCell cellCredit = new TableCell(); cellCredit.Attributes.Add("class", "text-center"); cellCredit.Attributes.Add("style", "vertical-align:middle"); cellCredit.Text = credit.ToString(); tRowBody.Cells.Add(cellCredit); TableCell cellHourRef = new TableCell(); cellHourRef.Attributes.Add("class", "text-center"); cellHourRef.Attributes.Add("style", "vertical-align:middle"); cellHourRef.Text = hour_ref.ToString(); tRowBody.Cells.Add(cellHourRef); tb1.Rows.Add(tRowBody); num++; prev_course = data.Course_Code; prev_sec = data.Sec_No; prev_subsec = data.SubSec_No; } AddWorkLoadData AddWork_data = new AddWorkLoadData(); AddWork_data = new AddWorkLoad().getAddWorkLoad(academic_year, semester, lec_code); if (AddWork_data.Lecturer != null) { totalCredit += AddWork_data.TotalCredit; totalHourRef += AddWork_data.HourRefer; TableRow tRowBody1 = new TableRow(); tRowBody1.TableSection = TableRowSection.TableBody; TableCell cellAddNum = new TableCell(); cellAddNum.Attributes.Add("class", "text-center"); cellAddNum.Attributes.Add("style", "vertical-align:middle"); cellAddNum.Text = num.ToString(); tRowBody1.Cells.Add(cellAddNum); TableCell cellAddTitle = new TableCell(); cellAddTitle.Attributes.Add("class", "text-left"); cellAddTitle.Attributes.Add("style", "vertical-align:middle"); cellAddTitle.ColumnSpan = 5; cellAddTitle.Text = "ภาระงานต้นสังกัด"; tRowBody1.Cells.Add(cellAddTitle); TableCell cellAddCredit = new TableCell(); cellAddCredit.Attributes.Add("class", "text-center"); cellAddCredit.Attributes.Add("style", "vertical-align:middle"); cellAddCredit.Text = AddWork_data.TotalCredit.ToString(); tRowBody1.Cells.Add(cellAddCredit); TableCell cellAddHourRef = new TableCell(); cellAddHourRef.Attributes.Add("class", "text-center"); cellAddHourRef.Attributes.Add("style", "vertical-align:middle"); cellAddHourRef.Text = AddWork_data.HourRefer.ToString(); tRowBody1.Cells.Add(cellAddHourRef); tb1.Rows.Add(tRowBody1); } //==================== TableFooterRow footRow = new TableFooterRow(); footRow.TableSection = TableRowSection.TableFooter; TableCell cellSumTitle = new TableCell(); cellSumTitle.Attributes.Add("class", "text-right txt-blue-bold"); cellSumTitle.ColumnSpan = 6; cellSumTitle.Text = "รวม"; footRow.Cells.Add(cellSumTitle); TableCell cell1 = new TableCell(); cell1.Attributes.Add("class", "text-center txt-blue-bold"); cell1.Text = totalCredit.ToString(); footRow.Cells.Add(cell1); TableCell cell3 = new TableCell(); cell3.Attributes.Add("class", "text-center txt-blue-bold"); cell3.Text = totalHourRef.ToString(); footRow.Cells.Add(cell3); tb1.Rows.Add(footRow); TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Controls.Add(tb1); row.Cells.Add(cell); tblWorkLoad.Rows.Add(row); } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } catch (Exception err) { } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
public static Table HtmlTable(IDataReader rd, string title = null, int?maxrows = null) { var pctnames = new List <string> { "pct", "percent" }; var t = new Table(); t.Attributes.Add("class", "table table-striped"); if (title.HasValue()) { var c = new TableHeaderCell { ColumnSpan = rd.FieldCount, Text = title, }; c.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); var r = new TableHeaderRow { TableSection = TableRowSection.TableHeader }; r.Cells.Add(c); t.Rows.Add(r); } var h = new TableHeaderRow { TableSection = TableRowSection.TableHeader }; for (var i = 0; i < rd.FieldCount; i++) { var typ = rd.GetDataTypeName(i); var nam = rd.GetName(i).ToLower(); var align = HorizontalAlign.NotSet; switch (typ.ToLower()) { case "decimal": align = HorizontalAlign.Right; break; case "int": if (nam != "year" && !nam.EndsWith("id") && !nam.EndsWith("id2")) { align = HorizontalAlign.Right; } break; } if (!nam.Equal("linkfornext")) { h.Cells.Add(new TableHeaderCell { Text = rd.GetName(i), HorizontalAlign = align }); } } t.Rows.Add(h); var rn = 0; string linkfornext = null; while (rd.Read()) { rn++; if (maxrows.HasValue && rn > maxrows) { break; } var r = new TableRow(); for (var i = 0; i < rd.FieldCount; i++) { var typ = rd.GetDataTypeName(i); var nam = rd.GetName(i).ToLower(); if (nam == "linkfornext") { var x = rd.GetValue(i); if (x != DBNull.Value) { linkfornext = rd.GetString(i); } continue; } string s; var align = HorizontalAlign.NotSet; switch (typ.ToLower()) { case "decimal": var dec = rd[i].ToNullableDecimal(); s = StartsEndsWith(pctnames, nam) ? dec.ToString2("N1", "%") : dec.ToString2("c"); align = HorizontalAlign.Right; break; case "real": case "float": var dbl = rd[i].ToNullableDouble(); s = StartsEndsWith(pctnames, nam) ? dbl.ToString2("N1", "%") : dbl.ToString2("N1"); align = HorizontalAlign.Right; break; case "date": case "datetime": var dt = rd[i].ToNullableDate(); if (dt.HasValue && dt.Value.Date != dt.Value) { s = dt.FormatDateTime(); } else { s = dt.FormatDate(); } break; case "int": var ii = rd[i].ToNullableInt(); if (nam.Equal("peopleid") || nam.Equal("spouseid")) { s = $"<a href='/Person2/{ii}' target='Person'>{ii}</a>"; } else if (nam.Equal("organizationid") || nam.EndsWith("orgid")) { s = $"<a href='/Org/{ii}' target='Organization'>{ii}</a>"; } else if (nam.EndsWith("id") || nam.EndsWith("id2") || nam.Equal("Year")) { s = ii.ToString(); } else { s = ii.ToString2("N0"); align = HorizontalAlign.Right; } break; default: s = rd[i].ToString(); if (s == "Total") { s = $"<strong>{s}</strong>"; } if (nam.StartsWith("att") && nam.EndsWith("str")) { s = $"<span style='font-family: monospace'>{s}</span>"; align = HorizontalAlign.Right; } break; } if (linkfornext.HasValue()) { s = $"<a href='{linkfornext}' target='link'>{s}</a>"; linkfornext = null; } r.Cells.Add(new TableCell() { Text = s, HorizontalAlign = align, }); } t.Rows.Add(r); } var rowcount = $"Count = {rn} rows"; if (maxrows.HasValue && rn > maxrows) { rowcount = $"Displaying {maxrows} of {rn} rows"; } var tc = new TableCell() { ColumnSpan = rd.FieldCount, Text = rowcount, }; var tr = new TableFooterRow(); tr.Cells.Add(tc); t.Rows.Add(tr); return(t); }
private void AdicionarRodape() { TableFooterRow LinhaRodape = new TableFooterRow(); LinhaRodape.Font.Bold = true; LinhaRodape.BackColor = System.Drawing.Color.CadetBlue; LinhaRodape.ForeColor = System.Drawing.Color.White; TableCell ColunaRodapeArea = new TableCell(); ColunaRodapeArea.HorizontalAlign = HorizontalAlign.Center; ColunaRodapeArea.Text = "Totais"; LinhaRodape.Cells.Add(ColunaRodapeArea); TableCell ColunaRodapeTotalVendedores = new TableCell(); ColunaRodapeTotalVendedores.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeTotalVendedores.Text = RodapeTotalVendedores.ToString(); LinhaRodape.Cells.Add(ColunaRodapeTotalVendedores); TableCell ColunaRodapePresencas = new TableCell(); ColunaRodapePresencas.HorizontalAlign = HorizontalAlign.Right; ColunaRodapePresencas.Text = RodapeTotalPresencas.ToString(); LinhaRodape.Cells.Add(ColunaRodapePresencas); TableCell ColunaRodapeAusencias = new TableCell(); ColunaRodapeAusencias.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeAusencias.Text = RodapeTotalAusencias.ToString(); LinhaRodape.Cells.Add(ColunaRodapeAusencias); TableCell ColunaRodapeTaxas = new TableCell(); ColunaRodapeTaxas.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeTaxas.Text = RodapeTotalTaxas.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeTaxas); TableCell ColunaRodapeValorPago = new TableCell(); ColunaRodapeValorPago.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeValorPago.Text = RodapeTotalPagamentos.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeValorPago); TableCell ColunaRodapeValorDevido = new TableCell(); ColunaRodapeValorDevido.HorizontalAlign = HorizontalAlign.Right; ColunaRodapeValorDevido.Text = RodapeTotalDevido.ToString("#,###,##0.00"); LinhaRodape.Cells.Add(ColunaRodapeValorDevido); TableDados.Rows.Add(LinhaRodape); if (RodapeTotalPresencas > 0) { if (!RodapeTotalPresencas.ToString().Equals(TotalPresencasHidden.Value)) { TotalPresencasHidden.Value = RodapeTotalPresencas.ToString(); System.Media.SystemSounds.Asterisk.Play(); } } if (RodapeTotalPagamentos > 0) { if (!RodapeTotalPagamentos.ToString().Equals(TotalPagamentosHidden.Value)) { TotalPagamentosHidden.Value = RodapeTotalPagamentos.ToString(); System.Media.SystemSounds.Exclamation.Play(); } } }
public void LoadCartCookie() { int sum = 0; if (Request.Cookies["shoppingcart"] != null) { LoadHeader(); string lcookies = Request.Cookies["shoppingcart"].Value; string[] cookies = lcookies.Split('|'); foreach (string cookie in cookies) { string[] c = cookie.Split(','); TableCell id = new TableCell { Text = c[0] }; TableCell name = new TableCell { Text = c[1] }; TableCell quantity = new TableCell { Text = c[2] }; TableCell price = new TableCell { Text = c[3] }; TableCell totalprice = new TableCell { Text = (int.Parse(c[2]) * int.Parse(c[3])).ToString() }; TableRow row = new TableRow(); row.Cells.Add(id); row.Cells.Add(name); row.Cells.Add(quantity); row.Cells.Add(price); row.Cells.Add(totalprice); CartProducts.Rows.Add(row); sum += int.Parse(totalprice.Text); } TableCell info = new TableCell { Text = "Total Order Price:" }; info.ColumnSpan = 4; info.HorizontalAlign = HorizontalAlign.Right; TableCell bigprice = new TableCell { Text = sum.ToString() }; TableFooterRow bottom = new TableFooterRow(); bottom.Cells.Add(info); bottom.Cells.Add(bigprice); CartProducts.Rows.Add(bottom); HttpCookie total = new HttpCookie("carttotal") { Value = sum.ToString() }; Response.Cookies.Add(total); } else { TableCell status = new TableCell { Text = "Cart is empty" }; TableRow row = new TableRow(); row.Cells.Add(status); CartProducts.Rows.Add(row); EmptyCart.Visible = false; } }
/// <summary> /// saves changes into data base /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void save_btn_Click(object sender, EventArgs e) { //passed validation if (dataTableName.Equals("users")) { SqlCommand sqlCommand; sqlConnection.Open(); string sqlCmd = "UPDATE [Users] SET username = @newUsername, password = @newPassword, email = @newEmail, content_creator = @newContentCreator, content_consumer = @newContentConsumer, validated = @newValidated, RandomKey = @newRandomKey, user_color = @newUserColor, admin = @newAdmin Where Id = @oldId"; for (int i = 1; i < table.Controls.Count - 1; i++) {// goes through all rows that are not Header or Footer TableRow tr = (TableRow)table.Controls[i]; if (!((Image)tr.Controls[tr.Controls.Count - 1].Controls[1]).CssClass.Contains("not-changed")) {// row is changed sqlCommand = new SqlCommand(sqlCmd, sqlConnection); //cannot change id sqlCommand.Parameters.AddWithValue("@newUsername", ((TextBox)tr.Controls[1].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newPassword", ((TextBox)tr.Controls[2].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newEmail", ((TextBox)tr.Controls[3].Controls[0]).Text); if (((CheckBox)tr.Controls[4].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newContentCreator", "True"); } else { sqlCommand.Parameters.AddWithValue("@newContentCreator", "False"); } if (((CheckBox)tr.Controls[5].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newContentConsumer", "True"); } else { sqlCommand.Parameters.AddWithValue("@newContentConsumer", "False"); } if (((CheckBox)tr.Controls[6].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newValidated", "True"); } else { sqlCommand.Parameters.AddWithValue("@newValidated", "False"); } sqlCommand.Parameters.AddWithValue("@newRandomKey", ((TextBox)tr.Controls[7].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newUserColor", ((TextBox)tr.Controls[8].Controls[0]).Text); if (((CheckBox)tr.Controls[9].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newAdmin", "True"); } else { sqlCommand.Parameters.AddWithValue("@newAdmin", "False"); } sqlCommand.Parameters.AddWithValue("@oldId", ((TableCell)tr.Controls[0]).ToolTip); sqlCommand.ExecuteNonQuery(); } } TableFooterRow footerRow = (TableFooterRow)table.Controls[table.Controls.Count - 1]; if (((TextBox)footerRow.Controls[1].Controls[0]).Text.Length > 0 && InsertRowFull(footerRow, 1)) { string insertCommand = "INSERT INTO [Users] VALUES(@newUsername, @newPassword, @newEmail, @newContentCreator, @newContentConsumer, @newValidated, @newRandomKey, @newUserColor, @newAdmin)"; sqlCommand = new SqlCommand(insertCommand, sqlConnection); sqlCommand.Parameters.AddWithValue("@newUsername", ((TextBox)footerRow.Controls[1].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newPassword", ((TextBox)footerRow.Controls[2].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newEmail", ((TextBox)footerRow.Controls[3].Controls[0]).Text); if (((CheckBox)footerRow.Controls[4].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newContentCreator", "True"); } else { sqlCommand.Parameters.AddWithValue("@newContentCreator", "False"); } if (((CheckBox)footerRow.Controls[5].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newContentConsumer", "True"); } else { sqlCommand.Parameters.AddWithValue("@newContentConsumer", "False"); } if (((CheckBox)footerRow.Controls[6].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newValidated", "True"); } else { sqlCommand.Parameters.AddWithValue("@newValidated", "False"); } sqlCommand.Parameters.AddWithValue("@newRandomKey", ((TextBox)footerRow.Controls[7].Controls[0]).Text); sqlCommand.Parameters.AddWithValue("@newUserColor", ((TextBox)footerRow.Controls[8].Controls[0]).Text); if (((CheckBox)footerRow.Controls[9].Controls[0]).Checked) { sqlCommand.Parameters.AddWithValue("@newAdmin", "True"); } else { sqlCommand.Parameters.AddWithValue("@newAdmin", "False"); } sqlCommand.ExecuteNonQuery(); //Update WebService int id = 0; sqlCmd = "SELECT Id FROM [Users] WHERE username = @username;"; sqlCommand = new SqlCommand(sqlCmd, sqlConnection); sqlCommand.Parameters.AddWithValue("@username", ((TextBox)footerRow.Controls[1].Controls[0]).Text); SqlDataReader reader = sqlCommand.ExecuteReader(); if (reader.Read()) { id = reader.GetInt32(0); } maker_service.WebService ws = new maker_service.WebService(); ws.InsertUser(id); } sqlConnection.Close(); Response.Redirect(Request.Url.AbsoluteUri); } if (dataTableName.Equals("models")) { ws.OpenConnection(); string sqlCmd = "UPDATE [Models] SET User_Id = @newUser_Id, Creation_Date = @newCreation_Date, XML_File_Link = @newXML, name = @newName, description = @newDescription, Thumbnail = @newThumbnail Where Model_Id = @oldId"; for (int i = 1; i < table.Controls.Count - 1; i++) {// goes through all rows that are not Header or Footer TableRow tr = (TableRow)table.Controls[i]; if (!((Image)tr.Controls[tr.Controls.Count - 1].Controls[1]).CssClass.Contains("not-changed")) {// row is changed string[] parameterNames = { "@newUser_Id", "@newCreation_Date", "@newXML", "@newName", "@newDescription", "@newThumbnail", "@oldId" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)tr.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)tr.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)tr.Controls[3].Controls[0]).Text; parameterValues[3] = ((TextBox)tr.Controls[4].Controls[0]).Text; parameterValues[4] = ((TextBox)tr.Controls[5].Controls[0]).Text; parameterValues[5] = ((TextBox)tr.Controls[6].Controls[0]).Text; parameterValues[6] = ((TableCell)tr.Controls[0]).ToolTip; string[] parameterTypes = { "string", "datetime", "string", "string", "string", "string", "string" }; ws.GenericVoidQueryWithParameters(sqlCmd, parameterNames, parameterValues, parameterTypes); } } TableFooterRow footerRow = (TableFooterRow)table.Controls[table.Controls.Count - 1]; if (((TextBox)footerRow.Controls[1].Controls[0]).Text.Length > 0 && InsertRowFull(footerRow, 1)) { string[] parameterNames = { "@newUser_Id", "@newCreation_Date", "@newXML", "@newName", "@newDescription", "@newThumbnail", "@oldId" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)footerRow.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)footerRow.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)footerRow.Controls[3].Controls[0]).Text; parameterValues[3] = ((TextBox)footerRow.Controls[4].Controls[0]).Text; parameterValues[4] = ((TextBox)footerRow.Controls[5].Controls[0]).Text; parameterValues[5] = ((TextBox)footerRow.Controls[6].Controls[0]).Text; parameterValues[6] = ((TableCell)footerRow.Controls[0]).ToolTip; string[] parameterTypes = { "int", "datetime", "string", "string", "string", "string", "int" }; string insertCommand = "INSERT INTO [Models] VALUES(@newUser_Id, @newCreation_Date, @newXML, @newName, @newDescription, @newThumbnail);"; ws.GenericVoidQueryWithParameters(insertCommand, parameterNames, parameterValues, parameterTypes); } ws.CloseConnection(); Response.Redirect(Request.Url.AbsoluteUri); } if (dataTableName.Equals("downloads")) { ws.OpenConnection(); string sqlCmd = "UPDATE [Downloads] SET User_Id = @newUser_Id, Model_Id = @newModel_Id, Download_Date = @newDownload_Date WHERE Download_Id = @oldId"; for (int i = 1; i < table.Controls.Count - 1; i++) {// goes through all rows that are not Header or Footer TableRow tr = (TableRow)table.Controls[i]; if (!((Image)tr.Controls[tr.Controls.Count - 1].Controls[1]).CssClass.Contains("not-changed")) {// row is changed string[] parameterNames = { "@newUser_Id", "@newModel_Id", "@newDownload_Date", "@oldId" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)tr.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)tr.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)tr.Controls[3].Controls[0]).Text; parameterValues[3] = ((TableCell)tr.Controls[0]).ToolTip; string[] parameterTypes = { "int", "int", "datetime", "int" }; ws.GenericVoidQueryWithParameters(sqlCmd, parameterNames, parameterValues, parameterTypes); } } TableFooterRow footerRow = (TableFooterRow)table.Controls[table.Controls.Count - 1]; if (((TextBox)footerRow.Controls[1].Controls[0]).Text.Length > 0 && InsertRowFull(footerRow, 1)) { string[] parameterNames = { "@newUser_Id", "@newModel_Id", "@newDownload_Date" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)footerRow.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)footerRow.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)footerRow.Controls[3].Controls[0]).Text; string[] parameterTypes = { "int", "int", "datetime" }; string insertCommand = "INSERT INTO [Downloads] VALUES(@newUser_Id, @newModel_Id, @newDownload_Date);"; ws.GenericVoidQueryWithParameters(insertCommand, parameterNames, parameterValues, parameterTypes); } ws.CloseConnection(); Response.Redirect(Request.Url.AbsoluteUri); } if (dataTableName.Equals("ratings")) { ws.OpenConnection(); string sqlCmd = "UPDATE [Ratings] SET User_Id = @newUser_Id, Model_Id = @newModel_Id, Value = @newValue WHERE Rate_Id = @oldId"; for (int i = 1; i < table.Controls.Count - 1; i++) {// goes through all rows that are not Header or Footer TableRow tr = (TableRow)table.Controls[i]; if (!((Image)tr.Controls[tr.Controls.Count - 1].Controls[1]).CssClass.Contains("not-changed")) {// row is changed string[] parameterNames = { "@newUser_Id", "@newModel_Id", "@newValue", "@oldId" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)tr.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)tr.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)tr.Controls[3].Controls[0]).Text; parameterValues[3] = ((TableCell)tr.Controls[0]).ToolTip; string[] parameterTypes = { "int", "int", "int", "int" }; ws.GenericVoidQueryWithParameters(sqlCmd, parameterNames, parameterValues, parameterTypes); } } TableFooterRow footerRow = (TableFooterRow)table.Controls[table.Controls.Count - 1]; if (((TextBox)footerRow.Controls[1].Controls[0]).Text.Length > 0 && InsertRowFull(footerRow, 1)) { string[] parameterNames = { "@newUser_Id", "@newModel_Id", "@newValue" }; string[] parameterValues = new string[parameterNames.Length]; //cannot change id parameterValues[0] = ((TextBox)footerRow.Controls[1].Controls[0]).Text; parameterValues[1] = ((TextBox)footerRow.Controls[2].Controls[0]).Text; parameterValues[2] = ((TextBox)footerRow.Controls[3].Controls[0]).Text; string[] parameterTypes = { "int", "int", "int" }; string insertCommand = "INSERT INTO [Ratings] VALUES(@newUser_Id, @newModel_Id, @newValue);"; ws.GenericVoidQueryWithParameters(insertCommand, parameterNames, parameterValues, parameterTypes); } ws.CloseConnection(); Response.Redirect(Request.Url.AbsoluteUri); } }
private TableCell GetTable(bool IgnoreGeneration, RatePeriod[] ratePeriods, IEnumerable <SampleResponse> samples, String title, ref Decimal totalCost, Decimal generationRate, Decimal fuelSurcharge) { SampleResponse prevSample = samples.First(); Dictionary <Decimal, RatePeriodTotal> totalsByRatePeriod = ratePeriods.Select(x => x.rate + fuelSurcharge).Distinct().ToDictionary(x => x, x => new RatePeriodTotal()); foreach (var sample in samples) { var ratePeriod = ratePeriods.FirstOrDefault(x => x.days != null && x.days.Contains(prevSample.intervalTS.DayOfWeek) && x.months.Contains(prevSample.intervalTS.Month) && x.startHour <= prevSample.intervalTS.Hour && x.endHour >= prevSample.intervalTS.Hour); if (ratePeriod == null) { ratePeriod = ratePeriods.First(); } totalsByRatePeriod[ratePeriod.rate + fuelSurcharge].addValues(sample.consumption - prevSample.consumption, sample.generation - prevSample.generation); prevSample = sample; } TableRow tr; var table = new Table(); tr = new TableHeaderRow { HorizontalAlign = HorizontalAlign.Center }; tr.Cells.Add(new TableHeaderCell { Text = title }); table.Rows.Add(tr); var tbl = new Table { GridLines = GridLines.Both, CellPadding = 4 }; tr = new TableRow { HorizontalAlign = HorizontalAlign.Center, }; tr.Cells.Add(new TableHeaderCell { Text = "Rate<br />(Cost/Net Usage)" }); tr.Cells.Add(new TableHeaderCell { Text = "Consumption" }); if (!IgnoreGeneration) { tr.Cells.Add(new TableHeaderCell { Text = "Generation" }); tr.Cells.Add(new TableHeaderCell { Text = "Net Usage" }); tr.Cells.Add(new TableHeaderCell { Text = "Effective Rate<br />(Cost/Consumption)" }); } tr.Cells.Add(new TableHeaderCell { Text = "Cost" }); tbl.Rows.Add(tr); decimal totalConsumption = 0; decimal totalGeneration = 0; totalCost = 0; foreach (var result in totalsByRatePeriod.Where(x => (x.Value.Consumption + x.Value.Generation) > 0)) { var Generation = (IgnoreGeneration ? 0 : result.Value.Generation); totalConsumption += result.Value.Consumption; totalGeneration += Generation; var netConsumption = (result.Value.Consumption - Generation); var cost = netConsumption * (netConsumption < 0 ? generationRate : result.Key); totalCost += cost; if (ratePeriods.Count() > 1) { tr = new TableRow { HorizontalAlign = HorizontalAlign.Right }; tr.Cells.Add(new TableCell { Text = result.Key.ToString("$.00") }); tr.Cells.Add(new TableCell { Text = result.Value.Consumption.ToString("0.00") }); if (!IgnoreGeneration) { tr.Cells.Add(new TableCell { Text = Generation.ToString("0.00") }); tr.Cells.Add(new TableCell { Text = netConsumption.ToString("0.00") }); tr.Cells.Add(new TableCell { Text = (cost / (result.Value.Consumption)).ToString("$.000") }); } tr.Cells.Add(new TableCell { Text = cost.ToString("$0.00") }); tbl.Rows.Add(tr); } } var netUsage = totalConsumption - totalGeneration; tr = new TableFooterRow { HorizontalAlign = HorizontalAlign.Right, BackColor = Color.LightGray }; tr.Cells.Add(new TableCell { Text = ((totalCost / netUsage) >= 0 ? (totalCost / netUsage).ToString("$.000") : " --- ") }); tr.Cells.Add(new TableCell { Text = totalConsumption.ToString("0.00") }); if (!IgnoreGeneration) { tr.Cells.Add(new TableCell { Text = totalGeneration.ToString("0.00") }); tr.Cells.Add(new TableCell { Text = netUsage.ToString("0.00") }); tr.Cells.Add(new TableCell { Text = (totalCost / totalConsumption).ToString("$.000") }); } tr.Cells.Add(new TableCell { Text = (totalCost).ToString("$0.00") }); tbl.Rows.Add(tr); tr = new TableRow(); var tc = new TableCell(); tc.Controls.Add(tbl); tr.Cells.Add(tc); table.Rows.Add(tr); tc = new TableCell(); tc.Controls.Add(table); return(tc); }
protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"]); int locationId = Convert.ToInt32(Request.QueryString["location"]); if (Request.QueryString["id"] != null && Request.QueryString["location"] != null) { Entities.Register.SalesReturnRegister sq = new Entities.Register.SalesReturnRegister(); sq = Entities.Register.SalesReturnRegister.GetDetails(id, locationId); dynamic setting = Entities.Application.Settings.GetFeaturedSettings(); Entities.Master.Company c = new Entities.Master.Company(); c = Entities.Master.Company.GetDetailsByLocation(locationId); Entities.Application.User use = new Entities.Application.User(); dynamic obj = Entities.Application.User.GetUserDetails(CPublic.GetuserID()); lblUserName.Text = obj.UserName; lblDesignation.Text = obj.Designation; lblCompanyContact.Text = obj.Mobile; lblCompanyEmail.Text = obj.Email; imgLogo.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; imgLogo1.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; imgLogo2.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; imgLogo3.ImageUrl = "data:image/jpeg;base64, " + c.LogoBase64; //lblCustName.Text = sq.CustomerName; lblCompany.Text = sq.Company; lblCustemail.Text = sq.CustomerEmail; lblCustState.Text = sq.CustomerState + "," + sq.CustomerCountry; //lblCompanyContact.Text = c.MobileNo1; //lblCompanyEmail.Text = sq.CompanyEmail; lblDate.Text = sq.EntryDateString; //lblReference.Text = sq.CreditNoteNumber; //tAndC.Text = sq.TermsandConditon; //lblCustCompany.Text = sq.CustomerName; for (int i = 0; i < sq.Products.Count; i++) { TableRow r = new TableRow(); //TableCell t1 = new TableCell(); //t1.Text = (i + 1).ToString(); //r.Cells.Add(t1); TableCell t2 = new TableCell(); t2.Text = sq.Products[i].ItemCode; r.Cells.Add(t2); //TableCell t3 = new TableCell(); //t3.Text = sq.Products[i].Name; //r.Cells.Add(t3); if (setting.EnableDescription)//Enabled Description { TableCell t3 = new TableCell(); t3.Width = 500; string itemName = "<b>"; itemName += sq.Products[i].Name; itemName += "</b><br/>"; itemName += sq.Products[i].Description; t3.Text = itemName; r.Cells.Add(t3); } else { TableCell t3 = new TableCell(); t3.Text = sq.Products[i].Name; r.Cells.Add(t3); } TableCell t4 = new TableCell(); t4.Text = sq.Products[i].Quantity.ToString(); r.Cells.Add(t4); //TableCell t5 = new TableCell(); //t5.Text = sq.Products[i].MRP.ToString(); //r.Cells.Add(t5); TableCell t6 = new TableCell(); t6.Text = sq.Products[i].SellingPrice.ToString(); r.Cells.Add(t6); //TableCell t7 = new TableCell(); //t7.Text = sq.Products[i].TaxPercentage.ToString(); //r.Cells.Add(t7); //TableCell t8 = new TableCell(); //t8.Text = sq.Products[i].Gross.ToString(); //r.Cells.Add(t8); //TableCell t9 = new TableCell(); //t9.Text = sq.Products[i].TaxAmount.ToString(); //r.Cells.Add(t9); TableCell t10 = new TableCell(); t10.Text = sq.Products[i].NetAmount.ToString(); r.Cells.Add(t10); listTable.Rows.Add(r); } TableFooterRow tf = new TableFooterRow(); //TableCell tfc1 = new TableCell(); //tf.Cells.Add(tfc1); //TableCell tfc2 = new TableCell(); //tf.Cells.Add(tfc2); //TableCell tfc3 = new TableCell(); //tf.Cells.Add(tfc3); //TableCell tfc4 = new TableCell(); //tf.Cells.Add(tfc4); TableCell tfc5 = new TableCell(); tfc5.Text = "Total in " + setting.CurrencySymbol; tfc5.ColumnSpan = 4; tfc5.HorizontalAlign = HorizontalAlign.Right; tf.Cells.Add(tfc5); TableCell tfc6 = new TableCell(); tfc6.Text = Convert.ToString(sq.Gross); tfc6.HorizontalAlign = HorizontalAlign.Right; tf.Cells.Add(tfc6); listTable.Rows.Add(tf); TableFooterRow TaxAmountcell = new TableFooterRow(); TableCell tfc1 = new TableCell(); tfc1.Text = "VAT AMOUNT"; tfc1.ColumnSpan = 4; tfc1.HorizontalAlign = HorizontalAlign.Right; TaxAmountcell.Cells.Add(tfc1); TableCell tfc2 = new TableCell(); tfc2.Text = Convert.ToString(sq.TaxAmount); tfc2.HorizontalAlign = HorizontalAlign.Right; TaxAmountcell.Cells.Add(tfc2); listTable.Rows.Add(TaxAmountcell); TableFooterRow TotalCell = new TableFooterRow(); TableCell tfc3 = new TableCell(); tfc3.Text = "Grand Total in " + setting.CurrencySymbol; tfc3.ColumnSpan = 4; tfc3.HorizontalAlign = HorizontalAlign.Right; TotalCell.Cells.Add(tfc3); TableCell tfc4 = new TableCell(); tfc4.Text = Convert.ToString(sq.NetAmount); tfc4.HorizontalAlign = HorizontalAlign.Right; TotalCell.Cells.Add(tfc4); listTable.Rows.Add(TotalCell); } } catch (Exception ex) { Entities.Application.Helper.LogException(ex, "Quote | Page_Load(object sender, EventArgs e)"); Response.Write("<script> alert('" + ex.Message + "') </script>"); } }
public override string GetDesignTimeHtml() { const string sampleData = "abc"; const int columnCount = 3; const int rowCount = 5; GridView grid = (GridView)base.Component; GridViewColumnCollection columns = grid.Columns; bool clearColumns = false; int i; if (columns.Count == 0) { clearColumns = true; for (i = 1; i <= columnCount; i++) { GridViewBaseColumn column = new GridViewBoundColumn(); column.HeaderText = string.Format(CultureInfo.CurrentCulture, "Column {0}", i); columns.Add(column); } } Table table = new Table(); table.ApplyStyle(grid.ControlStyle); if (grid.ShowHeader) { TableHeaderRow trHeader = new TableHeaderRow(); table.Rows.Add(trHeader); trHeader.ApplyStyle(grid.HeaderStyle); TableHeaderCell th; for (i = 0; i < columns.Count; i++) { th = new TableHeaderCell(); trHeader.Cells.Add(th); columns[i].RenderHeader(th); } } bool isAlt = false; Style style; TableRow tr; TableCell td; for (i = 1; i <= rowCount; i++) { style = grid.RowStyle; if ((isAlt) && (!grid.AlternatingRowStyle.IsEmpty)) { style = grid.AlternatingRowStyle; } isAlt = !isAlt; tr = new TableRow(); table.Rows.Add(tr); tr.ApplyStyle(style); for (int j = 0; j < columns.Count; j++) { td = new TableCell(); tr.Cells.Add(td); columns[j].RenderData(td, sampleData); } } if (grid.ShowFooter) { TableFooterRow trFooter = new TableFooterRow(); table.Rows.Add(trFooter); trFooter.ApplyStyle(grid.FooterStyle); TableCell tdFooter; for (i = 0; i < columns.Count; i++) { tdFooter = new TableHeaderCell(); trFooter.Cells.Add(tdFooter); columns[i].RenderFooter(tdFooter); } } if (clearColumns) { grid.Columns.Clear(); } StringBuilder output = new StringBuilder(); StringWriter sw = new StringWriter(output, CultureInfo.CurrentCulture); HtmlTextWriter htw = new HtmlTextWriter(sw); table.RenderControl(htw); htw.Close(); return(output.ToString()); }
public Table[] vratiTabelaProizvodi(OracleDataReader drO) { int i = 1; int j = 0; int pat = 1; Table[] nova = new Table[100]; TableHeaderCell head; TableCell cel; TableRow row = new TableRow(); TableFooterRow foot; nova[j] = new Table(); while (drO.Read()) { if (pat == 1) { //nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Тип_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Данок_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Колинчина"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Потврди"; row.Controls.Add(head); nova[j].Controls.Add(row); pat = 2; } if (i > 10) { i = 1; j++; row = new TableRow(); nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Тип_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Колинчина"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Потврди"; row.Controls.Add(head); nova[j].Controls.Add(row); } row = new TableRow(); cel = new TableCell(); cel.Text = i.ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDP"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDT"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDD"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Име"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Група"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Данок"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Цена"].ToString(); row.Controls.Add(cel); cel = new TableCell(); TextBox kolicinaTextBox = new TextBox(); kolicinaTextBox.Text = "0"; kolicinaTextBox.Width = Unit.Pixel(70); kolicinaTextBox.Style.Add("text-align", "right"); kolicinaTextBox.Attributes.Add("onfocus", "proveriVlez(this)"); kolicinaTextBox.Attributes.Add("onblur", "proveriIzlez(this)"); kolicinaTextBox.ID = "kolicinaTextBox" + i.ToString(); cel.Controls.Add(kolicinaTextBox); row.Controls.Add(cel); cel = new TableCell(); Button insertBtn = new Button(); insertBtn.Text = "Додади"; insertBtn.ID = "dodadiBtn." + j.ToString() + "." + i.ToString(); insertBtn.Click += insertKopce; cel.Controls.Add(insertBtn); row.Controls.Add(cel); nova[j].Controls.Add(row); i++; } Table[] kraj = new Table[j + 1]; if (nova[0].Rows.Count > 0) { for (int w = 0; w <= j; w++) { foot = new TableFooterRow(); cel = new TableCell(); cel.ColumnSpan = 5; for (int q = 1; q <= j + 1; q++) { Button kopce = new Button(); kopce.ID = q.ToString(); kopce.Click += new EventHandler(kopce_Click); kopce.Text = q.ToString(); cel.Controls.Add(kopce); } foot.Controls.Add(cel); if (nova[w] != null) nova[w].Rows.Add(foot); kraj[w] = nova[w]; } } else { foot = new TableFooterRow(); cel = new TableCell(); cel.Text = " Нема такви податоци во производи "; cel.BorderColor = System.Drawing.Color.White; cel.BorderWidth = Unit.Pixel(2); cel.BorderStyle = BorderStyle.Solid; foot.Controls.Add(cel); nova[0].Rows.Add(foot); kraj[0] = nova[0]; } return kraj; }
public Table[] vratiTabelaNarackiKorisnik(OracleDataReader drO) { int i = 1; int j = 0; int pat = 1; Table[] nova = new Table[100]; TableHeaderCell head; TableCell cel; TableRow row = new TableRow(); TableFooterRow foot; nova[j] = new Table(); while (drO.Read()) { if (pat == 1) { //nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Комитент_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Маркет"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Адреса"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Град"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Датум"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Вкупно"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Платено"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Затворена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Измени"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Прикажи"; row.Controls.Add(head); nova[j].Controls.Add(row); pat = 2; } if (i > 10) { i = 1; j++; row = new TableRow(); nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Комитент_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Маркет"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Адреса"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Град"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Датум"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Вкупно"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Платена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Затворена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Измени"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Прегледај"; row.Controls.Add(head); nova[j].Controls.Add(row); } row = new TableRow(); cel = new TableCell(); cel.Text = i.ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDP"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDK"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["МАРКЕТ"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["АДРЕСА"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ГРАД"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ДАТУМ"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ВКУПНО"].ToString() +",00ден"; cel.Attributes.Add("class", "textCellLevo"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ПЛАТЕНА"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ЗАТВОРЕНА"].ToString().Trim(); row.Controls.Add(cel); cel = new TableCell(); if (drO["ЗАТВОРЕНА"].ToString().Trim() !="D") { Button izmeniBtn = new Button(); izmeniBtn.Text = "Измени"; izmeniBtn.ID = "izmeniBtn." + j.ToString() + "." + i.ToString(); izmeniBtn.Click += new EventHandler(izmeniBtn_Click); cel.Controls.Add(izmeniBtn); } row.Controls.Add(cel); cel = new TableCell(); Button izvestajBtn = new Button(); izvestajBtn.Text = "Прикажи"; izvestajBtn.ID = "izvestajBtn." + j.ToString() + "." + i.ToString(); izvestajBtn.Click += new EventHandler(izvestajBtn_Click); cel.Controls.Add(izvestajBtn); row.Controls.Add(cel); nova[j].Controls.Add(row); i++; } Table[] kraj = new Table[j + 1]; //for (int w = 0; w <= j; w++) //{ // foot = new TableFooterRow(); // cel = new TableCell(); // cel.ColumnSpan = 5; // for (int q = 1; q <= j + 1; q++) // { // Button kopce = new Button(); // kopce.ID =q.ToString(); // kopce.Click += new EventHandler(kopceListaNaracki_Click); // kopce.Text = q.ToString(); // cel.Controls.Add(kopce); // } // foot.Controls.Add(cel); // if (nova[w] != null) // nova[w].Rows.Add(foot); // kraj[w] = nova[w]; //} if (nova[0].Rows.Count > 0) { for (int w = 0; w <= j; w++) { foot = new TableFooterRow(); cel = new TableCell(); cel.ColumnSpan = 5; for (int q = 1; q <= j + 1; q++) { Button kopce = new Button(); kopce.ID =q.ToString(); kopce.Click += new EventHandler(kopceListaNaracki_Click); kopce.Text = q.ToString(); cel.Controls.Add(kopce); } foot.Controls.Add(cel); if (nova[w] != null) nova[w].Rows.Add(foot); kraj[w] = nova[w]; } } else { foot = new TableFooterRow(); cel = new TableCell(); cel.Text = " Нема податоци - нарачки "; cel.BorderColor = System.Drawing.Color.White; cel.BorderWidth = Unit.Pixel(2); cel.BorderStyle = BorderStyle.Solid; foot.Controls.Add(cel); nova[0].Rows.Add(foot); kraj[0] = nova[0]; } return kraj; }
protected void Page_Load(object sender, EventArgs e) { if ((Session["inp"] == null) && (Session["statsViewer"] == null)) { Response.Redirect("inputLogin.aspx"); } if (Request.QueryString["jid"] == null) { Response.Redirect("assembly.aspx"); } jid.Text = Request.QueryString["jid"].ToString(); mid.Text = Request.QueryString["mid"].ToString(); //tbl.Attributes["class"] = "ht"; DataView dvjob = (DataView)(sdcjob.Select(DataSourceSelectArguments.Empty)); DataView dvcod = (DataView)(sdccod.Select(DataSourceSelectArguments.Empty)); dvcod.Sort = "Id"; DataView dvph = (DataView)(sdcph.Select(DataSourceSelectArguments.Empty)); dvph.Sort = "phaseORDER"; DateTime mindate, maxdate; DataView dvfin = (DataView)(sdsnewfin.Select(DataSourceSelectArguments.Empty)); DataView dvplan = (DataView)(sdsplan.Select(DataSourceSelectArguments.Empty)); List <DateTime> plancollection = new List <DateTime>(); List <DateTime> fincollection = new List <DateTime>(); for (int i = 0; i < dvfin.Table.Rows.Count; i++) { DateTime ee = Convert.ToDateTime(dvfin.Table.Rows[i]["date"]); if (!fincollection.Contains(ee)) { fincollection.Add(ee); } } for (int i = 0; i < dvplan.Table.Rows.Count; i++) { string[] dates = dvplan.Table.Rows[i]["date"].ToString().Split(','); if (dvplan.Table.Rows[i]["date"].ToString() != "") { foreach (string item in dates) { DateTime ee = Convert.ToDateTime(item); if (!plancollection.Contains(ee)) { plancollection.Add(ee); } } } } plancollection.Sort(); fincollection.Sort(); if (dvfin.Table.Rows.Count == 0) { mindate = plancollection[0]; maxdate = plancollection[plancollection.Count - 1]; } else { mindate = (plancollection[0] < fincollection[0]) ?plancollection[0]:fincollection[0]; maxdate = (plancollection[plancollection.Count - 1] > fincollection[fincollection.Count - 1]) ?plancollection[plancollection.Count - 1]:fincollection[fincollection.Count - 1]; } double t_hours = 0; for (int i = 0; i < dvplan.Table.Rows.Count; i++) { string[] thisdates = dvplan.Table.Rows[i]["date"].ToString().Split(','); List <DateTime> dt = new List <DateTime>(); if (dvplan.Table.Rows[i]["date"].ToString() != "") { foreach (string str in thisdates) { dt.Add(Convert.ToDateTime(str)); } } xx.Value = dvplan.Table.Rows[i]["phase"].ToString(); DataView dvfinthisphase = (DataView)(thisphasefinished.Select(DataSourceSelectArguments.Empty)); List <DateTime> dt2 = new List <DateTime>(); for (int j = 0; j < dvfinthisphase.Table.Rows.Count; j++) { dt2.Add(Convert.ToDateTime(dvfinthisphase.Table.Rows[j]["date"])); } dvfinthisphase.Sort = "date"; TableRow tr = new TableRow(); progresstable.Rows.Add(tr); TableCell tc1 = new TableCell(); tr.Cells.Add(tc1); tc1.Text = dvplan.Table.Rows[i]["phase"].ToString(); TableCell tc2 = new TableCell(); tr.Cells.Add(tc2); tc2.Text = dvph.Table.Rows[dvph.Find(dvplan.Table.Rows[i]["phase"])]["phaseNAME"].ToString(); TableCell tc3 = new TableCell(); tr.Cells.Add(tc3); tc3.Text = dvph.Table.Rows[dvph.Find(dvplan.Table.Rows[i]["phase"])]["phaseDURATION"].ToString(); TableCell tc4 = new TableCell(); tr.Cells.Add(tc4); double hours = 0; for (DateTime j = mindate; j <= maxdate; j = j.AddDays(1)) { TableCell cxx = new TableCell(); tr.Cells.Add(cxx); if (dt.Contains(j)) { cxx.BorderWidth = 4; } if (dt2.Contains(j)) { int p = dvfinthisphase.Find(j.ToShortDateString()); if (p >= 0) { int sta = Convert.ToInt32(dvfinthisphase.Table.Rows[p]["status"].ToString()); switch (sta) { case 0: cxx.BackColor = System.Drawing.Color.Red; break; case 1: cxx.BackColor = System.Drawing.Color.Green; break; case 2: cxx.BackColor = System.Drawing.Color.Orange; break; case 3: cxx.BackColor = System.Drawing.Color.Yellow; break; } hours += Convert.ToDouble(dvfinthisphase.Table.Rows[p]["hours"].ToString()); cxx.Text = dvfinthisphase.Table.Rows[p]["hours"].ToString(); cxx.ToolTip = dvcod.Table.Rows[dvcod.Find(dvfinthisphase.Table.Rows[p]["comment"])]["cod"].ToString(); } } } tc4.Text = hours.ToString(); t_hours += hours; } TableFooterRow tfr = new TableFooterRow(); progresstable.Rows.Add(tfr); TableHeaderCell f1 = new TableHeaderCell(); TableHeaderCell f2 = new TableHeaderCell(); TableHeaderCell f3 = new TableHeaderCell(); TableHeaderCell f4 = new TableHeaderCell(); tfr.Cells.Add(f1); tfr.Cells.Add(f2); tfr.Cells.Add(f3); tfr.Cells.Add(f4); f1.Text = "ORDER"; f2.Text = "OPERATION"; f3.Text = "ACT DURATION (HRS)"; f4.Text = "TOTAL MACHINE HOURS (" + t_hours.ToString() + ")"; for (DateTime i = mindate; i <= maxdate; i = i.AddDays(1)) { TableHeaderCell cx = new TableHeaderCell(); tfr.Cells.Add(cx); cx.Text = i.ToShortDateString(); //cx.Attributes["class"] = "vertical"; } foreach (TableRow tr in progresstable.Rows) { foreach (TableCell tc in tr.Cells) { tc.Attributes.CssStyle.Add("text-align", "center"); } } }
/// <summary> /// create responsive table for each table by looking at the url /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { dataTableName = GetDataTableName(Request.Url.AbsoluteUri); if (dataTableName.Equals("users")) { table.CssClass = "table users-table Report1942Font"; sqlConnection = new SqlConnection(resources.ResourceManager.GetString("Connection_String")); sqlConnection.Open(); string sqlCmd = "SELECT * FROM [Users]"; SqlCommand sqlCommand = new SqlCommand(sqlCmd, sqlConnection); SqlDataReader reader = sqlCommand.ExecuteReader(); string[] titles = { "ID", "Username", "Password", "Email", "Content Creator", "Content Consumer", "Validated", "RandomKey", "User Color", "Admin" }; GenerateHeaderRow(titles); TableFooterRow footer_row = new TableFooterRow(); int i = 0; int counter = 0; if (reader.Read()) { footer_row = GenerateFooterRow(reader, ref counter); } do { table.Controls.Add(GenerateTableRow(reader, i, ref counter)); i++; } while (reader.Read()); reader.Close(); sqlConnection.Close(); title.InnerHtml = "USERS"; table.Controls.Add(footer_row); } if (dataTableName.Equals("models")) { table.CssClass = "table models-table Report1942Font"; ws = new maker_service.WebService(); string[] titles = { "Model ID", "User ID", "Date", "Data Path", "Name", "Description", "Thumbnail" }; GenerateHeaderRow(titles); ws.OpenConnection(); DataSet dataset = ws.GenericReaderQuery("SELECT * FROM [Models]"); TableFooterRow footer_row = new TableFooterRow(); int i = 0; int counter = 0; DataTableReader reader = dataset.Tables[0].CreateDataReader(); if (reader.Read()) { footer_row = GenerateFooterRow(reader, ref counter); } do { table.Controls.Add(GenerateTableRow(reader, i, ref counter)); i++; } while (reader.Read()); reader.Close(); ws.CloseConnection(); title.InnerHtml = "MODELS"; table.Controls.Add(footer_row); } if (dataTableName.Equals("downloads")) { table.CssClass = "table models-table Report1942Font"; ws = new maker_service.WebService(); string[] titles = { "Download ID", "User ID", "Model ID", "Download Date" }; GenerateHeaderRow(titles); ws.OpenConnection(); DataSet dataset = ws.GenericReaderQuery("SELECT * FROM [Downloads]"); TableFooterRow footer_row = new TableFooterRow(); int i = 0; int counter = 0; DataTableReader reader = dataset.Tables[0].CreateDataReader(); if (reader.Read()) { footer_row = GenerateFooterRow(reader, ref counter); } do { table.Controls.Add(GenerateTableRow(reader, i, ref counter)); i++; } while (reader.Read()); reader.Close(); ws.CloseConnection(); title.InnerHtml = "Downloads"; table.Controls.Add(footer_row); } if (dataTableName.Equals("ratings")) { table.CssClass = "table models-table Report1942Font"; ws = new maker_service.WebService(); string[] titles = { "Rate ID", "User ID", "Model ID", "Value" }; GenerateHeaderRow(titles); ws.OpenConnection(); DataSet dataset = ws.GenericReaderQuery("SELECT * FROM [Ratings]"); TableFooterRow footer_row = new TableFooterRow(); int i = 0; int counter = 0; DataTableReader reader = dataset.Tables[0].CreateDataReader(); if (reader.Read()) { footer_row = GenerateFooterRow(reader, ref counter); } do { table.Controls.Add(GenerateTableRow(reader, i, ref counter)); i++; } while (reader.Read()); reader.Close(); ws.CloseConnection(); title.InnerHtml = "Ratings"; table.Controls.Add(footer_row); } }
public Table[] vratiTabelaProizvodiPopust(OracleDataReader drO) { int i = 1; int j = 0; int pat = 1; Table[] nova = new Table[100]; TableHeaderCell head; TableCell cel; TableRow row = new TableRow(); TableFooterRow foot; nova[j] = new Table(); while (drO.Read()) { if (pat == 1) { //nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Тип_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Данок_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "ЦенаНаб"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Попуст"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); nova[j].Controls.Add(row); pat = 2; } if (i > 10) { i = 1; j++; row = new TableRow(); nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Тип_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "ЦенаНаб"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Попуст"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); nova[j].Controls.Add(row); } row = new TableRow(); cel = new TableCell(); cel.Text = i.ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDP"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDT"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDD"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Име"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Група"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Данок"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["ЦенаНаб"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Попуст"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Цена"].ToString(); row.Controls.Add(cel); nova[j].Controls.Add(row); i++; } Table[] kraj = new Table[j + 1]; if (nova[0].Rows.Count > 0) { for (int w = 0; w <= j; w++) { foot = new TableFooterRow(); cel = new TableCell(); cel.ColumnSpan = 5; for (int q = 1; q <= j + 1; q++) { Button kopce = new Button(); kopce.ID = q.ToString(); kopce.Click += new EventHandler(kopce_Click); kopce.Text = q.ToString(); cel.Controls.Add(kopce); } foot.Controls.Add(cel); if (nova[w] != null) nova[w].Rows.Add(foot); kraj[w] = nova[w]; } } else { foot = new TableFooterRow(); cel = new TableCell(); cel.Text = " Нема податоци"; cel.BorderColor = System.Drawing.Color.White; cel.BorderWidth = Unit.Pixel(2); cel.BorderStyle = BorderStyle.Solid; foot.Controls.Add(cel); nova[0].Rows.Add(foot); kraj[0] = nova[0]; } return kraj; }
protected override void DoBindDataIntoContainer(IPDFContainerComponent container, int containerposition, PDFDataContext context) { IPDFDataSource origSource = context.DataStack.Source; object origData = context.DataStack.Pop(); object parentData = null; if (context.DataStack.HasData) { parentData = context.DataStack.Current; } Style applied = this.GetAppliedStyle(); applied = applied.Flatten(); IEnumerator enumerator = this.GetDataEnumerator(origData); if (this.AutoBindContent != DataAutoBindContent.None) { this.AddAutoBindColumns(context); } TableGrid grid = new TableGrid(); container.Content.Add(grid); if (this.HasStyle && this.Style.HasValues) { this.Style.MergeInto(grid.Style, Style.DirectStylePriority); } if (!string.IsNullOrEmpty(this.StyleClass)) { grid.StyleClass = this.StyleClass; } if (this.HasOutline) { grid.Outline = this.Outline; } this.ApplyCellStyles(); int colindex = 0; int rowindex = -1; this._bindingActions = new List <BindingActionList>(); if (this.ShouldBuildHeader()) { TableHeaderRow header = new TableHeaderRow(); grid.Rows.Add(header); BindingActionList headBind = new BindingActionList(); this.BindingActions.Add(headBind); //Add the columns foreach (DataGridColumn column in this.Columns) { if (column.Visible == false) { continue; } Component comp = column.DoBuildHeaderCell(grid, header, rowindex, colindex, context); if (null != comp && null != parentData) { headBind.Add(new BindingAction(parentData, origSource, comp)); } colindex++; } rowindex++; } while (enumerator.MoveNext()) { colindex = 0; TableRow row = new TableRow(); grid.Rows.Add(row); BindingActionList rowBind = new BindingActionList(); this.BindingActions.Add(rowBind); foreach (DataGridColumn column in this.Columns) { if (column.Visible == false) { continue; } Component comp = column.DoBuildItemCell(grid, row, rowindex, colindex, context); if (null != comp) { rowBind.Add(new BindingAction(enumerator.Current, origSource, comp)); } colindex++; } rowindex++; } colindex = 0; if (this.ShouldBuildFooter()) { TableFooterRow footer = new TableFooterRow(); grid.Rows.Add(footer); BindingActionList footBind = new BindingActionList(); this.BindingActions.Add(footBind); foreach (DataGridColumn column in this.Columns) { if (column.Visible == false) { continue; } Component comp = column.DoBuildFooterCell(grid, footer, rowindex, colindex, context); if (null != comp && null != parentData) { footBind.Add(new BindingAction(parentData, origSource, comp)); } colindex++; } } context.DataStack.Push(origData, origSource); this.InitAndLoadRoot(grid, context); this.BindActionedComponents(this.BindingActions, context); bool allhidden = RemoveHiddenColumns(context); if (allhidden || grid.Rows.Count == 0) { grid.Visible = false; this.ShowEmptyTemplate(container, containerposition, context); } this.RemoveHeadersAndFooters(grid, context); _built = grid; }
public Table[] vratiTabelaNaracka(OracleDataReader drO) { int i = 1; int j = 0; int pat = 1; int vkupno = 0; Table[] nova = new Table[100]; TableHeaderCell head; TableCell cel; TableRow row = new TableRow(); TableFooterRow foot; nova[j] = new Table(); while (drO.Read()) { if (pat == 1) { //nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Тип_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Attributes.Add("class", "hide"); head.Text = "Данок_ID"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Колинчина"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Потврди"; row.Controls.Add(head); nova[j].Controls.Add(row); pat = 2; } if (i > 10) { i = 1; j++; row = new TableRow(); nova[j] = new Table(); head = new TableHeaderCell(); head.Text = "Бр"; head.Attributes.Add("class", "hide"); head = new TableHeaderCell(); head.Text = "Производ_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Тип_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок_ID"; head.Attributes.Add("class", "hide"); row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Име"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Група"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Данок"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Цена"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Колинчина"; row.Controls.Add(head); head = new TableHeaderCell(); head.Text = "Потврди"; row.Controls.Add(head); nova[j].Controls.Add(row); } row = new TableRow(); cel = new TableCell(); cel.Text = i.ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDP"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDT"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["IDD"].ToString(); cel.Attributes.Add("class", "hide"); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Име"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Група"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Данок"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Цена"].ToString(); row.Controls.Add(cel); cel = new TableCell(); cel.Text = drO["Количина"].ToString(); row.Controls.Add(cel); vkupno += Convert.ToInt32(drO["Количина"].ToString()) * Convert.ToInt32(drO["Цена"].ToString()); cel = new TableCell(); Button brisiBtn = new Button(); brisiBtn.Text = "Избриши"; brisiBtn.ID = "izbrisiBtn." + j.ToString() + "." + i.ToString(); // brisiBtn.Click += new EventHandler(brisiBtn_Click); brisiBtn.Click += delKopce; cel.Controls.Add(brisiBtn); row.Controls.Add(cel); nova[j].Controls.Add(row); i++; } Table[] kraj = new Table[j + 1]; if (nova[0].Rows.Count > 0) { for (int w = 0; w <= j; w++) { row = new TableRow(); cel = new TableCell(); cel.Text = "Вкупно-Нарачка:" + vkupno.ToString() + ".00 ден"; cel.Attributes.Add("class", "textCellLevo textVkupno"); row.Controls.Add(cel); nova[w].Controls.Add(row); foot = new TableFooterRow(); cel = new TableCell(); cel.ColumnSpan = 5; for (int q = 1; q <= j + 1; q++) { Button kopce = new Button(); kopce.ID = "." + q.ToString(); kopce.Click += new EventHandler(kopceLista_Click); kopce.Text = q.ToString(); cel.Controls.Add(kopce); } foot.Controls.Add(cel); if (nova[w] != null) nova[w].Rows.Add(foot); kraj[w] = nova[w]; } } else { foot = new TableFooterRow(); cel = new TableCell(); cel.Text = " Нарачката е празна "; cel.BorderColor = System.Drawing.Color.White; cel.BorderWidth = Unit.Pixel(2); cel.BorderStyle = BorderStyle.Solid; foot.Controls.Add(cel); nova[0].Rows.Add(foot); kraj[0] = nova[0]; } return kraj; }
protected void createInsertForm() { /* * Creates asp:Table dynamically. This is done because different tables have different fields and thus require different forms. * * Each row in the form corresponds to a different field in the table * * Header Row: <h3> tag containing "Data Entry" * Body Row: contains 4 cells * Label Cell (Label), Input Cell (TextBox), Required Field Validator Cell (RequiredFieldValidator), Regex Validator Cell (Regular ExpressionValidator) * * Label Cell: ID format is lbl_<tableName>_<fieldName> * Input Cell: ID format is txt_<tableName>_<fieldName> * Required Field Cell: ID format is validate_<tableName>_<fieldName> * Regex Validator Cell: ID format is validateType_<tableName>_<fieldName> * * Footer Row: contains Submit button * * */ // add body Dictionary <string, Dictionary <string, string> > data = db.getTableMetadata(this.selectedTable); List <string> colNames = db.getEditableInsertableColumnNames(null, null, data); List <string> formattedColNames = db.getFormattedColNames(colNames); if (colNames != null) { for (int i = 0; i < colNames.Count; i += 1) { string colName = colNames[i]; TableRow tr = new TableRow(); tr.Width = new Unit("100%"); tr.Height = new Unit("70%"); TableCell labelCell = new TableCell(); labelCell.Style.Add("width", "25%"); // create label Label label = new Label(); label.ID = $"lbl_{this.selectedTable}_{colName}"; label.Text = $"Enter {formattedColNames[i]}: "; // add label to label cell labelCell.Controls.Add(label); // create textbox TableCell inputCell = new TableCell(); inputCell.Style.Add("width", "70%"); TextBox txt = new TextBox(); txt.ID = $"txt_{this.selectedTable}_{colName}"; if (colName.Equals("description")) { txt.TextMode = TextBoxMode.MultiLine; } txt.Text = string.Empty; txt.Style.Add("width", "100%"); // add textbox to input cell inputCell.Controls.Add(txt); // add label and textbox to row tr.Cells.Add(labelCell); tr.Cells.Add(inputCell); // create validator Dictionary <string, string> props = data[colName]; // add required validator for fields that cannot be null TableCell reqFieldValidateCell = new TableCell(); string isRequired = props["isRequired"]; if (isRequired.Equals("Y")) { RequiredFieldValidator validator = new RequiredFieldValidator(); validator.ID = $"validate_{this.selectedTable}_{colName}"; validator.ControlToValidate = txt.ID; validator.Display = ValidatorDisplay.Dynamic; validator.ErrorMessage = "Required Field"; validator.ForeColor = System.Drawing.Color.Red; // add validator to input cell reqFieldValidateCell.Controls.Add(validator); // add validator to row tr.Cells.Add(reqFieldValidateCell); } // add type validator TableCell typeValidateCell = new TableCell(); string type = db.mapDbTypeToInputType(props["dataType"], colName); RegularExpressionValidator typeValidator = new RegularExpressionValidator(); typeValidator.ID = $"validateType_{this.selectedTable}_{colName}"; typeValidator.ControlToValidate = txt.ID; typeValidator.Display = ValidatorDisplay.Dynamic; typeValidator.ErrorMessage = $"Wrong type: expected {type}"; typeValidator.ForeColor = System.Drawing.Color.Red; switch (type) { case "int": typeValidator.ValidationExpression = "^\\d+$"; break; case "float": typeValidator.ValidationExpression = "[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)"; break; case "email": typeValidator.ValidationExpression = ".+"; break; case "phoneNumber": typeValidator.ValidationExpression = "^\\d{3}-\\d{4}$"; break; case "date": typeValidator.ValidationExpression = "((0?[13578]|10|12)(-|\\/)((0[0-9])|([12])([0-9]?)|(3[01]?))(-|\\/)((\\d{4})|(\\d{2}))|(0?[2469]|11)(-|\\/)((0[0-9])|([12])([0-9]?)|(3[0]?))(-|\\/)((\\d{4}|\\d{2})))"; break; case "time": typeValidator.ValidationExpression = ".+"; break; case "string": typeValidator.ValidationExpression = ".+"; break; } // add validator to input cell typeValidateCell.Controls.Add(typeValidator); // add validator to row tr.Cells.Add(typeValidateCell); tr.Attributes.Add("TableSection", "TableBody"); // Add row to the table. formTable.Rows.Add(tr); } // add footer TableFooterRow footerRow = new TableFooterRow(); TableCell footerCell = new TableCell(); Button submitButton = new Button(); submitButton.Text = "Submit"; submitButton.Click += SubmitButton_Click; footerCell.Controls.Add(submitButton); footerRow.Cells.Add(footerCell); formTable.Rows.Add(footerRow); } }