Пример #1
0
        public void UpdatePresentacion(E_Presentacion ObjPresentacion, string Tipo)
        {
            SqlDatabase SqlClient = new SqlDatabase(connectionString);

            DbConnection tCnn;

            tCnn = SqlClient.CreateConnection();
            tCnn.Open();

            DbTransaction tran = tCnn.BeginTransaction();

            try
            {
                DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_UpdatePresentacion]");
                SqlClient.AddInParameter(SqlCommand, "@PresentacionID", SqlDbType.Char, ObjPresentacion.PresentacionID);
                SqlClient.AddInParameter(SqlCommand, "@NomPresentacion", SqlDbType.VarChar, ObjPresentacion.NomPresentacion);
                SqlClient.AddInParameter(SqlCommand, "@Unidades", SqlDbType.Decimal, ObjPresentacion.Unidades);
                SqlClient.AddInParameter(SqlCommand, "@UnidadMedidaID", SqlDbType.Char, ObjPresentacion.UnidadMedidaID);
                SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjPresentacion.UsuarioID);
                SqlClient.AddInParameter(SqlCommand, "@Tipo", SqlDbType.Char, Tipo);

                SqlClient.ExecuteNonQuery(SqlCommand, tran);

                tran.Commit();
                tCnn.Close();
                tCnn.Dispose();
                SqlCommand.Dispose();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
        public string InsertPresentacion(E_Presentacion ObjPresentacion)
        {
            string      PresentacionID = "";
            SqlDatabase SqlClient      = new SqlDatabase(connectionString);

            DbConnection tCnn;

            tCnn = SqlClient.CreateConnection();
            tCnn.Open();

            DbTransaction tran = tCnn.BeginTransaction();

            try
            {
                DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_InsertPresentacion]");
                SqlClient.AddInParameter(SqlCommand, "@NomPresentacion", SqlDbType.VarChar, ObjPresentacion.NomPresentacion);
                SqlClient.AddInParameter(SqlCommand, "@Unidades", SqlDbType.Decimal, ObjPresentacion.Unidades);
                SqlClient.AddInParameter(SqlCommand, "@UnidadMedidaID", SqlDbType.Char, ObjPresentacion.UnidadMedidaID);
                SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjPresentacion.UsuarioID);

                PresentacionID = Convert.ToString(SqlClient.ExecuteScalar(SqlCommand, tran));

                tran.Commit();
                tCnn.Close();
                tCnn.Dispose();
                SqlCommand.Dispose();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message);
            }

            return(PresentacionID);
        }
Пример #3
0
        public string InsertPresentacion(E_Presentacion ObjPresentacion)
        {
            string      PresentacionID = "";
            CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString);

            PresentacionID = ObjCD_Producto.InsertPresentacion(ObjPresentacion);
            return(PresentacionID);
        }
Пример #4
0
 private void ObtenerDatosControles()
 {
     ObjPresentacion = new E_Presentacion();
     ObjPresentacion.PresentacionID  = TxtPresentacionID.Text;
     ObjPresentacion.NomPresentacion = TxtNomPresentacion.Text;
     ObjPresentacion.Unidades        = Convert.ToDecimal(TxtUnidades.Text);
     ObjPresentacion.UnidadMedidaID  = CboUM.SelectedValue.ToString();
     ObjPresentacion.UsuarioID       = AppSettings.UserID;
 }
Пример #5
0
        //Metodo eliminar presentacion
        public void EliminarRegistro(E_Presentacion Presentacion)
        {
            SqlCommand SqlCmd = new SqlCommand("sp_eliminar_presentacion", Conectar)
            {
                CommandType = CommandType.StoredProcedure
            };

            Conectar.Open();

            SqlCmd.Parameters.AddWithValue("@id", Presentacion.Id_presentacion);

            SqlCmd.ExecuteNonQuery();

            Conectar.Close();
        }
Пример #6
0
        //Metodo Agregar Presentacion
        public void InsertarRegistro(E_Presentacion Presentacion)
        {
            SqlCommand SqlCmd = new SqlCommand("sp_insertar_presentacion", Conectar)
            {
                CommandType = CommandType.StoredProcedure
            };

            Conectar.Open();

            SqlCmd.Parameters.AddWithValue("@nombre", Presentacion.Nombre);
            SqlCmd.Parameters.AddWithValue("@descripcion", Presentacion.Descripcion);

            SqlCmd.ExecuteNonQuery();

            Conectar.Close();
        }
Пример #7
0
 public void EliminarRegistro(E_Presentacion Presentacion)
 {
     Obj.EliminarRegistro(Presentacion);
 }
Пример #8
0
 public void EditarRegistro(E_Presentacion Presentacion)
 {
     Obj.EditarRegistro(Presentacion);
 }
Пример #9
0
 public void InsertarRegistro(E_Presentacion Presentacion)
 {
     Obj.InsertarRegistro(Presentacion);
 }
Пример #10
0
        public void UpdatePresentacion(E_Presentacion ObjPresentacion, string Tipo)
        {
            CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString);

            ObjCD_Producto.UpdatePresentacion(ObjPresentacion, Tipo);
        }