protected void Button3_Click(object sender, EventArgs e) { int x = 0, z = 0; Double y = 0; DataView dv = (DataView)PriceSelect2.Select(DataSourceSelectArguments.Empty); x = Convert.ToInt32(TextBox3.Text); y = (Double)dv.Table.Rows[0][0]; y = y * x; TextBox4.Text = y.ToString(); z = (int)dv.Table.Rows[0][1]; TextBox5.Text = z.ToString(); DataView dvgroup = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty); int returncount = (int)dvgroup.Table.Rows[0][0]; if (returncount >= 1) { Label11.Text = "Already Added"; } else { eosfacInsert.Insert(); Response.Redirect(Request.RawUrl); } }
protected void Button8_Click(object sender, EventArgs e) { MultiView1.ActiveViewIndex = 1; DataView dv = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty); DataTable dt = dv.ToTable(); Label3.Text = dt.Rows[0][1].ToString(); if (Label3.Text == "0") { Button14.Enabled = false; Button14.BackColor = System.Drawing.Color.Red; } }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView2.SelectedRow; idMarcapro = row.Cells[5].Text; separar = idMarcapro.Split(','); SqlDataSource9.SelectParameters["IDprod"].DefaultValue = row.Cells[0].Text; SqlDataSource9.SelectParameters["ID_Tienda"].DefaultValue = DropDownList1.SelectedValue; SqlDataSource9.SelectParameters["idMarcaP"].DefaultValue = separar[0].ToString(); SqlDataSource9.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader total; total = (SqlDataReader)SqlDataSource9.Select(DataSourceSelectArguments.Empty); if (total.Read()) { siExiste = Convert.ToInt32(total["total"]); } // siExiste = datos.SiExisteStock(Convert.ToInt32(DropDownList1.SelectedValue),Convert.ToInt32(row.Cells[0].Text), Convert.ToInt32(separar[0])); if (siExiste == 1) { codigop = row.Cells[0].Text; cant = Convert.ToInt32(row.Cells[8].Text); idStock = row.Cells[12].Text; Label1.Text = row.Cells[8].Text + " de productos en la tienda: " + Session["Tienda"].ToString(); Label2.Text = DropDownList1.SelectedItem.ToString(); Button1_ModalPopupExtender.Show(); } if (siExiste == 0) { codigop = row.Cells[0].Text; precioCompra = Convert.ToDecimal(row.Cells[6].Text); precioVentass = Convert.ToDecimal(row.Cells[7].Text); cant = Convert.ToInt32(row.Cells[8].Text); idStock = row.Cells[12].Text; Label3.Text = row.Cells[8].Text + " de productos en la tienda: " + Session["Tienda"].ToString(); Label4.Text = DropDownList1.SelectedItem.ToString(); DropDownList6.SelectedIndex = DropDownList6.Items.IndexOf(DropDownList6.Items.FindByText(row.Cells[9].Text)); Button10_ModalPopupExtender.Show(); } else if (siExiste > 1) { Response.Write("<script>alert('Existe mas de 1 del mismo producto, año y misma tienda. Borre uno,')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { Double amount = Convert.ToDouble(TextBox2.Text) * Convert.ToInt32(TextBox3.Text); TextBox7.Text = amount.ToString("n2"); DataView dvgroup = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty); int returncount = (int)dvgroup.Table.Rows[0][0]; if (returncount >= 1) { Label11.Text = "Unable to Insert same Facility"; } else { Label11.Text = ""; SqlDataSource4.Insert(); DataView dvx = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty); Double tl = (Double)dvx.Table.Rows[0][0]; Label10.Text = tl.ToString("n2"); Response.Redirect(Request.RawUrl); } }
protected void Button1_Click(object sender, EventArgs e) { DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); DataRowView drv = dv[0]; Table1.Rows[1].Cells[0].Text = drv["BUGS"].ToString(); DataView dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); DataRowView drv1 = dv1[0]; Table1.Rows[1].Cells[1].Text = drv1["BUGS"].ToString(); DataView dv2 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); DataRowView drv2 = dv2[0]; Table1.Rows[1].Cells[2].Text = drv2["BUGS"].ToString(); DataView dv3 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); DataRowView drv3 = dv3[0]; Table1.Rows[1].Cells[3].Text = drv3["BUGS"].ToString(); DataView dv5 = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty); DataRowView drv5 = dv5[0]; Table2.Rows[1].Cells[0].Text = drv5["BUGS"].ToString(); DataView dv6 = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty); DataRowView drv6 = dv6[0]; Table2.Rows[1].Cells[1].Text = drv6["BUGS"].ToString(); DataView dv7 = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty); DataRowView drv7 = dv7[0]; Table2.Rows[1].Cells[2].Text = drv7["BUGS"].ToString(); DataView dv8 = (DataView)SqlDataSource8.Select(DataSourceSelectArguments.Empty); DataRowView drv8 = dv8[0]; Table2.Rows[1].Cells[3].Text = drv8["BUGS"].ToString(); DataView dv9 = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty); DataRowView drv9 = dv9[0]; Table3.Rows[1].Cells[0].Text = drv9["BUGS"].ToString(); DataView dv10 = (DataView)SqlDataSource10.Select(DataSourceSelectArguments.Empty); DataRowView drv10 = dv10[0]; Table3.Rows[1].Cells[1].Text = drv10["BUGS"].ToString(); DataView dv11 = (DataView)SqlDataSource11.Select(DataSourceSelectArguments.Empty); DataRowView drv11 = dv11[0]; Table3.Rows[1].Cells[2].Text = drv11["BUGS"].ToString(); DataView dv12 = (DataView)SqlDataSource12.Select(DataSourceSelectArguments.Empty); DataRowView drv12 = dv12[0]; Table3.Rows[1].Cells[3].Text = drv12["BUGS"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { String y = "select DISTINCT [Year] from SchoolTable"; SqlDataSource9.SelectCommand = y; DataView dv = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments()); for (int i = 0; i < dv.Count; i++) { if (dv[i][0] != DBNull.Value) { String year = (String)dv[i][0]; String sql1 = "select count(UnitName) from SchoolTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource1.SelectCommand = sql1; DataView dv1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments()); int cub = (int)dv1[0][0]; String sql2 = "select count(UnitName) from SchoolTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource2.SelectCommand = sql2; DataView dv2 = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments()); int scout = (int)dv2[0][0]; String sql3 = "select count(UnitName) from SchoolTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource3.SelectCommand = sql3; DataView dv3 = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments()); int rover = (int)dv3[0][0]; String sql4 = "select count(UnitName) from SchoolTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource4.SelectCommand = sql4; DataView dv4 = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments()); int bulbul = (int)dv4[0][0]; String sql5 = "select count(UnitName) from SchoolTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource5.SelectCommand = sql5; DataView dv5 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments()); int guide = (int)dv5[0][0]; String sql6 = "select count(UnitName) from SchoolTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource6.SelectCommand = sql6; DataView dv6 = (DataView)SqlDataSource6.Select(new DataSourceSelectArguments()); int ranger = (int)dv6[0][0]; String sql7 = "select count(UnitName) from SchoolTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource7.SelectCommand = sql7; DataView dv7 = (DataView)SqlDataSource7.Select(new DataSourceSelectArguments()); int bunny = (int)dv7[0][0]; int total = cub + scout + rover + bulbul + guide + ranger + bunny; String sql9 = "select count(StudFullName) from StudentTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource9.SelectCommand = sql9; DataView dv9 = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments()); int cub1 = (int)dv9[0][0]; String sql10 = "select count(StudFullName) from StudentTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource10.SelectCommand = sql10; DataView dv10 = (DataView)SqlDataSource10.Select(new DataSourceSelectArguments()); int scout1 = (int)dv10[0][0]; String sql11 = "select count(StudFullName) from StudentTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource11.SelectCommand = sql11; DataView dv11 = (DataView)SqlDataSource11.Select(new DataSourceSelectArguments()); int rover1 = (int)dv11[0][0]; String sql12 = "select count(StudFullName) from StudentTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource12.SelectCommand = sql12; DataView dv12 = (DataView)SqlDataSource12.Select(new DataSourceSelectArguments()); int bulbul1 = (int)dv12[0][0]; String sql13 = "select count(StudFullName) from StudentTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource13.SelectCommand = sql13; DataView dv13 = (DataView)SqlDataSource13.Select(new DataSourceSelectArguments()); int guide1 = (int)dv13[0][0]; String sql14 = "select count(StudFullName) from StudentTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource14.SelectCommand = sql14; DataView dv14 = (DataView)SqlDataSource14.Select(new DataSourceSelectArguments()); int ranger1 = (int)dv14[0][0]; String sql15 = "select count(StudFullName) from StudentTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource15.SelectCommand = sql15; DataView dv15 = (DataView)SqlDataSource15.Select(new DataSourceSelectArguments()); int bunny1 = (int)dv7[0][0]; int total1 = cub1 + scout1 + rover1 + bulbul1 + guide1 + ranger1 + bunny1; String sql16 = "select count(UnitName) from SchoolTable where Year='" + year + "' AND Status='Activated'"; SqlDataSource16.SelectCommand = sql16; DataView dv16 = (DataView)SqlDataSource16.Select(new DataSourceSelectArguments()); int unit = (int)dv16[0][0]; String sql17 = "select SUM(khTotalContri) from SchoolTable where Year='" + year + "'"; SqlDataSource17.SelectCommand = sql17; DataView dv17 = (DataView)SqlDataSource17.Select(new DataSourceSelectArguments()); int amt; if (dv17[0][0] != DBNull.Value) { amt = (int)dv17[0][0]; } else { amt = 0; } String sql18 = "select count(SchoolName) from SchoolTable where Year='" + year + "' AND Status='Activated'"; SqlDataSource18.SelectCommand = sql18; DataView dv18 = (DataView)SqlDataSource18.Select(new DataSourceSelectArguments()); int sch = (int)dv18[0][0]; String sql19 = "select count(SchoolName) from SchoolTable where SchoolType='PrimarySchool' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource19.SelectCommand = sql19; DataView dv19 = (DataView)SqlDataSource19.Select(new DataSourceSelectArguments()); int sch1 = (int)dv19[0][0]; String sql20 = "select count(SchoolName) from SchoolTable where SchoolType='SecondarySchool' AND Year='" + year + "' AND Status='Activated'"; SqlDataSource20.SelectCommand = sql20; DataView dv20 = (DataView)SqlDataSource20.Select(new DataSourceSelectArguments()); int sch2 = (int)dv20[0][0]; int total3 = sch1 + sch2; String update = "Select * from StatisticalData where Year='" + year + "'"; SqlDataSource21.SelectCommand = update; DataView dv21 = (DataView)SqlDataSource21.Select(new DataSourceSelectArguments()); if (dv21.Count != 0) { String query = "update StatisticalData set Cub=" + cub + ", Scout=" + scout + ", Rover=" + rover + ", Bulbul=" + bulbul + ", Guide=" + guide + ", Ranger=" + ranger + ", Bunny=" + bunny + ", Total=" + total + ", Cub1=" + cub1 + ", Scout1=" + scout1 + ", Rover1=" + rover1 + ", Bulbul1=" + bulbul1 + ", Guide1=" + guide1 + ", Ranger1=" + ranger1 + ", Bunny1=" + bunny1 + ", Total1=" + total1 + ", TotalUnits=" + unit + ", CollectedFees=" + amt + ", TotalParticipatedSchools=" + sch + ", PrimarySchool=" + sch1 + ", SecondarySchool=" + sch2 + ", TotalMembers=" + total3 + " where Year='" + year + "'"; SqlDataSource22.UpdateCommand = query; int n = SqlDataSource22.Update(); } else { String insert1 = "insert into StatisticalData (Year, Cub, Scout, Rover, Bulbul, Guide, Ranger, Bunny, Total, Cub1, Scout1, Rover1, Bulbul1, Guide1, Ranger1, Bunny1, Total1, TotalUnits, CollectedFees, TotalParticipatedSchools, PrimarySchool, SecondarySchool, TotalMembers) Values('" + year + "'," + cub + "," + scout + "," + rover + "," + bulbul + "," + guide + "," + ranger + "," + bunny + "," + total + "," + cub1 + "," + scout1 + "," + rover1 + "," + bulbul1 + "," + guide1 + "," + ranger1 + "," + bunny1 + "," + total1 + "," + unit + "," + amt + "," + sch + "," + sch1 + "," + sch2 + "," + total3 + ")"; SqlDataSource8.InsertCommand = insert1; int n1 = SqlDataSource8.Insert(); } } } Server.Transfer("Statistical2.aspx"); }