Example #1
0
 //________________________________________________________________________________________________________
 public static void SavePersona(PersonaDto persona)
 {
     PersonaDb.GrabarPersonas(ref persona);
 }
Example #2
0
        //________________________________________________________________________________________________________
        // SavePersona
        public static void GrabarPersonas(ref PersonaDto persona)
        {
            //#region Insert New Persona
            //OracleCommand cmd = new OracleCommand();
            //try
            //{
            //    ------------------------------------------------------------------------------
            //     Consulta Text
            //    ------------------------------------------------------------------------------
                var querystring = "INSERT INTO PERSONA ( psnNombre) VALUES (:psnNombre)";
                var cmd = new OracleCommand(querystring);
                cmd.Connection = GetConn();
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new OracleParameter(":psnNombre", persona.PsnNombre));

                //------------------------------------------------------------------------------
                // Consulta StoredProcedure
                //------------------------------------------------------------------------------
                //cmd.Connection = GetConn();
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.CommandText = "PKG_PERSONA.InsertPersona";

                //cmd.Parameters.Add(CreateParameter("psn_tpdId", Persona.psn_tpdId));//NUMBER
                //cmd.Parameters.Add(CreateParameter("psnNroDcto", Persona.psnNroDcto));//NUMBER
                //cmd.Parameters.Add(CreateParameter("psnNombre", Persona.psnNombre, 45));//VARCHAR
                //cmd.Parameters.Add(CreateParameter("psnApellido", Persona.psnApellido, 45));//VARCHAR
                //cmd.Parameters.Add(CreateParameter("psnFechaNac", Persona.psnFechaNac, 12));//VARCHAR
                //cmd.Parameters.Add(CreateParameter("psnTelefono", Persona.psnTelefono, 20));//VARCHAR
                //cmd.Parameters.Add(CreateParameter("psnSexo", Persona.psnSexo, 1));//VARCHAR
                //cmd.Parameters.Add(CreateParameter("psn_domId", Persona.psn_domId));//NUMBER

                // Run the command.
                cmd.Connection.Open();
                cmd.ExecuteNonQuery();
            //}
            //catch(Exception ex)
            //{
            //    throw ex;
            //}
            //finally
            //{
            //    cmd.Connection.Close();
            //}
            //#endregion

            /*
            if (Persona.IsNew)
            {
                cmd = GetDbSprocCommand("usp_Persona_Insert");
                cmd.Parameters.Add(CreateOutputParameter("@psnId", OracleDbType.Int16));
            }
            else
            {
                cmd = GetDbSprocCommand("usp_Persona_Update");
                cmd.Parameters.Add(CreateParameter("@psnId", Persona.psnId));
            }

            cmd.Parameters.Add(CreateParameter("@psn_tpdId", Persona.psn_tpdId));//NUMBER
            cmd.Parameters.Add(CreateParameter("@psnNroDcto", Persona.psnNroDcto));//NUMBER
            cmd.Parameters.Add(CreateParameter("@psnNombre", Persona.psnNombre,45));//VARCHAR
            cmd.Parameters.Add(CreateParameter("@psnApellido", Persona.psnApellido, 45));//VARCHAR
            cmd.Parameters.Add(CreateParameter("@psnFechaNac", Persona.psnFechaNac, 12));//VARCHAR
            cmd.Parameters.Add(CreateParameter("@psnTelefono", Persona.psnTelefono, 20));//VARCHAR
            cmd.Parameters.Add(CreateParameter("@psn_sexId", Persona.psn_sexId, 1));//VARCHAR
            cmd.Parameters.Add(CreateParameter("@psn_domId", Persona.psn_domId));//NUMBER

            // Run the command.
            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
             * */
        }