Exemple #1
0
 public bool read()
 {
     try
     {
         Datos.ANFITRION anfitrion = null;
         anfitrion = CommonBC.ModeloCEM.ANFITRION.Where(a => a.ID_TRIBUTARIO.Equals(this.Id_tributario)).FirstOrDefault();
         if (anfitrion != null)
         {
             this.Id_anfitrion        = (int)anfitrion.ID_ANFITRION;
             this.Nombre              = anfitrion.NOMBRES_RESPONSABLE;
             this.APaterno            = anfitrion.A_PATERNO_RESPONSABLE;
             this.AMaterno            = anfitrion.A_MATERNO_RESPONSABLE;
             this.Fecha_nac           = anfitrion.FECHA_NAC;
             this.Tel_movil           = anfitrion.TELEFONO_MOVIL;
             this.Tel_hogar           = anfitrion.TELEFONO_HOGAR;
             this.Email               = anfitrion.EMAIL;
             this.Direccion           = anfitrion.DIRECCION;
             this.Estado_antecedentes = anfitrion.ESTADO_ANTECEDENTES;
             this.Cupos_alojamiento   = (int)anfitrion.CUPOS_ALOJAMIENTO;
             this.Fecha_antecedentes  = anfitrion.FECHA_ANTECEDENTES;
             this.Id_Ciudad           = (int)anfitrion.ID_CIUDAD;
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #2
0
        public string crud(int accion)
        {
            try
            {
                System.Data.Objects.ObjectParameter myOutputParamString = new System.Data.Objects.ObjectParameter("vRESPUESTA", typeof(string));
                CommonBC.ModeloCEM.PROC_CRUDANFITRION(this.Id_tributario, this.Nombre, this.APaterno, this.AMaterno, this.Fecha_nac, this.Tel_movil, this.Tel_hogar, this.Email, this.Direccion,
                                                      this.Estado_antecedentes, this.Cupos_alojamiento, this.Fecha_antecedentes, this.Id_Ciudad, accion, myOutputParamString);
                if (accion == 2)
                {
                    Datos.ANFITRION anfitrion = null;
                    anfitrion = CommonBC.ModeloCEM.ANFITRION.Where(a => a.ID_TRIBUTARIO == this.Id_tributario).FirstOrDefault();
                    anfitrion.NOMBRES_RESPONSABLE   = this.Nombre;
                    anfitrion.A_PATERNO_RESPONSABLE = this.APaterno;
                    anfitrion.A_MATERNO_RESPONSABLE = this.AMaterno;
                    anfitrion.FECHA_NAC             = this.Fecha_nac;
                    anfitrion.TELEFONO_MOVIL        = this.Tel_movil;
                    anfitrion.TELEFONO_HOGAR        = this.Tel_hogar;
                    anfitrion.EMAIL               = this.Email;
                    anfitrion.DIRECCION           = this.Direccion;
                    anfitrion.ESTADO_ANTECEDENTES = this.Estado_antecedentes;
                    anfitrion.CUPOS_ALOJAMIENTO   = this.Cupos_alojamiento;
                    anfitrion.FECHA_ANTECEDENTES  = this.Fecha_antecedentes;
                    anfitrion.ID_CIUDAD           = this.Id_Ciudad;

                    CommonBC.ModeloCEM.SaveChanges();
                }
                else if (accion == 3)
                {
                    Datos.ANFITRION anfitrion = null;
                    anfitrion = CommonBC.ModeloCEM.ANFITRION.Where(a => a.ID_TRIBUTARIO == this.Id_tributario).FirstOrDefault();
                    anfitrion.CUPOS_ALOJAMIENTO = 0;

                    CommonBC.ModeloCEM.SaveChanges();
                }

                return(Convert.ToString(myOutputParamString.Value));
            }
            catch (Exception e)
            {
                return("Error: " + e);
            }
        }