protected void GridRecords_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TotalCr += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Credit_PR")); TotalDE += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Debit_PR")); TotalIn += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "InterestAmt")); TotalPI += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PenalInt")); TotalIR += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "IntReceivable")); TotalNC += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "NoticeCharge")); TotalSC += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ServiceCharge")); TotalCC += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "CourtCharge")); TotalSC1 += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SerCharge")); TotalOC += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OtherCharge")); TotalI += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Insurance")); TotalBC += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "BankCharge")); TotalBal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TBal")); ToptalCL += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "BALANCE")); } if (e.Row.RowType == DataControlRowType.Footer) { ((Label)e.Row.FindControl("lblTCr")).Text = TotalCr.ToString(); ((Label)e.Row.FindControl("lblTDe")).Text = TotalDE.ToString(); ((Label)e.Row.FindControl("lblTIn")).Text = TotalIn.ToString(); ((Label)e.Row.FindControl("lblTPI")).Text = TotalPI.ToString(); ((Label)e.Row.FindControl("lblTIR")).Text = TotalIR.ToString(); ((Label)e.Row.FindControl("lblTNC")).Text = TotalNC.ToString(); ((Label)e.Row.FindControl("lblTSC")).Text = TotalSC.ToString(); ((Label)e.Row.FindControl("lblTCC")).Text = TotalCC.ToString(); ((Label)e.Row.FindControl("lblTSC1")).Text = TotalSC1.ToString(); ((Label)e.Row.FindControl("lblTOC")).Text = TotalOC.ToString(); ((Label)e.Row.FindControl("lblTI")).Text = TotalI.ToString(); ((Label)e.Row.FindControl("lblTBC")).Text = TotalBC.ToString(); ((Label)e.Row.FindControl("lblTTC")).Text = TotalBal.ToString(); } }
private void buttonCalcular_Click(object sender, EventArgs e) { //distcncia double A = 0, B = 0, C = 0; double DabX; double DbcX; double DcaX; double A2, B2, C2; double Daby; double Dbcy; double Dcay; double TotalsumaAB, TotalsumaBc, TotalsumaCa; double TotalAB, TotalBC, TotalCA; //punto medio double PMABX, PMBCX, PMCAX; double PMABY, PMBCY, PMCAY; if (XAT.Text == "") { MessageBox.Show("Falta agregar el valor X(A)", "Alerta"); } if (XBT.Text == "") { MessageBox.Show("Falta agregar el valor X(B)", "Alerta"); } if (XCT.Text == "") { MessageBox.Show("Falta agregar el valor X(C)", "Alerta"); } if (YAT.Text == "") { MessageBox.Show("Falta agregar el valor Y(A)", "Alerta"); } if (YBT.Text == "") { MessageBox.Show("Falta agregar el valor Y(B)", "Alerta"); } if (YCT.Text == "") { MessageBox.Show("Falta agregar el valor Y(C)", "Alerta"); } //se comprube q sea numero y no otro caracter //leer puntos(X) try { A = Convert.ToDouble(XAT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en X(A)"); return; } //try X(B) try { B = Convert.ToDouble(XBT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en X(B)"); return; } //try X(C) try { C = Convert.ToDouble(XCT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en X(C)"); return; } //Leer puntos(Y) //TRY Y(A) try { A2 = Convert.ToDouble(YAT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en Y(A)"); return; } //TRY Y(B) try { B2 = Convert.ToDouble(YBT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en Y(B)"); return; } //TRY Y(C) try { C2 = Convert.ToDouble(YCT.Text); } catch (Exception) { MessageBox.Show("Escribe un numero en Y(C)"); return; } //opreacion de sacar la x DabX = (Math.Pow((B - A), 2)); DbcX = (Math.Pow((B - C), 2)); DcaX = (Math.Pow((A - C), 2)); //operacion sacar la y Daby = (Math.Pow((B2 - A2), 2)); Dbcy = (Math.Pow((B2 - C2), 2)); Dcay = (Math.Pow((A2 - C2), 2)); //RESULTADO DE dAB TotalsumaAB = DabX + Daby; TotalAB = Math.Sqrt(TotalsumaAB); //Resultado de dbc TotalsumaBc = DbcX + Dbcy; TotalBC = Math.Sqrt(TotalsumaBc); //resultado de dca TotalsumaCa = DcaX + Dcay; TotalCA = Math.Sqrt(TotalsumaCa); //impresion de distancia listBox1.Items.Add("DAB"); listBox1.Items.Add(TotalAB.ToString()); listBox2.Items.Add("DBC"); listBox2.Items.Add(TotalBC.ToString()); listBox3.Items.Add("DCA"); listBox3.Items.Add(TotalCA.ToString()); //OPERACIONES PUNTO MEDIO PMABX = (A + B) / 2; PMBCX = (B + C) / 2; PMCAX = (C + A) / 2; PMABY = (A2 + B2) / 2; PMBCY = (B2 + C2) / 2; PMCAY = (C2 + A2) / 2; //impresion de punto medio listBox1.Items.Add("PMAB"); listBox1.Items.Add(PMABX.ToString() + " X"); listBox1.Items.Add(PMABY.ToString() + " Y"); listBox2.Items.Add("PMBC"); listBox2.Items.Add(PMBCX.ToString() + " X"); listBox2.Items.Add(PMBCY.ToString() + " Y"); listBox3.Items.Add("PMCA"); listBox3.Items.Add(PMCAX.ToString() + " X"); listBox3.Items.Add(PMCAY.ToString() + " Y"); }