Example #1
0
        public SG_PERSONA_VIAJES entity(FormCollection form)
        {
            SG_PERSONA_VIAJES entity = new SG_PERSONA_VIAJES();

            entity.I_COD_PAIS           = Convert.ToInt32(form["clsPais.I_COD_PAIS"]);
            entity.C_COD_PERSONA        = form["clsPeopleTravel.C_COD_PERSONA"];
            entity.I_AÑO                = Convert.ToInt32(form["clsPeopleTravel.I_AÑO"]);
            entity.V_TIEMPO_PERMANENCIA = form["clsPeopleTravel.V_TIEMPO_PERMANENCIA"];
            entity.V_DES_MOTIVO         = form["clsPeopleTravel.V_DES_MOTIVO"];
            entity.I_COD_PERSONA_VIAJES = Convert.ToInt32(form["clsPeopleTravel.I_COD_PERSONA_VIAJES"]);
            return(entity);
        }
        public int registerPeopleTravels(SG_PERSONA_VIAJES entity)
        {
            Database db        = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"]);
            int      resultado = 0;


            using (DbConnection cone = db.CreateConnection())
            {
                cone.Open();
                using (DbTransaction trans = cone.BeginTransaction())
                {
                    try
                    {
                        DbCommand cmd = db.GetStoredProcCommand("[SG_SP_REGISTRAR_VIAJES_X_PERSONA]");
                        db.AddInParameter(cmd, "I_COD_PAIS", DbType.Int32, entity.I_COD_PAIS);
                        db.AddInParameter(cmd, "C_COD_PERSONA", DbType.String, entity.C_COD_PERSONA);
                        db.AddInParameter(cmd, "I_AÑO", DbType.Int32, entity.I_AÑO);
                        db.AddInParameter(cmd, "V_TIEMPO_PERMANENCIA", DbType.String, entity.V_TIEMPO_PERMANENCIA);
                        db.AddInParameter(cmd, "V_DES_MOTIVO", DbType.String, entity.V_DES_MOTIVO);
                        resultado = Convert.ToInt32(db.ExecuteNonQuery(cmd, trans));
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();

                        throw new Exception(ex.Message);
                    }
                    finally
                    {
                        if (cone.State == ConnectionState.Open)
                        {
                            cone.Close();
                        }
                    }
                }
                return(resultado);
            }
        }
Example #3
0
 public int actualizarPeopleTravels(SG_PERSONA_VIAJES entity)
 {
     return(new peopleTravelDA().actualizarPeopleTravels(entity));
 }
Example #4
0
        public ActionResult registerPeopleTravels(FormCollection form)
        {
            SG_PERSONA_VIAJES entity = this.entity(form);

            return(Json(peopleTravelRepository.registerPeopleTravels(entity)));
        }
Example #5
0
 public int registerPeopleTravels(SG_PERSONA_VIAJES entity)
 {
     return(new peopleTravelDA().registerPeopleTravels(entity));
 }