示例#1
0
        public void UpdateGenerico(E_Generico ObjGenerico, 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_UpdateGenerico]");
                SqlClient.AddInParameter(SqlCommand, "@GenericoID", SqlDbType.Char, ObjGenerico.GenericoID);
                SqlClient.AddInParameter(SqlCommand, "@NomGenerico", SqlDbType.VarChar, ObjGenerico.NomGenerico);
                SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjGenerico.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 InsertGenerico(E_Generico ObjGenerico)
        {
            string      GenericoID = "";
            SqlDatabase SqlClient  = new SqlDatabase(connectionString);

            DbConnection tCnn;

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

            DbTransaction tran = tCnn.BeginTransaction();

            try
            {
                DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_InsertGenerico]");
                SqlClient.AddInParameter(SqlCommand, "@NomGenerico", SqlDbType.VarChar, ObjGenerico.NomGenerico);
                SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjGenerico.UsuarioID);

                GenericoID = 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(GenericoID);
        }
示例#3
0
 private void ObtenerDatosControles()
 {
     ObjGenerico             = new E_Generico();
     ObjGenerico.GenericoID  = TxtGenericoID.Text;
     ObjGenerico.NomGenerico = TxtNomGenerico.Text;
     ObjGenerico.UsuarioID   = AppSettings.UserID;
 }
示例#4
0
        public string InsertGenerico(E_Generico ObjGenerico)
        {
            string      GenericoID     = "";
            CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString);

            GenericoID = ObjCD_Producto.InsertGenerico(ObjGenerico);
            return(GenericoID);
        }
示例#5
0
        public void UpdateEnvase(E_Generico ObjGenerico, string Tipo)
        {
            CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString);

            ObjCD_Producto.UpdateGenerico(ObjGenerico, Tipo);
        }