protected void rtb1_ButtonClick(object sender, RadToolBarEventArgs e) { try { int Id_Prd_Original = Convert.ToInt32(Request.QueryString["Id_Prd"]); int Id_Prd = 0; int Cantidad = 0; double precio = 0; string Acs_Doc = ""; string Acs_Dia = ""; string Acs_DiaStr = ""; DateTime rdFechaF = default(DateTime); DataRow[] Ar_dr = dt.Select("Id_Prd='" + Id_Prd_Original + "'"); if (Ar_dr.Length > 0) { Acs_Doc = Ar_dr[0]["Acs_Doc"].ToString(); Acs_Dia = Ar_dr[0]["Acs_Dia"].ToString(); Acs_DiaStr = Ar_dr[0]["Acs_DiaStr"].ToString(); try { rdFechaF = Convert.ToDateTime(Ar_dr[0]["Acs_FechaF"]); } catch (Exception) { } //Ar_dr[0].Delete(); //dt.AcceptChanges(); } int contador = 0; string cantidad = ""; for (int x = 0; x < RadGrid1.Items.Count; x++) { cantidad = (RadGrid1.Items[x].FindControl("txtCantidad") as RadNumericTextBox).Text; if (cantidad != "0" && cantidad != "") { Cantidad = Convert.ToInt32((RadGrid1.Items[x].FindControl("txtCantidad") as RadNumericTextBox).Text); Id_Prd = Convert.ToInt32((RadGrid1.Items[x].FindControl("lblId") as Label).Text); precio = (RadGrid1.Items[x].FindControl("txtPrecio") as RadNumericTextBox).Text == "" ? 0 : Convert.ToDouble((RadGrid1.Items[x].FindControl("txtPrecio") as RadNumericTextBox).Text); Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; CN_CatProducto cn_catproducto = new CN_CatProducto(); Producto pr = new Producto(); cn_catproducto.ConsultaProducto(ref pr, sesion.Emp_Cnx, sesion.Id_Emp, sesion.Id_Cd_Ver, Id_Prd); string Id_Cte = Request.QueryString["Id_Cte"].ToString(); cn_catproducto.ConsultarVentas(ref pr, Convert.ToInt32(Id_Cte), sesion.Emp_Cnx); dt.Rows.Add(new object[] { -1, Id_Prd, pr.Prd_Descripcion, pr.Prd_Presentacion, pr.Prd_UniNs, pr.ventaMes[0], pr.ventaMes[1], pr.ventaMes[2], Cantidad, precio, precio, Cantidad * precio, Acs_Doc, rdFechaF, 0, Acs_Dia, Acs_DiaStr, 0, 0, 0 }); CN_CapAcys cn_acys = new CN_CapAcys(); cn_acys.ModificarEquivalencia(Id_Prd, Id_Prd_Original, Request.QueryString["Id_Acs"].ToString(), sesion.Id_Emp, sesion.Id_Cd_Ver, sesion.Emp_Cnx); contador++; } if (Ar_dr.Length > 0 && contador > 0) { Ar_dr[0].Delete(); dt.AcceptChanges(); } } CerrarVentana(""); list = null; } catch (Exception) { throw; } }