コード例 #1
0
        public ActionResult agregaDetalle(string idNota, string mat, string cant)
        {
            string ruta = "/Notas/detalle";

            //sesion
            if (Session["token"] == null)
            {
                return(RedirectToAction("./")); //salir a login
            }
            else
            {
                //permisos
                string tk      = Session["token"].ToString();
                int    permiso = validation.validarPermisos(tk, ruta);
                if (permiso != 0)
                {
                    DetalleNota dtll = new DetalleNota();
                    Material    mt   = new Material();
                    Nota        nt   = new Nota();

                    mt.idMaterial = Int32.Parse(mat);
                    dtll.material = mt;
                    nt.idNota     = Int64.Parse(idNota);
                    dtll.nota     = nt;
                    dtll.Cantidad = Int32.Parse(cant);
                    model.agregarDetalleNota(dtll);
                    return(RedirectToAction("/"));
                }
                else
                {
                    return(RedirectToAction("./")); //salir a login
                }
            }
        }
コード例 #2
0
        //listarDetalleNota
        public List <DetalleNota> listarDetalleNota(string idNota)
        {
            List <DetalleNota> lista = new List <DetalleNota>();
            var cn = cnx.getConexion();

            cn.Open();
            SqlCommand cmd = new SqlCommand("SP_LISTAR_DETALLE_NOTA", cn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@idNota", idNota);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                DetalleNota dtll = new DetalleNota();
                Nota        nt   = new Nota();
                Material    mt   = new Material();
                dtll.idDetalleNota = dr.GetInt64(0);
                nt.idNota          = dr.GetInt64(1);
                dtll.nota          = nt;
                mt.idMaterial      = dr.GetInt32(2);
                mt.descripcion     = dr.GetString(3);
                dtll.material      = mt;
                dtll.Cantidad      = dr.GetInt32(4);
                dtll.fechaRegistro = dr.GetString(5);
                lista.Add(dtll);
            }
            cn.Close();
            return(lista);
        }
コード例 #3
0
 public DlgDetalleVenta(MySqlConnection xConnection, DataGridViewRow row)
 {
     InitializeComponent();
     this.xConnection = xConnection;
     xDetalleNo       = new DetalleNota(xConnection);
     //this.nIdNota = nIdNota;
     //this.nIdDetalle = nIdDetalle;
     this.row = row;
 }
コード例 #4
0
ファイル: Main.cs プロジェクト: gemalo28/RestauranteYouLi
 public Main(MySqlConnection xConnection)
 {
     InitializeComponent();
     this.xConnection = xConnection;
     xOrdenes         = new Ordenes(this.xConnection);
     xProd            = new Productos(this.xConnection);
     xDetProd         = new DetalleOrden(this.xConnection);
     xDetNota         = new DetalleNota(this.xConnection);
 }
コード例 #5
0
        //agregarDetalleNota
        public void agregarDetalleNota(DetalleNota dtll)
        {
            var        cn  = cnx.getConexion();
            SqlCommand cmd = new SqlCommand("SP_AGREGAR_DETALLE_NOTA", cn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@idNota", dtll.nota.idNota);
            cmd.Parameters.AddWithValue("@idMaterial", dtll.material.idMaterial);
            cmd.Parameters.AddWithValue("@cantidad", dtll.Cantidad);
            cn.Open();
            cmd.ExecuteNonQuery();
            cn.Close();
        }