示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            GvDetalle.DataSource = dt;
            GvDetalle.DataBind();

            GvDetalle.DataSource = obj.DetallePedidoXId(Convert.ToInt32(HndIdPedido.Value));
            GvDetalle.DataBind();
            //Calculate Sum and display in Footer Row
            decimal total = dt.AsEnumerable().Sum(row => row.Field <decimal>("SubTota"));

            GvDetalle.FooterRow.Cells[3].Text            = "Total";
            GvDetalle.FooterRow.Cells[3].HorizontalAlign = HorizontalAlign.Right;
            GvDetalle.FooterRow.Cells[4].Text            = total.ToString("N2");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none",
                                                    "<script>$('#myModal3').modal('show');</script>", false);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            GvDetalle.DataSource = dt;
            GvDetalle.DataBind();

            DataTable dt_det = new DataTable();

            dt_det = obj.DetallePedidoXId(Convert.ToInt32(HndIdPedido.Value));
            GvDetalle.Columns[3].FooterText = "TOTAL S/.";
            GvDetalle.Columns[4].FooterText = dt_det.AsEnumerable().Select(x => x.Field <Decimal>("SubTotal")).Sum().ToString();
            GvDetalle.DataSource            = dt_det;
            GvDetalle.DataBind();

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none",
                                                    "<script>$('#myModal3').modal('show');</script>", false);
        }
    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {
        string noEmpleado, nombre, actividad, horaInicio, horaFin, idActividad;

        //lblName.Text = GridView1.SelectedRow.Cells[1].Text;
        noEmpleado                       = (GridView1.SelectedRow.FindControl("lnkEmpleado") as LinkButton).Text;
        idActividad                      = (GridView1.SelectedRow.FindControl("hdfActividad") as HiddenField).Value;
        lblNoEmpleado.Text               = noEmpleado;
        lblNombreEmpleado.Text           = GridView1.SelectedRow.Cells[1].Text;
        lblActividad.Text                = GridView1.SelectedRow.Cells[2].Text;
        lblFechaInicio.Text              = GridView1.SelectedRow.Cells[5].Text;
        lblFechaFin.Text                 = GridView1.SelectedRow.Cells[6].Text;
        lblCantidadSurcosTrabajados.Text = (GridView1.SelectedRow.FindControl("hdfCantidad") as HiddenField).Value;

        Dictionary <string, object> parameters = new Dictionary <string, object>();
        DataTable result;

        if (cbxCosecha.Checked)
        {
            parameters.Add("@idAsociado", noEmpleado);
            parameters.Add("@fechaInicio", Convert.ToDateTime(lblFechaInicio.Text).ToString("yyyy-MM-dd"));
            parameters.Add("@fechaFin", Convert.ToDateTime(lblFechaFin.Text).ToString("yyyy-MM-dd"));
            parameters.Add("@idInvernadero", ddlInvernadero.SelectedValue);

            DataAccess dataaccess = new DataAccess();
            result = dataaccess.executeStoreProcedureDataTable("procObtieneCosechaPorEmpleadoDetalle", parameters);
        }
        else
        {
            parameters.Add("@NoEmpleado", noEmpleado);
            parameters.Add("@fechaInicio", Convert.ToDateTime(lblFechaInicio.Text).ToString("yyyy-MM-dd"));
            parameters.Add("@fechaFin", Convert.ToDateTime(lblFechaFin.Text).ToString("yyyy-MM-dd"));
            parameters.Add("@idActividad", idActividad);

            DataAccess dataaccess = new DataAccess();
            result = dataaccess.executeStoreProcedureDataTable("procObtieneDetalleActividadApagar", parameters);
        }
        GvDetalle.DataSource = result;
        GvDetalle.DataBind();

        mpe.Show();
    }
        protected void btnInsertar_Click(object sender, EventArgs e)
        {
            //int VentId;

            //vn.Monto=Convert.ToInt32(txtMonto.Text);
            //vn.Fecha = Convert.ToDateTime(txtFecha.Text);
            //vn.Insertar();
            //VentId= vn.VentasId;

            //GvDetalle.DataSource = vn.Listado();
            //GvDetalle.DataBind();


            datatablesesion();
            dr["ArticuloId"]  = Convert.ToInt32(DdLstArticulos.SelectedValue);
            dr["Descripcion"] = HidDescArtic.Value;
            dr["Cantidad"]    = Convert.ToInt32(TxBxCantidad.Text);
            dr["Precio"]      = Decimal.Parse(txtPrecio.Text);

            decimal precio;
            int     cant;

            cant   = Int32.Parse(TxBxCantidad.Text);
            precio = Decimal.Parse(txtPrecio.Text);

            decimal importe = cant * precio;

            dr["Importe"] = importe;

            Session["total"] = Convert.ToDecimal(Session["total"]) + importe;

            dtArt.Rows.Add(dr);

            GvDetalle.DataSource = dtArt;
            GvDetalle.DataBind();
            txtMonto.Text = Session["total"].ToString();
        }
 public void BindGridView(DataTable dtResult)
 {
     GvDetalle.DataSource = dtResult;
     GvDetalle.DataBind();
 }