Esempio n. 1
0
 public bool CRUD_MEDICOS(Medicos_TB medicos, string accion)
 {
     try
     {
         return(BL.CRUD_MEDICOS(medicos, accion));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Este método recibe tambien la informacion de Usuario y empleado.
        /// </summary>
        /// <param name="medicos_Especialidades"></param>
        /// <param name="accion"></param>
        /// <returns></returns>
        public static bool CRUD_MEDICOS(Medicos_TB medicos, string accion)
        {
            try
            {
                List <SqlCommand> lstSentencias = new List <SqlCommand>();//Lista de sentencias a ejecutar
                AD objAcceso = new AD();

                SQLSentencias sentencia = new SQLSentencias();
                //Se crea la peticion
                sentencia.Peticion = "EXEC CRUD_MEDICOS_SP @Usuario_ID, @Password, @Tipo_Perfil, @Nombre, @Apellidos, @Fecha_Nacimiento, @Email," +
                                     "@Telefono,@Empleado_ID, @Empleado_Usuario_ID, @Numero_Carne, @Doctor_Empleado_ID, @Accion";

                //PARAMETROS DE USUARIO
                SqlParameter Usuario_ID_P = new SqlParameter();
                Usuario_ID_P.Value         = medicos.Empleados_TB.Usuarios_TB.Usuario_ID;
                Usuario_ID_P.SqlDbType     = System.Data.SqlDbType.Int;
                Usuario_ID_P.ParameterName = "@Usuario_ID";

                SqlParameter Password_P = new SqlParameter();
                Password_P.Value         = medicos.Empleados_TB.Usuarios_TB.Password;
                Password_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Password_P.ParameterName = "@Password";

                SqlParameter Tipo_Perfil_P = new SqlParameter();
                Tipo_Perfil_P.Value         = medicos.Empleados_TB.Usuarios_TB.Tipo_Perfil;
                Tipo_Perfil_P.SqlDbType     = System.Data.SqlDbType.SmallInt;
                Tipo_Perfil_P.ParameterName = "@Tipo_Perfil";

                SqlParameter Nombre_P = new SqlParameter();
                Nombre_P.Value         = medicos.Empleados_TB.Usuarios_TB.Nombre;
                Nombre_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Nombre_P.ParameterName = "@Nombre";

                SqlParameter Apellidos_P = new SqlParameter();
                Apellidos_P.Value         = medicos.Empleados_TB.Usuarios_TB.Apellidos;
                Apellidos_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Apellidos_P.ParameterName = "@Apellidos";

                SqlParameter Fecha_Nacimiento_P = new SqlParameter();
                Fecha_Nacimiento_P.Value         = medicos.Empleados_TB.Usuarios_TB.Fecha_Nacimiento;
                Fecha_Nacimiento_P.SqlDbType     = System.Data.SqlDbType.Date;
                Fecha_Nacimiento_P.ParameterName = "@Fecha_Nacimiento";

                SqlParameter Email_P = new SqlParameter();
                Email_P.Value         = medicos.Empleados_TB.Usuarios_TB.Email;
                Email_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Email_P.ParameterName = "@Email";

                SqlParameter Telefono_P = new SqlParameter();
                Telefono_P.Value         = medicos.Empleados_TB.Usuarios_TB.Telefono;
                Telefono_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Telefono_P.ParameterName = "@Telefono";

                //PARAMETROS DE EMPLEADO
                SqlParameter Empleado_ID_P = new SqlParameter();
                Empleado_ID_P.Value         = medicos.Empleados_TB.Empleado_ID;
                Empleado_ID_P.SqlDbType     = System.Data.SqlDbType.Int;
                Empleado_ID_P.ParameterName = "@Empleado_ID";

                SqlParameter Empleado_Usuario_ID_P = new SqlParameter();
                Empleado_Usuario_ID_P.Value         = medicos.Empleados_TB.Empleado_Usuario_ID;
                Empleado_Usuario_ID_P.SqlDbType     = System.Data.SqlDbType.VarChar;
                Empleado_Usuario_ID_P.ParameterName = "@Empleado_Usuario_ID";

                //PARAMETROS DE DOCTOR
                SqlParameter Numero_Carne_P = new SqlParameter();
                Numero_Carne_P.Value         = medicos.Numero_Carne;
                Numero_Carne_P.SqlDbType     = System.Data.SqlDbType.Int;
                Numero_Carne_P.ParameterName = "@Numero_Carne";

                SqlParameter Doctor_Empleado_ID_P = new SqlParameter();
                Doctor_Empleado_ID_P.Value         = medicos.Doctor_Empleado_ID;
                Doctor_Empleado_ID_P.SqlDbType     = System.Data.SqlDbType.Int;
                Doctor_Empleado_ID_P.ParameterName = "@Doctor_Empleado_ID";

                SqlParameter Accion_P = new SqlParameter();
                Accion_P.Value         = accion;
                Accion_P.SqlDbType     = System.Data.SqlDbType.Char;
                Accion_P.ParameterName = "@Accion";

                sentencia.lstParametros.Add(Usuario_ID_P);
                sentencia.lstParametros.Add(Password_P);
                sentencia.lstParametros.Add(Tipo_Perfil_P);
                sentencia.lstParametros.Add(Nombre_P);
                sentencia.lstParametros.Add(Apellidos_P);
                sentencia.lstParametros.Add(Fecha_Nacimiento_P);
                sentencia.lstParametros.Add(Email_P);
                sentencia.lstParametros.Add(Telefono_P);
                sentencia.lstParametros.Add(Empleado_ID_P);
                sentencia.lstParametros.Add(Empleado_Usuario_ID_P);
                sentencia.lstParametros.Add(Numero_Carne_P);
                sentencia.lstParametros.Add(Doctor_Empleado_ID_P);
                sentencia.lstParametros.Add(Accion_P);

                return(objAcceso.EjecutarSentencias(sentencia));
            }
            catch (Exception e)
            {
                throw e;
            }
        }