Esempio n. 1
0
        public ActionResult _register(FormCollection form)
        {
            RRHH_PERSONA_DOMICILIO entity = new RRHH_PERSONA_DOMICILIO();

            entity.C_COD_PERSONA        = form["codPersona"].ToString();
            entity.I_COD_PAIS           = Convert.ToInt32(form["I_COD_PAIS"].ToString());
            entity.C_COD_DEPARTAMENTO   = form["C_COD_DEPARTAMENTO"].ToString();
            entity.C_COD_PROVINCIA      = form["C_COD_PROVINCIA"].ToString();
            entity.C_COD_DISTRITO       = form["C_COD_DISTRITO"].ToString();
            entity.V_DES_DIRECCION      = form["V_DES_DIRECCION"].ToString();
            entity.V_DES_URBANIZACION   = form["V_DES_URBANIZACION"].ToString();
            entity.I_COD_TIPO_DOMICILIO = Convert.ToInt32(form["I_COD_TIPO_DOMICILIO"].ToString());
            entity.V_GEO_LOCALIZACION   = DbGeography.FromText("POINT(" + form["longitude"] + " " + form["latitude"] + ")");
            var resultado = IPeopleDomicilio.registrarDomicilio(entity);

            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult _actualizar(FormCollection form)
        {
            RRHH_PERSONA_DOMICILIO entity = new RRHH_PERSONA_DOMICILIO();

            entity.I_COD_PERSONA_DOMICILIO = Convert.ToInt32(form["I_COD_PERSONA_DOMICILIO"].ToString());
            entity.C_COD_PERSONA           = form["codPersona"].ToString();
            entity.I_COD_PAIS           = Convert.ToInt32(form["I_COD_PAIS"].ToString());
            entity.C_COD_DEPARTAMENTO   = form["C_COD_DEPARTAMENTO"].ToString();
            entity.C_COD_PROVINCIA      = form["C_COD_PROVINCIA"].ToString();
            entity.C_COD_DISTRITO       = form["C_COD_DISTRITO"].ToString();
            entity.V_DES_DIRECCION      = form["V_DES_DIRECCION"].ToString();
            entity.V_DES_URBANIZACION   = form["V_DES_URBANIZACION"].ToString();
            entity.I_COD_TIPO_DOMICILIO = Convert.ToInt32(form["I_COD_TIPO_DOMICILIO"].ToString());

            var resultado = IPeopleDomicilio.actualizarPersonaDomicilio(entity);

            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
        public int actualizarPersonaDomicilio(RRHH_PERSONA_DOMICILIO 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("RRHH_ACTUALIZAR_PERSONA_DOMICILIO");
                        db.AddInParameter(cmd, "I_COD_PERSONA_DOMICILIO", DbType.Int32, entity.I_COD_PERSONA_DOMICILIO);
                        db.AddInParameter(cmd, "I_COD_PAIS", DbType.Int32, entity.I_COD_PAIS);
                        db.AddInParameter(cmd, "C_COD_DEPARTAMENTO", DbType.String, entity.C_COD_DEPARTAMENTO);
                        db.AddInParameter(cmd, "C_COD_PROVINCIA", DbType.String, entity.C_COD_PROVINCIA);
                        db.AddInParameter(cmd, "C_COD_DISTRITO", DbType.String, entity.C_COD_DISTRITO);
                        db.AddInParameter(cmd, "V_DES_DIRECCION", DbType.String, entity.V_DES_DIRECCION);
                        db.AddInParameter(cmd, "V_DES_URBANIZACION", DbType.String, entity.V_DES_URBANIZACION);
                        db.AddInParameter(cmd, "I_COD_TIPO_DOMICILIO", DbType.Int32, entity.I_COD_TIPO_DOMICILIO);
                        db.AddInParameter(cmd, "V_GEO_LOCALIZACION", DbType.String, "");
                        resultado = Convert.ToInt32(db.ExecuteNonQuery(cmd, trans));
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                    }
                    finally
                    {
                        if (cone.State == ConnectionState.Open)
                        {
                            cone.Close();
                        }
                    }
                }


                return(resultado);
            }
        }
        public int registrarDomicilio(RRHH_PERSONA_DOMICILIO entity)
        {
            int      resultado = 0;
            Database db        = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"]);

            using (DbConnection cone = db.CreateConnection())
            {
                cone.Open();
                using (DbTransaction trans = cone.BeginTransaction())
                {
                    try
                    {
                        DbCommand cmd = db.GetStoredProcCommand("RRHH_SP_REGISTRAR_DOMICILIO");
                        db.AddInParameter(cmd, "C_COD_PERSONA", DbType.String, entity.C_COD_PERSONA);
                        db.AddInParameter(cmd, "I_COD_PAIS", DbType.String, entity.I_COD_PAIS);
                        db.AddInParameter(cmd, "C_COD_DEPARTAMENTO", DbType.String, entity.C_COD_DEPARTAMENTO);
                        db.AddInParameter(cmd, "C_COD_PROVINCIA", DbType.String, entity.C_COD_PROVINCIA);
                        db.AddInParameter(cmd, "C_COD_DISTRITO", DbType.String, entity.C_COD_DISTRITO);
                        db.AddInParameter(cmd, "V_DES_DIRECCION", DbType.String, entity.V_DES_DIRECCION);
                        db.AddInParameter(cmd, "V_DES_URBANIZACION", DbType.String, entity.V_DES_URBANIZACION);
                        db.AddInParameter(cmd, "I_COD_TIPO_DOMICILIO", DbType.String, entity.I_COD_TIPO_DOMICILIO);
                        db.AddInParameter(cmd, "V_GEO_LOCALIZACION", DbType.String, "POINT(" + entity.V_GEO_LOCALIZACION.Longitude.ToString().Replace(",", ".") + " " + entity.V_GEO_LOCALIZACION.Latitude.ToString().Replace(",", ".") + ")");
                        resultado = db.ExecuteNonQuery(cmd, trans);
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                    }
                    finally
                    {
                        if (cone.State == ConnectionState.Open)
                        {
                            cone.Close();
                        }
                    }
                }
            }
            return(resultado);
        }
        public RRHH_PERSONA_DOMICILIO detalleDomicilioPersonaForID(int codPersonaDomicilio)
        {
            RRHH_PERSONA_DOMICILIO entity = new RRHH_PERSONA_DOMICILIO();

            Database  db  = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"]);
            DbCommand cmd = db.GetStoredProcCommand("RRHH_DETALLE_DOMICILIO_X_ID_PERSONA_DOMICILIO");

            db.AddInParameter(cmd, "I_COD_PERSONA_DOMICILIO", DbType.Int32, codPersonaDomicilio);
            using (IDataReader lee = db.ExecuteReader(cmd))
            {
                lee.Read();
                entity.I_COD_PERSONA_DOMICILIO = Convert.ToInt32(lee["I_COD_PERSONA_DOMICILIO"].ToString());
                entity.C_COD_PERSONA           = lee["C_COD_PERSONA"].ToString();
                entity.I_COD_PAIS           = Convert.ToInt32(lee["I_COD_PAIS"]);
                entity.C_COD_DEPARTAMENTO   = lee["C_COD_DEPARTAMENTO"].ToString();
                entity.C_COD_PROVINCIA      = lee["C_COD_PROVINCIA"].ToString();
                entity.C_COD_DISTRITO       = lee["C_COD_DISTRITO"].ToString();
                entity.V_DES_DIRECCION      = lee["V_DES_DIRECCION"].ToString();
                entity.V_DES_URBANIZACION   = lee["V_DES_URBANIZACION"].ToString();
                entity.I_COD_TIPO_DOMICILIO = Convert.ToInt32(lee["I_COD_TIPO_DOMICILIO"]);
                entity.V_GEO_LOCALIZACION   = DbGeography.FromText(lee["V_GEO_LOCALIZACION"].ToString());
            }
            return(entity);
        }
Esempio n. 6
0
 public int registrarDomicilio(RRHH_PERSONA_DOMICILIO entity)
 {
     return(new peopleDomicilioDA().registrarDomicilio(entity));
 }
Esempio n. 7
0
 public int actualizarPersonaDomicilio(RRHH_PERSONA_DOMICILIO entity)
 {
     return(new peopleDomicilioDA().actualizarPersonaDomicilio(entity));
 }