public void Actualizar(IEntidad entidad)
        {
            clsProfesor profesor = new clsProfesor();

            try
            {
                profesor = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            int filas;

            try
            {
                filas = manager.UpdateProfesor(profesor);
                if (filas == 0)
                {
                    throw new ArgumentException("El profesor no existe");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Borrar(IEntidad entidad)
        {
            clsNota nota = new clsNota();

            try
            {
                nota = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            int filas;

            try
            {
                filas = manager.DeleteNota(nota);
                if (filas == 0)
                {
                    throw new ArgumentException("La nota no existe");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsCurso curso = new clsCurso();

            try
            {
                curso = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            clsCurso compare = new clsCurso();
            compare.Nombre = curso.Nombre;

            try
            {
                if (manager.SelectCurso(compare).Count == 0 && curso.FechaInicio < curso.FechaFin)
                    manager.InsertCurso(curso);
                else
                    throw new ArgumentException("El Curso ingresado ya existe o es invalido");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Alta(IEntidad entidad)
        {
            clsHorario ent = (clsHorario)entidad;
            DataTable aux = new DataTable();

            try
            {
                 aux = manager.consultar("select * from horarioTarde where idmedico=" + ent.IdMedico);

                 if (aux.Rows.Count == 0)
                 {
                     manager.ejecutar("Insert into horarioTarde(idmedico,lunesentrada,lunessalida,martesentrada,martessalida,miercolesentrada,miercolessalida,juevesentrada,juevessalida,viernesentrada,viernessalida,sabadoentrada,sabadosalida,domingoentrada,domingosalida) values(" + ent.IdMedico + ",'" + ent.LunesEntrada + "','" + ent.LunesSalida + "','" + ent.MartesEntrada + "','" + ent.MartesSalida + "','" + ent.MiercolesEntrada + "','" + ent.MiercolesSalida + "','" + ent.JuevesEntrada + "','" + ent.JuevesSalida + "','" + ent.ViernesEntrada + "','" + ent.ViernesSalida + "','" + ent.SabadoEntrada + "','" + ent.SabadoSalida + "','" + ent.DomingoEntrada + "','" + ent.DomingoSalida + "')");
                 }
                 else
                 {
                     if (Convert.ToInt32(aux.Rows[0]["activo"]) == 0)
                     {
                         manager.ejecutar("update horarioTarde set activo=1 where idmedico=" + ent.IdMedico);
                         manager.ejecutar("update horarioTarde set lunesentrada='" + ent.LunesEntrada + "',lunessalida='" + ent.LunesSalida + "',martesentrada='" + ent.MartesEntrada + "',martessalida='" + ent.MartesSalida + "',miercolesentrada='" + ent.MiercolesEntrada + "',miercolessalida='" + ent.MiercolesSalida + "',juevesentrada='" + ent.JuevesEntrada + "',juevessalida='" + ent.JuevesSalida + "',viernesentrada='" + ent.ViernesEntrada + "',viernessalida='" + ent.ViernesSalida + "',sabadoentrada='" + ent.SabadoEntrada + "',sabadosalida='" + ent.SabadoSalida + "',domingoentrada='" + ent.DomingoEntrada + "',domingosalida='" + ent.DomingoSalida + "' where idmedico=" + ent.IdMedico);

                     }
                 }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsNota nota = new clsNota();

            try
            {
                nota = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            clsNota compare = new clsNota();
            compare.IdAlumno = nota.IdAlumno;
            compare.IdCurso = nota.IdCurso;

            try
            {
                if (manager.SelectNota(compare).Count == 0)
                    manager.InsertarNota(nota);
                else
                    throw new ArgumentException("Esta nota ya fue registrada");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Borrar(IEntidad entidad)
        {
            clsAdministrador administrador = new clsAdministrador();

            try
            {
                administrador = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            int filas;

            try
            {
                filas = manager.DeleteAdministrador(administrador);
                if (filas == 0)
                {
                    throw new ArgumentException("El usuario no existe");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemple #7
0
        public void Alta(IEntidad entidad)
        {
            clsPacienteDatos pac = (clsPacienteDatos)entidad;
            DataTable aux = new DataTable();
            try
            {
                aux = manager.consultar("select * from paciente where dni=" + pac.Dni);
                if (aux.Rows.Count == 0)
                {
                    manager.ejecutar("Insert into paciente(nombre,apellido,dni,obra,telefono) values('" + pac.Nombre + "','" + pac.Apellido + "'," + pac.Dni + "," + pac.ObraSocial + "," + pac.Telefono + ");SELECT @@identity;");
                }
                else
                {
                    if (Convert.ToInt32(aux.Rows[0]["activo"]) == 0)
                    {
                        manager.ejecutar("update paciente set activo=1 where dni=" + pac.Dni);
                        manager.ejecutar("update paciente set nombre='" + pac.Nombre + "'," + "apellido='" + pac.Apellido + "'," + "dni=" + pac.Dni + "," + "obra='" + pac.ObraSocial + "'," + "telefono=" + pac.Telefono + " where dni=" + pac.Dni);
                    }
                }
                //manager.ejecutar("update paciente set nombre='" + pac.Nombre + "'," + "apellido='" + pac.Apellido + "'," + "dni=" + pac.Dni + "," + "obra='" + pac.ObraSocial + "'," + "telefono=" + pac.Telefono);
            //execute scalar 
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }
Exemple #8
0
        public void Alta(IEntidad entidad)
        {
            clsMedicoDatos med = (clsMedicoDatos)entidad;
            DataTable aux= new DataTable();
            try
            {
                aux=manager.consultar("select * from medico where dni="+med.Dni);
                if(aux.Rows.Count==0)
                {
                manager.ejecutar("Insert into medico(nombre,apellido,dni,especialidad,matricula) values('" + med.Nombre + "','" + med.Apellido + "'," + med.Dni + "," + med.Especialidad + "," + med.Matricula + ");SELECT @@identity;");
                }
                else
                {
                    manager.ejecutar("update medico set activo=1 where dni="+med.Dni);
                    manager.ejecutar("update medico set nombre=" + med.Nombre + ",apellido=" + med.Apellido + ",dni=" + med.Dni + ",especialidad=" + med.Especialidad + ",matricula=" + med.Matricula + "where dni=" + med.Dni);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsAdministrador administrador = new clsAdministrador();

            try
            {
                administrador = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            clsAdministrador compare = new clsAdministrador();
            compare.Usuario = administrador.Usuario;

            try
            {
                if (manager.SelectAdministrador(compare).Count == 0)
                {
                    manager.InsertAdministrador(administrador);
                }
                else
                    throw new ArgumentException("Ese nombre de usuario ya esta en uso");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsAlumno alumno = new clsAlumno();

            try
            {
                alumno = getCast(entidad);
            }
            catch(Exception e)
            {
                throw e;
            }

            clsAlumno compare = new clsAlumno();
            compare.Dni = alumno.Dni;

            try
            {
                if (manager.SelectAlumno(compare).Count == 0)
                    manager.InsertAlumno(alumno);
                else
                    throw new ArgumentException("El Alumno ingresado ya existe");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Actualizar(IEntidad entidad)
        {
            clsAlumno alumno = new clsAlumno();

            try
            {
                alumno = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            int filas;

            try
            {
                filas = manager.UpdateAlumno(alumno);
                if (filas == 0)
                {
                    throw new ArgumentException("El alumno no existe");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsProfesor profesor = new clsProfesor();

            try
            {
                profesor = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            clsProfesor compare = new clsProfesor();
            compare.Dni = profesor.Dni;

            try
            {
                if (manager.SelectProfesor(compare).Count == 0)
                    manager.InsertarProfesor(profesor);
                else
                    throw new ArgumentException("El Profesor ingresado ya existe");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Agregar(IEntidad entidad)
        {
            clsCuota cuota = new clsCuota();

            try
            {
                cuota = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }
            clsCuota compare = new clsCuota();
            compare.IdAlumno = cuota.IdAlumno;
            compare.IdCurso = cuota.IdCurso;
            try
            {
                if (manager.SelectCuota(compare).Count == 0)
                    cuota.Id = manager.InsertarCuota(cuota);
                else
                    throw new ArgumentException("Esta deuda ya existe");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void Borrar(IEntidad entidad)
        {
            clsCuota cuota = new clsCuota();

            try
            {
                cuota = getCast(entidad);
            }
            catch (Exception e)
            {
                throw e;
            }

            int filas;

            try
            {
                filas = manager.DeleteCuota(cuota);
                if (filas == 0)
                {
                    throw new ArgumentException("La deuda ingresada no existe o ya fue pagada");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public void Alta(IEntidad obraSocial)
 {            
     try
     {
         manejaOs.Alta(obraSocial);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
Exemple #16
0
 public void Alta(IEntidad clinica)
 {
     try
     {
         manejaclinica.Alta(clinica);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
 }
Exemple #17
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            IEntidad entidad = obj as IEntidad;

            return(entidad.Id == this.Id);
        }
Exemple #18
0
 public void Baja(IEntidad entidad)
 {
     clsHorario esp = (clsHorario)entidad;
     try
     {
         manager.ejecutar("update horarioTarde set activo=0 where idmedico=" + esp.IdMedico);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #19
0
 public void Modificacion(IEntidad entidad)
 {
     clsTurno tur = (clsTurno)entidad;
     try
     {
         manager.ejecutar("update turno set idpaciente=" + tur.IdPaciente + ",idmedico=" + tur.IdMedico + ",fecha='" + tur.Fecha + "',costo=" + tur.Costo.ToString().Replace(',', '.') + ",estado=" + tur.Estado + ",idusuario= " + tur.IdUsuario + "where id=" + tur.Id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #20
0
 public void Modificacion(IEntidad entidad)
 {
     clsHistorial hist = (clsHistorial)entidad;
     try
     {
         manager.ejecutar("update historial set diagnostico='" + hist.Diagnostico + "',observaciones='" + hist.Observaciones + "',fecha='" + hist.Fecha + "'where id=" + hist.Id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #21
0
 public void Alta(IEntidad entidad)
 {
     clsHistorial hist = (clsHistorial)entidad;
     try
     {
         manager.ejecutar("Insert into historial(idpaciente,diagnostico,observaciones,fecha) values(" + hist.Id + ",'" + hist.Diagnostico + "','" + hist.Observaciones + "','" + hist.Fecha +"')");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #22
0
 public void Baja(IEntidad entidad)
 {
     clsHistorial hist = (clsHistorial)entidad;
     try
     {
         manager.ejecutar("update historial set activo=0 where idpaciente=" + hist.Id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void Baja(IEntidad entidad)
 {
     clsMedico med = (clsMedico)entidad;
     try
     {
         manejar.Ejecutar("delete from  medico where idmedico="+med.Id);
     }
     catch(SqlException ex)
     {
         throw ex;
     }
 }
 public void Modificacion(IEntidad entidad)
 {
     clsPaciente pac = (clsPaciente)entidad;
     try
     {
         manejar.Ejecutar("update paciente set apellido='" + pac.Apellido + "',nombre='" + pac.Nombre + "',dni=" + pac.Dni + "',telefono=" + " where idpaciente=" + pac.Id);
     }
     catch(SqlException ex)
     {
         throw ex;
     }
 }
Exemple #25
0
 public void Modificacion(IEntidad entidad)
 {
     clsHorario esp = (clsHorario)entidad;
     try
     {
         manager.ejecutar("update horarioTarde set lunesentrada='" + esp.LunesEntrada+"',lunessalida='"+esp.LunesSalida+"',martesentrada='"+esp.MartesEntrada+"',martessalida='"+esp.MartesSalida+"',miercolesentrada='"+esp.MiercolesEntrada+"',miercolessalida='"+esp.MiercolesSalida+"',juevesentrada='"+esp.JuevesEntrada+"',juevessalida='"+esp.JuevesSalida+"',viernesentrada='"+esp.ViernesEntrada+"',viernessalida='"+esp.ViernesSalida+"',sabadoentrada='"+esp.SabadoEntrada+"',sabadosalida='"+esp.SabadoSalida+"',domingoentrada='"+esp.DomingoEntrada+"',domingosalida='"+esp.DomingoSalida+"' where idmedico="+esp.IdMedico);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void Alta(IEntidad entidad)
 {
     clsPaciente pac = (clsPaciente)entidad;
     try
     {
         manejar.Ejecutar("insert into paciente (nombre,apellido,dni,telefono) values('" + pac.Nombre + "','" + pac.Apellido + "'," + pac.Dni + "," +pac.Telefono+ ");SELECT @@identity;");
     }
     catch( SqlException ex)
     {
         throw ex;
     }
 }
 public void Baja(IEntidad entidad)
 {
     clsObraXMedico ob = (clsObraXMedico)entidad;
     try
     {
         manager.ejecutar("update obraXmedico set activo=0 where idmedico=" + ob.IdMedico+"and idobra="+ob.IdObra);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #28
0
 public void Baja(IEntidad entidad)
 {
     clsPlanesXObra ob = (clsPlanesXObra)entidad;
     try
     {
         manager.ejecutar("update planesxobra set activo=0 where nombreplan='" + ob.NombrePlan + "' and idobra=" + ob.IdObra);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void Baja(IEntidad entidad)
 {
     clsPaciente pac = (clsPaciente)entidad;
     try
     {
         manejar.Ejecutar("delete from  paciente where idpaciente="+pac.Id);
     }
     catch(SqlException ex)
     {
         throw ex;
     }
 }
Exemple #30
0
 public void Modificacion(IEntidad entidad)
 {
     clsEspecialidad esp = (clsEspecialidad)entidad;
     try
     {
         manager.ejecutar("update especialidad set descripcion='"+esp.Descripcion+"', canon="+esp.Canon+ "where id="+esp.Id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #31
0
 public void Alta(IEntidad entidad)
 {
     clsEspecialidad ent = (clsEspecialidad)entidad;
     try
     {
         manager.ejecutar("Insert into especialidad(descripcion,canon) values('"+ent.Descripcion+"',"+ent.Canon+");SELECT @@identity;");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public EntidadManager(DataSetFacturacionTableAdapters.clienteTableAdapter ClienteTB, DataSetFacturacion ds, DataSetFacturacionTableAdapters.pedidoTableAdapter PedidoTB, DataSetFacturacionTableAdapters.pedidos_costosTableAdapter CostosTB, DataSetFacturacionTableAdapters.ficha_costosTableAdapter FichaCostosTB)
        {
            this.ClienteTB     = ClienteTB;
            this.PedidoTB      = PedidoTB;
            this.CostosTB      = CostosTB;
            this.FichaCostosTB = FichaCostosTB;

            this.ds = ds;

            ientidad  = new EntidadAccess();
            icliente  = new ClienteAccess(ClienteTB, ds, PedidoTB, CostosTB, FichaCostosTB);
            iservicio = new ServicioAccess(ClienteTB, ds, PedidoTB, CostosTB, FichaCostosTB);
            ipedido   = new PedidoAccess(ClienteTB, ds, PedidoTB, CostosTB, FichaCostosTB);
        }
Exemple #33
0
 public EntidadController(IServiceProvider serviceProvider, IEntidad Entidad) : base(serviceProvider)
 {
     _Entidad = Entidad;
 }
Exemple #34
0
 public EntidadController(IServiceProvider serviceProvider, IEntidad Entidad, ILogger <EntidadController> logger) : base(serviceProvider)
 {
     _Entidad = Entidad;
     _logger  = logger;
 }