コード例 #1
0
ファイル: BusPaciente.cs プロジェクト: patel-pragnesh/Meditoc
        public IMDResponse <EntPaciente> BSavePaciente(EntPaciente entPaciente)
        {
            IMDResponse <EntPaciente> response = new IMDResponse <EntPaciente>();

            string metodo = nameof(this.BSavePaciente);

            logger.Info(IMDSerialize.Serialize(67823458420501, $"Inicia {metodo}(EntPaciente entPaciente)", entPaciente));

            try
            {
                IMDResponse <DataTable> imdResponse = datPaciente.DSavePaciente(entPaciente);

                if (imdResponse.Code != 0)
                {
                    return(imdResponse.GetResponse <EntPaciente>());
                }

                entPaciente.iIdPaciente = Convert.ToInt32(imdResponse.Result.Rows[0]["iIdPaciente"].ToString());

                response.Code   = 0;
                response.Result = entPaciente;
            }
            catch (Exception ex)
            {
                response.Code    = 67823458421278;
                response.Message = "Ocurrió un error inesperado al guardar los datos del paciente.";

                logger.Error(IMDSerialize.Serialize(67823458421278, $"Error en {metodo}(EntPaciente entPaciente): {ex.Message}", entPaciente, ex, response));
            }
            return(response);
        }
コード例 #2
0
 protected void lnkAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         EntPaciente ent = new EntPaciente();
         ent.Estatus      = Convert.ToBoolean(((CheckBox)gvPacientes.FooterRow.FindControl("chkEstatusFT")).Checked);
         ent.Nombre       = ((TextBox)gvPacientes.FooterRow.FindControl("txtNombreFT")).Text;
         ent.Paterno      = ((TextBox)gvPacientes.FooterRow.FindControl("txtPaternoFT")).Text;
         ent.Materno      = ((TextBox)gvPacientes.FooterRow.FindControl("txtMaternoFT")).Text;
         ent.IdSexo       = Convert.ToInt32(((DropDownList)gvPacientes.FooterRow.FindControl("ddlSexoFT")).SelectedValue);
         ent.Calle        = ((TextBox)gvPacientes.FooterRow.FindControl("txtCalleFT")).Text;
         ent.Numero       = ((TextBox)gvPacientes.FooterRow.FindControl("txtNumeroFT")).Text;
         ent.IdDelegacion = Convert.ToInt32(((DropDownList)gvPacientes.FooterRow.FindControl("ddlDelegacionFT")).SelectedValue);
         ent.IdColonia    = Convert.ToInt32(((DropDownList)gvPacientes.FooterRow.FindControl("ddlColoniaFT")).SelectedValue);
         ent.Horario      = ((TextBox)gvPacientes.FooterRow.FindControl("txtHorarioFT")).Text;
         ent.Edad         = Convert.ToInt32(((TextBox)gvPacientes.FooterRow.FindControl("txtEdadFT")).Text);
         ent.Alergia      = ((TextBox)gvPacientes.FooterRow.FindControl("txtAlergiasFT")).Text;
         //ent.FechaAlta = Convert.ToDateTime(((TextBox)gvPacientes.FooterRow.FindControl("txtFechaFT")).Text);
         BusPaciente obj = new BusPaciente();
         obj.Insertar(ent);
         Response.Redirect(Request.CurrentExecutionFilePath);
     }
     catch (Exception ex)
     {
         MostrarMensaje(ex.Message);
     }
 }
コード例 #3
0
        public List <EntPaciente> Ordenado(string columna, string direccion)
        {
            DataTable          dt  = new DatPaciente().Obtener(columna, direccion);
            List <EntPaciente> lst = new List <EntPaciente>();

            foreach (DataRow r in dt.Rows)
            {
                EntPaciente ent = new EntPaciente();
                ent.Id                = Convert.ToInt32(r["Id_Paciente"]);
                ent.Estatus           = Convert.ToBoolean(r["Estatus_Paciente"]);
                ent.Nombre            = r["Nombre_Paciente"].ToString();
                ent.Paterno           = r["Paterno_Paciente"].ToString();
                ent.Materno           = r["Materno_Paciente"].ToString();
                ent.IdSexo            = Convert.ToInt32(r["Id_Sexo_Paciente"]);
                ent.Sexo.Id           = Convert.ToInt32(r["Id_Sexo"]);
                ent.Sexo.Nombre       = r["Nombre_Sexo"].ToString();
                ent.Calle             = r["Calle_Paciente"].ToString();
                ent.Numero            = r["Numero_Paciente"].ToString();
                ent.IdDelegacion      = Convert.ToInt32(r["Id_Delegacion_Paciente"]);
                ent.Delegacion.Id     = Convert.ToInt32(r["Id_Delegacion"]);
                ent.Delegacion.Nombre = r["Nombre_Delegacion"].ToString();
                ent.IdColonia         = Convert.ToInt32(r["Id_Colonia_Paciente"]);
                ent.Colonia.Id        = Convert.ToInt32(r["Id_Colonia"]);
                ent.Colonia.Nombre    = r["Nombre_Colonia"].ToString();
                ent.Horario           = r["Horario_Paciente"].ToString();
                ent.Edad              = Convert.ToInt32(r["Edad_Paciente"]);
                ent.Alergia           = r["Alergias_Paciente"].ToString();
                ent.FechaAlta         = Convert.ToDateTime(r["Fecha_Alta_Paciente"]);
                lst.Add(ent);
            }
            return(lst);
        }
コード例 #4
0
 protected void gvPacientes_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         EntPaciente ent = new EntPaciente();
         ent.Id = Convert.ToInt32(gvPacientes.DataKeys[e.RowIndex].Values["Id"]);
         //ent.Estatus = Convert.ToBoolean(((CheckBox)gvPacientes.Rows[e.RowIndex].FindControl("chkEstatusEIT")).Checked);
         ent.Nombre       = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtNombreEIT")).Text;
         ent.Paterno      = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtPaternoEIT")).Text;
         ent.Materno      = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtMaternoEIT")).Text;
         ent.IdSexo       = Convert.ToInt32(((DropDownList)gvPacientes.Rows[e.RowIndex].FindControl("ddlSexoEIT")).SelectedValue);
         ent.Calle        = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtCalleEIT")).Text;
         ent.Numero       = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtNumeroEIT")).Text;
         ent.IdDelegacion = Convert.ToInt32(((DropDownList)gvPacientes.Rows[e.RowIndex].FindControl("ddlDelegacionEIT")).SelectedValue);
         ent.IdColonia    = Convert.ToInt32(((DropDownList)gvPacientes.Rows[e.RowIndex].FindControl("ddlColoniaEIT")).SelectedValue);
         ent.Horario      = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtHorarioEIT")).Text;
         ent.Edad         = Convert.ToInt32(((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtEdadEIT")).Text);
         ent.Alergia      = ((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtAlergiasEIT")).Text;
         //ent.FechaAlta = Convert.ToDateTime(((TextBox)gvPacientes.Rows[e.RowIndex].FindControl("txtFechaEIT")).Text);
         BusPaciente obj = new BusPaciente();
         obj.Actualizar(ent);
         Response.Redirect(Request.CurrentExecutionFilePath);
     }
     catch (Exception ex)
     {
         MostrarMensaje(ex.Message);
     }
 }
コード例 #5
0
    public void Eliminar(int id)
    {
        EntPaciente ent = new EntPaciente();

        ent.Id = id;
        new BusPaciente().Eliminar(id);
    }
コード例 #6
0
        public IMDResponse <DataTable> DSavePaciente(EntPaciente entPaciente)
        {
            IMDResponse <DataTable> response = new IMDResponse <DataTable>();

            string metodo = nameof(this.DSavePaciente);

            logger.Info(IMDSerialize.Serialize(67823458422055, $"Inicia {metodo}(EntPaciente entPaciente)", entPaciente));

            try
            {
                using (DbCommand dbCommand = database.GetStoredProcCommand(spSavePaciente))
                {
                    database.AddInParameter(dbCommand, "piIdFolio", DbType.Int32, entPaciente.iIdFolio);
                    database.AddInParameter(dbCommand, "psNombre", DbType.String, entPaciente.sNombre);
                    database.AddInParameter(dbCommand, "psTelefono", DbType.String, entPaciente.sTelefono?.Replace(" ", ""));
                    database.AddInParameter(dbCommand, "psCorreo", DbType.String, entPaciente.sCorreo);
                    database.AddInParameter(dbCommand, "piIdUsuarioMod", DbType.Int32, entPaciente.iIdUsuarioMod);

                    response = imdCommonData.DExecuteDT(database, dbCommand);
                }
            }
            catch (Exception ex)
            {
                response.Code    = 67823458422832;
                response.Message = "Ocurrió un error inesperado en la base de datos al guardar el paciente.";

                logger.Error(IMDSerialize.Serialize(67823458422832, $"Error en {metodo}(EntPaciente entPaciente): {ex.Message}", entPaciente, ex, response));
            }
            return(response);
        }
コード例 #7
0
ファイル: BusPaciente.cs プロジェクト: patel-pragnesh/Meditoc
        public IMDResponse <List <EntPaciente> > BGetPacientes(int?piIdPaciente = null, int?piIdFolio = null)
        {
            IMDResponse <List <EntPaciente> > response = new IMDResponse <List <EntPaciente> >();

            string metodo = nameof(this.BGetPacientes);

            logger.Info(IMDSerialize.Serialize(67823458516849, $"Inicia {metodo}(int? piIdPaciente = null, int? piIdFolio = null)", piIdPaciente, piIdFolio));

            try
            {
                IMDResponse <DataTable> resGetPacientes = datPaciente.DGetPacientes(piIdPaciente, piIdFolio);
                if (resGetPacientes.Code != 0)
                {
                    return(resGetPacientes.GetResponse <List <EntPaciente> >());
                }

                List <EntPaciente> lstPacientes = new List <EntPaciente>();

                foreach (DataRow drPaciente in resGetPacientes.Result.Rows)
                {
                    IMDDataRow dr = new IMDDataRow(drPaciente);

                    EntPaciente paciente = new EntPaciente()
                    {
                        iIdFolio           = dr.ConvertTo <int>("iIdFolio"),
                        iIdPaciente        = dr.ConvertTo <int>("iIdPaciente"),
                        iIdSexo            = dr.ConvertTo <int>("iIdSexo"),
                        sApellidoMaterno   = dr.ConvertTo <string>("sApellidoMaterno"),
                        sApellidoPaterno   = dr.ConvertTo <string>("sApellidoPaterno"),
                        sCorreo            = dr.ConvertTo <string>("sCorreo"),
                        dtFechaNacimiento  = dr.ConvertTo <DateTime?>("dtFechaNacimiento"),
                        sdtFechaNacimiento = string.Empty,
                        sFolio             = dr.ConvertTo <string>("sFolio"),
                        sNombre            = dr.ConvertTo <string>("sNombre"),
                        sSexo       = dr.ConvertTo <string>("sSexo"),
                        sTelefono   = dr.ConvertTo <string>("sTelefono"),
                        sTipoSangre = dr.ConvertTo <string>("sTipoSangre"),
                    };

                    paciente.sdtFechaNacimiento = paciente.dtFechaNacimiento?.ToString("dd/MM/yyyy");

                    lstPacientes.Add(paciente);
                }

                response.Code    = 0;
                response.Message = lstPacientes.Count == 0 ? "No se encontraron pacientes en la lista." : "La lista de pacientes ha sido obtenida.";
                response.Result  = lstPacientes;
            }
            catch (Exception ex)
            {
                response.Code    = 67823458517626;
                response.Message = "Ocurrió un error inesperado al obtener la lista de pacientes.";

                logger.Error(IMDSerialize.Serialize(67823458517626, $"Error en {metodo}(int? piIdPaciente = null, int? piIdFolio = null): {ex.Message}", piIdPaciente, piIdFolio, ex, response));
            }
            return(response);
        }
コード例 #8
0
        public void Actualizar(EntPaciente pac)
        {
            bool existe = new DatPaciente().Validar(pac.Nombre, pac.Paterno, pac.Id);

            if (existe)
            {
                throw new ApplicationException(string.Format("Error al Actualizar al paciente {0} {1}, ", pac.Nombre, pac.Paterno));
            }
            int filas = new DatPaciente().Actualizar(pac.Nombre, pac.Paterno, pac.Materno, pac.IdSexo, pac.Calle, pac.Numero, pac.IdDelegacion, pac.IdColonia, pac.Horario, pac.Edad, pac.Alergia, pac.Id);

            if (filas != 1)
            {
                throw new ApplicationException(string.Format("Error al Actualizar a {0} {1}", pac.Nombre, pac.Paterno));
            }
        }
コード例 #9
0
    public void Insertar(string nombre, string paterno, string materno, int sexo, string calle, string numero, int delegacion, int colonia, string horario, int edad, string alergias)
    {
        EntPaciente ent = new EntPaciente();

        ent.Nombre       = nombre;
        ent.Materno      = materno;
        ent.Paterno      = paterno;
        ent.IdSexo       = sexo;
        ent.Calle        = calle;
        ent.Numero       = numero;
        ent.IdDelegacion = delegacion;
        ent.IdColonia    = colonia;
        ent.Horario      = horario;
        ent.Edad         = edad;
        ent.Alergia      = alergias;
        new BusPaciente().Insertar(ent);
    }