コード例 #1
0
        protected void grvnotarecojo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int fila    = Convert.ToInt32(e.CommandArgument);
            int idabono = Convert.ToInt32(grvnotarecojo.Rows[fila].Cells[0].Text);

            if (e.CommandName == "Eliminar")
            {
                NotaRecojoDAO db = new NotaRecojoDAO();
                db.Eliminar(idabono);
                db.EliminarDetalle(idabono);
                cargar();
                string script = "openModal();";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "correcto", script, true);
            }
            else if (e.CommandName == "Modificar")
            {
                int id = Convert.ToInt32(grvnotarecojo.Rows[fila].Cells[0].Text);
                Response.Redirect("ModNotaRecojo.aspx?IDMP=" + id, true);
            }
            else if (e.CommandName == "Imprimir")
            {
                string ID    = grvnotarecojo.Rows[fila].Cells[0].Text;
                string sRuta = "Reportes/frmNotaRecojo.aspx?Id=" + ID;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Window1", "<script> window.open('" + sRuta + "');</script>", false);
            }
        }
コード例 #2
0
ファイル: NotaRecojo.aspx.cs プロジェクト: eesteban1/Pedidos
        protected void btnguardar_Click(object sender, EventArgs e)
        {
            NotaRecojoDAO nota = new NotaRecojoDAO();

            Model.Enity.NotaRecojo nt = new Model.Enity.NotaRecojo();
            nt.Fecha       = txtfecha.Text;
            nt.Id_Cliente  = Convert.ToInt32(ddlcliente.SelectedValue);
            nt.Id_Vendedor = Convert.ToInt32(Session["IDUsuario"].ToString());
            nt.Nota        = txtnota.Text;
            nt.sw          = false;
            nt.swdecrip    = " ";
            Int64 id = nota.InsertarNotaRecojo(nt);

            foreach (GridViewRow fila in grvDetalles.Rows)
            {
                NotaRecojoDetalle det    = new NotaRecojoDetalle();
                TextBox           precio = (TextBox)fila.FindControl("txtprecio");
                det.Precio      = Math.Round(Convert.ToDecimal(precio.Text), 2);
                det.Id_Producto = Convert.ToInt32(fila.Cells[0].Text);
                nota.InsertarNotaRecojoDetalle(det, id);
            }



            Response.Redirect("ManteNotaRecojoVendedor.aspx", true);
        }
コード例 #3
0
        private void cargar()
        {
            NotaRecojoDAO db = new NotaRecojoDAO();
            //txtfecha.Text = DateTime.Now.ToString("yyyy-MM-dd");
            int id = Convert.ToInt32(Session["IDUsuario"].ToString());

            grvnotarecojo.DataSource = db.BuscarNotaRecojoVendedor(id);
            grvnotarecojo.DataBind();
        }
コード例 #4
0
        private void cargar()
        {
            Util.Helper.ListarClientes(ddlcliente);
            NotaRecojoDAO db = new NotaRecojoDAO();

            txtfi.Text = DateTime.Now.ToString("yyyy-MM-dd");
            txtff.Text = DateTime.Now.ToString("yyyy-MM-dd");
            grvnotarecojo.DataSource = db.BuscarNotaRecojoxfecha(txtfi.Text, txtff.Text, "0");
            grvnotarecojo.DataBind();
        }
コード例 #5
0
        protected void btnbuscar_Click(object sender, EventArgs e)
        {
            string        fi   = txtfi.Text;
            string        ff   = txtff.Text;
            string        id   = ddlcliente.SelectedValue;
            NotaRecojoDAO nota = new NotaRecojoDAO();

            grvnotarecojo.DataSource = nota.BuscarNotaRecojoxfecha(fi, ff, id);
            grvnotarecojo.DataBind();
        }
コード例 #6
0
 protected void btnguardar_Click(object sender, EventArgs e)
 {
     try
     {
         Model.Enity.NotaRecojo nt = new Model.Enity.NotaRecojo();
         nt.Id            = Convert.ToInt32(Request.QueryString["IDMP"]);
         nt.Numero_Recojo = txtnumerorecojo.Text;
         nt.Id_Vendedor   = Convert.ToInt32(txtxvendedor.Text);
         nt.Id_Cliente    = Convert.ToInt32(ddlcliente.SelectedValue);
         nt.Nota          = txtnota.Text;
         nt.Fecha         = txtfecha.Text;
         nt.sw            = chkrecojo.Checked;
         Int32 id = nt.Id;
         if (chkrecojo.Checked == true)
         {
             nt.swdecrip = "Si Recogio";
         }
         else
         {
             nt.swdecrip = "No Recogio";
         }
         NotaRecojoDAO nota = new NotaRecojoDAO();
         nota.ActualizarNotaRecojo(nt);
         nota.EliminarDetalle(id);
         foreach (GridViewRow fila in grvDetalles.Rows)
         {
             NotaRecojoDetalle det    = new NotaRecojoDetalle();
             TextBox           precio = (TextBox)fila.FindControl("txtprecio");
             det.Id_Producto = Convert.ToInt32(fila.Cells[0].Text);
             det.Precio      = Convert.ToDecimal(precio.Text);
             nota.InsertarNotaRecojoDetalle(det, id);
         }
         Response.Redirect("ManteNotaRecojo.aspx", true);
     }
     catch (Exception ex)
     {
         txtmensaje.Text = ex.Message;
         string script = "openModal();";
         ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", script, true);
     }
 }
コード例 #7
0
        private void cargar()
        {
            NotaRecojoDAO nt = new NotaRecojoDAO();
            int           id = Convert.ToInt32(Request.QueryString["IDMP"]);

            System.Data.DataSet ds     = nt.BuscarNotaRecojo(id);
            DataTable           dtnota = ds.Tables[0];
            string idzona = dtnota.Rows[0]["IdZona"].ToString();

            cargarmercado(idzona);
            txtnumerorecojo.Text     = dtnota.Rows[0]["Numero_Recojo"].ToString();
            ddlmercado.SelectedValue = Convert.ToString(dtnota.Rows[0]["IdMercado"]);
            txtdireccion.Text        = Convert.ToString(dtnota.Rows[0]["Direccion"]);
            txtfecha.Text            = Convert.ToDateTime(dtnota.Rows[0]["Fecha"]).ToString("yyyy-MM-dd");
            txtxvendedor.Text        = dtnota.Rows[0]["Id_Vendedor"].ToString();
            txtnota.Text             = dtnota.Rows[0]["Nota"].ToString();
            chkrecojo.Checked        = Convert.ToBoolean(dtnota.Rows[0]["sw"].ToString());
            string idmer = ddlmercado.SelectedValue;

            Util.Helper.ListarClientesxMerZon(ddlcliente, idmer);
            ddlcliente.SelectedValue = Convert.ToString(dtnota.Rows[0]["Id_cliente"]);
            DataTable detalles = (DataTable)Session["detallesnota"];

            if (detalles.Rows.Count > 0)
            {
                detalles.Rows.Clear();
            }
            DataTable dtdetalles = ds.Tables[1];

            foreach (DataRow Rg in dtdetalles.Rows)
            {
                string  idpro       = Convert.ToString(Rg["Id_Producto"]);
                string  Descripcion = Convert.ToString(Rg["descripcion"]);
                decimal precio      = Convert.ToDecimal(Rg["Precio"]);
                Util.Helper.Agregar_DetallesNota(detalles, idpro, Descripcion, precio);
                Session["detallesnota"] = detalles;
            }
            cargarDetalles();
        }