Ejemplo n.º 1
0
 public void Borrar(DO.Persona persona)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope())
         {
             DAL.Mantenimiento.Instancia.Borrar(persona);
             scope.Complete();
         }
     }
     catch (Exception ee)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        public void Insertar(DO.Persona persona)
        {
            DbProviderFactory factory = DbProviderFactories.GetFactory(Settings.Default.proveedor);

            DbConnection conn = null;

            DbCommand comm = null;



            try
            {
                conn = factory.CreateConnection();

                conn.ConnectionString = Settings.Default.connection;

                comm = factory.CreateCommand();



                DbParameter param1 = factory.CreateParameter();

                DbParameter param2 = factory.CreateParameter();

                DbParameter param3 = factory.CreateParameter();

                DbParameter param4 = factory.CreateParameter();

                DbParameter param5 = factory.CreateParameter();

                // DbParameter param6 = factory.CreateParameter();



                //Carga de Parametros

                /*param1.ParameterName = "@iCedula";
                 *
                 * param1.DbType = System.Data.DbType.Int32;
                 *
                 * param1.Value = persona.ICedula;*/



                param1.ParameterName = "@vNombre";

                param1.DbType = System.Data.DbType.String;

                param1.Value = persona.VNombre;



                param2.ParameterName = "@bMuerto";

                param2.DbType = System.Data.DbType.Boolean;

                param2.Value = persona.BMuerto;



                param3.ParameterName = "@dtNacimiento";

                param3.DbType = System.Data.DbType.Date;

                param3.Value = persona.DTNacimiento;



                param4.ParameterName = "@iEdad";

                param4.DbType = System.Data.DbType.Int32;

                param4.Value = persona.IEdad;



                param5.ParameterName = "@vEmail";

                param5.DbType = System.Data.DbType.String;

                param5.Value = persona.VEmail;



                //Abrir Coneccion

                comm.Connection = conn;

                conn.Open();



                //Ejecutar Store Procedure

                comm.CommandType = System.Data.CommandType.StoredProcedure;

                comm.CommandText = "sp_insertar_identity";

                comm.Parameters.Add(param1);

                comm.Parameters.Add(param2);

                comm.Parameters.Add(param3);

                comm.Parameters.Add(param4);

                comm.Parameters.Add(param5);

                //comm.Parameters.Add(param6);

                comm.ExecuteNonQuery();
            }

            catch (Exception ee)
            {
                throw;
            }

            finally
            {
                comm.Dispose();

                conn.Dispose();
            }
        }
Ejemplo n.º 3
0
        public void Borrar(DO.Persona persona)
        {
            DbProviderFactory factory = DbProviderFactories.GetFactory(Settings.Default.proveedor);

            DbConnection conn = null;

            DbCommand comm = null;



            try
            {
                conn = factory.CreateConnection();

                conn.ConnectionString = Settings.Default.connection;

                comm = factory.CreateCommand();



                DbParameter param1 = factory.CreateParameter();



                //Carga de Parametros

                param1.ParameterName = "@iCedula";

                param1.DbType = System.Data.DbType.Int32;

                param1.Value = persona.ICedula;


                //Abrir Coneccion

                comm.Connection = conn;

                conn.Open();



                //Ejecutar Store Procedure

                comm.CommandType = System.Data.CommandType.StoredProcedure;

                comm.CommandText = "sp_Eliminar";

                comm.Parameters.Add(param1);

                comm.ExecuteNonQuery();
            }

            catch (Exception ee)
            {
                throw;
            }

            finally
            {
                comm.Dispose();

                conn.Dispose();
            }
        }