public static Tabla_Catalogo_DiagnosticoDTO GetOneById(Tabla_Catalogo_DiagnosticoDTO oneDiagnostico)
        {
            string  query = "Select * from Tabla_Catalogo_Diagnostico where Id_Diagnostico = @Id_Diagnostico";
            Helpers h     = new Helpers();

            return(h.GetAllParametized(query, oneDiagnostico)[0]);
        }
        public static Tabla_Catalogo_DiagnosticoDTO GetOneByName(Tabla_Catalogo_DiagnosticoDTO oneDiagnostico)
        {
            try
            {
                string  query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
                Helpers h     = new Helpers();
                return(h.GetAllParametized(query, oneDiagnostico)[0]);
            }
            catch
            {
                /*string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
                 *
                 * SqlConnection cnn;
                 * cnn = new SqlConnection(conexion);
                 * cnn.Open();
                 * SqlCommand comando = new SqlCommand("SP_Catalogo_Diagnostico", cnn);
                 * comando.CommandType = CommandType.StoredProcedure;
                 * comando.Parameters.AddWithValue("@Opcion", "INSERTAR");
                 * comando.Parameters.AddWithValue("@Descripcion_Diagnostico", oneDiagnostico.Descripcion_Diagnostico);
                 * SqlDataReader reader = comando.ExecuteReader();
                 * reader.Read();
                 * reader.Close();*/

                string  query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
                Helpers h     = new Helpers();
                return(h.GetAllParametized(query, oneDiagnostico)[0]);
            }

            /*if (oneDiagnostico.Id_Diagnostico > 0) {
             * }
             * else
             * {
             *  string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
             *
             *  SqlConnection cnn;
             *  cnn = new SqlConnection(conexion);
             *  cnn.Open();
             *  SqlCommand comando = new SqlCommand("SP_Catalogo_Diagnostico", cnn);
             *  comando.CommandType = CommandType.StoredProcedure;
             *  comando.Parameters.AddWithValue("@Opcion", "INSERTAR");
             *  comando.Parameters.AddWithValue("@Descripcion_Diagnostico", oneDiagnostico.Descripcion_Diagnostico);
             *  SqlDataReader reader = comando.ExecuteReader();
             *  reader.Read();
             *  reader.Close();
             * }
             *
             * string query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
             * Helpers h = new Helpers();
             * return h.GetAllParametized(query, oneDiagnostico)[0];*/
        }
        public static Tabla_Catalogo_DiagnosticoDTO GetOneByName(Tabla_Catalogo_DiagnosticoDTO oneDiagnostico)
        {
            try
            {
                string query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
                Helpers h = new Helpers();
                return h.GetAllParametized(query, oneDiagnostico)[0];
            }
            catch
            {
                /*string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;

                SqlConnection cnn;
                cnn = new SqlConnection(conexion);
                cnn.Open();
                SqlCommand comando = new SqlCommand("SP_Catalogo_Diagnostico", cnn);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@Opcion", "INSERTAR");
                comando.Parameters.AddWithValue("@Descripcion_Diagnostico", oneDiagnostico.Descripcion_Diagnostico);
                SqlDataReader reader = comando.ExecuteReader();
                reader.Read();
                reader.Close();*/

                string query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
                Helpers h = new Helpers();
                return h.GetAllParametized(query, oneDiagnostico)[0];
            }
            /*if (oneDiagnostico.Id_Diagnostico > 0) {
            }
            else
            {
                string conexion = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;

                SqlConnection cnn;
                cnn = new SqlConnection(conexion);
                cnn.Open();
                SqlCommand comando = new SqlCommand("SP_Catalogo_Diagnostico", cnn);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@Opcion", "INSERTAR");
                comando.Parameters.AddWithValue("@Descripcion_Diagnostico", oneDiagnostico.Descripcion_Diagnostico);
                SqlDataReader reader = comando.ExecuteReader();
                reader.Read();
                reader.Close();
            }

            string query = "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico = @Descripcion_Diagnostico";
            Helpers h = new Helpers();
            return h.GetAllParametized(query, oneDiagnostico)[0];*/
        }
 protected void addDiagnostico(object sender, EventArgs e)
 {
     var oneDiagnostico = new Tabla_Catalogo_DiagnosticoDTO();
     oneDiagnostico = DiagnosticoDAO.GetOneByName(oneDiagnostico);
     ConsultaDiagnosticoDTO oneConsultaDiag = new ConsultaDiagnosticoDTO();
     oneConsultaDiag.Id_ConsultaDiagnostico = Id_Agenda;
     oneConsultaDiag.Id_Consulta = Id_Agenda;
     oneConsultaDiag.Fecha_ConsultaDiagnostico = DateTime.Now;
     oneConsultaDiag.Id_FichaIdentificacion = Id_FichaIdentificacion;
     oneConsultaDiag.Estatus_ConsultaDiagnostico = true;
     oneConsultaDiag.Id_Diagnostico = oneDiagnostico.Id_Diagnostico;
     oneConsultaDiag.Observaciones_ConsultaDiagnostico = "";
     ConsultaDiagnosticoDAO Insert = new ConsultaDiagnosticoDAO();
     Insert.Insert(oneConsultaDiag);
     loadDiagnosticos();
     loadUsuario();
 }
 public static Tabla_Catalogo_DiagnosticoDTO GetOneById(Tabla_Catalogo_DiagnosticoDTO oneDiagnostico)
 {
     string query = "Select * from Tabla_Catalogo_Diagnostico where Id_Diagnostico = @Id_Diagnostico";
     Helpers h = new Helpers();
     return h.GetAllParametized(query, oneDiagnostico)[0];
 }
 protected void addDiagnostico()
 {
     var oneDiagnostico = new Tabla_Catalogo_DiagnosticoDTO();
     oneDiagnostico.Descripcion_Diagnostico = txtSearch.Text;
     oneDiagnostico = DiagnosticoDAO.GetOneByName(oneDiagnostico);
     ConsultaDiagnosticoDTO oneConsultaDiag = new ConsultaDiagnosticoDTO();
     oneConsultaDiag.Id_ConsultaDiagnostico = Id_Agenda;
     oneConsultaDiag.Id_Consulta = Id_Agenda;
     oneConsultaDiag.Fecha_ConsultaDiagnostico = DateTime.Now;
     oneConsultaDiag.Id_FichaIdentificacion = Id_FichaIdentificacion;
     oneConsultaDiag.Estatus_ConsultaDiagnostico = true;
     oneConsultaDiag.Id_Diagnostico = oneDiagnostico.Id_Diagnostico;
     oneConsultaDiag.Observaciones_ConsultaDiagnostico = "";
     ConsultaDiagnosticoDAO Insert = new ConsultaDiagnosticoDAO();
     Insert.Insert(oneConsultaDiag);
     txtSearch.Text="";
     Page.Response.Redirect(Page.Request.Url.ToString(), true);
     loadDiagnosticos();
     return;
 }
 public string GetDiagnosticoItems(string search)
 {
     List<string> lSearch = search.Split(new char[] { ' ' }).ToList();
     var oneDiagnostico = new Tabla_Catalogo_DiagnosticoDTO();
     oneDiagnostico.Descripcion_Diagnostico = "%" + search.Trim() + "%";
     string query =
         "Select * from Tabla_Catalogo_Diagnostico where Descripcion_Diagnostico like @Descripcion_Diagnostico";
     Helpers h = new Helpers();
     var lDiag = h.GetAllParametized(query, oneDiagnostico);
     string json = JsonConvert.SerializeObject(lDiag);
     return json;
 }