public void getalltipogasto() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("id_tipogasto")); dt.Columns.Add(new DataColumn("descripcion")); DataColumn col = new DataColumn("check"); col.DataType = System.Type.GetType("System.Boolean"); dt.Columns.Add(col); List <ClienteOperacionTipogasto> lTipogasto = new ClienteOperacionTipogastoBC().GetClienteOperaciontipogasto(Convert.ToInt32(id_cliente), Convert.ToInt32(this.dl_familia.SelectedValue), this.dl_producto.SelectedValue); foreach (ClienteOperacionTipogasto mtipogasto in lTipogasto) { DataRow dr = dt.NewRow(); dr["id_tipogasto"] = mtipogasto.Id_tipogasto; dr["descripcion"] = mtipogasto.Descripcion; dr["check"] = mtipogasto.Check; dt.Rows.Add(dr); } this.gr_dato.DataSource = dt; this.gr_dato.DataBind(); }
private void add2() { GridViewRow row; for (int i = 0; i < GridView1.Rows.Count; i++) { row = GridView1.Rows[i]; CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("check"); string codigo = this.GridView1.Rows[i].Cells[0].Text; // int id_cliente = id_cliente; Familia_Producto fma = new Familia_productoBC().getfamiliabycodigo(this.dl_producto.SelectedValue.Trim()); if (chk.Checked == true) { string add = new ClienteOperacionTipogastoBC().add_operacion_tipogasto(Convert.ToInt16(codigo), this.dl_producto.SelectedValue.ToString()); } else { string add = new ClienteOperacionTipogastoBC().del_operacion_tipogasto(this.dl_producto.SelectedValue.ToString(), Convert.ToInt16(codigo)); } } }
private void add() { GridViewRow row; for (int i = 0; i < gr_dato.Rows.Count; i++) { row = gr_dato.Rows[i]; CheckBox chk = (CheckBox)gr_dato.Rows[i].FindControl("check"); string codigo = this.gr_dato.Rows[i].Cells[0].Text; // int id_cliente = id_cliente; if (chk.Checked == true) { string add = new ClienteOperacionTipogastoBC().add_cliente_operacion_tipogasto(id_cliente, Convert.ToInt32(dl_familia.SelectedValue.ToString()), this.dl_producto.SelectedValue.Trim(), Convert.ToInt32(codigo)); } else { string add = new ClienteOperacionTipogastoBC().del_cliente_operacion_tipogasto(id_cliente, Convert.ToInt32(dl_familia.SelectedValue.Trim().ToString()), this.dl_producto.SelectedValue.Trim(), Convert.ToInt32(codigo)); } } }
public void getalltipogastocomun() { DataTable dt2 = new DataTable(); dt2.Columns.Add(new DataColumn("id_tipogasto")); dt2.Columns.Add(new DataColumn("descripcion")); DataColumn col = new DataColumn("check"); col.DataType = System.Type.GetType("System.Boolean"); dt2.Columns.Add(col); //List<Familia_Producto> fma = new Familia_productoBC().getproductobyfamilia(Convert.ToInt16(id_familia.ToString())); List <ClienteOperacionTipogasto> lTipogasto = new ClienteOperacionTipogastoBC().GetOperaciontipogasto(Convert.ToInt16(id_familia.ToString()), dl_producto.SelectedValue); foreach (ClienteOperacionTipogasto mtipogasto in lTipogasto) { DataRow dr2 = dt2.NewRow(); dr2["id_tipogasto"] = mtipogasto.Id_tipogasto; dr2["descripcion"] = mtipogasto.Descripcion; dr2["check"] = mtipogasto.Check; dt2.Rows.Add(dr2); } this.GridView1.DataSource = dt2; this.GridView1.DataBind(); }