Пример #1
0
        /*
         * Create: Enrique Incio
         * Fecha: 2016-05-16
         * Coments: Servicio para Guardar Persona aplicando POO
         */
        public bool GuardarPersona(string cPerCodigo, string cPerApellido, string cPerNombre, int nPerTipo, DateTime dPerNacimiento, string cUbiGeoCodigo, int nUbiGeoCodigo,
                                   int nPerIdeTipo, string cPerIdeNumero,
                                   string cPerApellPaterno, string cPerApellMaterno, string cPerPriNombre, string cPerSegNombre, string cPerTerNombre, int nPerTratamiento,
                                   int nPerNatSexo, int nPerNatEstCivil = 0, int nPerNatTipResidencia = 0, int nPerNatSitLaboral = 0, int nPerNatOcupacion = 0)
        {
            bool exito = false;

            try
            {
                using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                    Persona objPersona = new Persona();

                    objPersona.cPerCodigo     = cPerCodigo;
                    objPersona.cPerApellido   = cPerApellido;
                    objPersona.cPerNombre     = cPerNombre;
                    objPersona.nPerTipo       = nPerTipo;
                    objPersona.dPerNacimiento = dPerNacimiento;
                    objPersona.cUbiGeoCodigo  = cUbiGeoCodigo;
                    objPersona.nUbiGeoCodigo  = nUbiGeoCodigo;

                    if (!Insert_Persona(objPersona))
                    {
                        throw new ApplicationException("Se encontraron errores en la transaccion: Insert_Persona.!");
                    }

                    PerIdentifica objPerIdentifica = new PerIdentifica();

                    objPerIdentifica.cPerCodigo    = cPerCodigo;
                    objPerIdentifica.nPerIdeTipo   = nPerIdeTipo;
                    objPerIdentifica.cPerIdeNumero = cPerIdeNumero;

                    if (!Insert_PerIdentifica(objPerIdentifica))
                    {
                        throw new ApplicationException("Se encontraron errores en la transaccion: Insert_PerIdentifica.!");
                    }

                    PerNatural objPerNatural = new PerNatural();

                    objPerNatural.cPerCodigo           = cPerCodigo;
                    objPerNatural.nPerNatSexo          = nPerNatSexo;
                    objPerNatural.nPerNatEstCivil      = nPerNatEstCivil;
                    objPerNatural.nPerNatTipResidencia = nPerNatTipResidencia;
                    objPerNatural.nPerNatSitLaboral    = nPerNatSitLaboral;
                    objPerNatural.nPerNatOcupacion     = nPerNatOcupacion;

                    if (!Insert_PerNatural(objPerNatural))
                    {
                        throw new ApplicationException("Se encontraron errores en la transaccion: Insert_PerNatural.!");
                    }

                    PerName objPerName = new PerName();

                    objPerName.cPerCodigo       = cPerCodigo;
                    objPerName.cPerApellPaterno = cPerApellPaterno;
                    objPerName.cPerApellMaterno = cPerApellMaterno;
                    objPerName.cPerPriNombre    = cPerPriNombre;
                    objPerName.cPerSegNombre    = cPerSegNombre;
                    objPerName.cPerTerNombre    = cPerTerNombre;
                    objPerName.nPerTratamiento  = nPerTratamiento;

                    if (!Insert_PerName(objPerName))
                    {
                        throw new ApplicationException("Se encontraron errores en la transaccion: Insert_PerName.!");
                    }

                    exito = true;

                    tx.Complete();
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(exito);
        }
Пример #2
0
        //-------------------
        //Insert PerName POO
        //-------------------
        public bool Insert_PerName(PerName Objeto)
        {
            DA_Persona Obj = new DA_Persona();

            return(Obj.Insert_PerName(Objeto));
        }