示例#1
0
        public static bool Update(Ent_Paciente entPaciente)
        {
            //instancio el metodo
            Da_Paciente daPaciente = GetDaPaciente();

            //Validaciones De Lugar
            bool flag = false;

            if (String.IsNullOrEmpty(entPaciente.Nombres) || String.IsNullOrEmpty(entPaciente.Apellidos))
            {
                flag = false;
            }
            else if (Da_Paciente.Update(entPaciente))
            {
                flag = true;
            }

            return(flag);
        }
示例#2
0
        public static bool Insert(Ent_Paciente EntidadPaciente)
        {
            bool flag = false;

            try
            {
                //Utilizo la clase Command Insertar en un StroreProcedure
                SqlCommand command = new SqlCommand("Spr_InsertPaciente", Da_Connection.Get);
                command.CommandType = CommandType.StoredProcedure;

                //Abro la conecxion
                Da_Connection.Get.Open();

                //Paso los valores para la tabla Pacientes.
                command.Parameters.Add(new SqlParameter("@Nombres", EntidadPaciente.Nombres)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add(new SqlParameter("@Apellidos", EntidadPaciente.Apellidos)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add(new SqlParameter("@IDTipoIdentifacion", EntidadPaciente.IDTipoIdentifacion)
                {
                    SqlDbType = SqlDbType.Int
                });
                command.Parameters.Add(new SqlParameter("@Identificacion", EntidadPaciente.Identificacion)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add(new SqlParameter("@Edad", EntidadPaciente.Edad)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add(new SqlParameter("@Genero", EntidadPaciente.Genero)
                {
                    SqlDbType = SqlDbType.NChar
                });
                command.Parameters.Add(new SqlParameter("@EstadoCivil", EntidadPaciente.EstadoCivil)
                {
                    SqlDbType = SqlDbType.NChar
                });
                command.Parameters.Add(new SqlParameter("@TipoSangre", EntidadPaciente.TipoSangre)
                {
                    SqlDbType = SqlDbType.NChar
                });
                command.Parameters.Add(new SqlParameter("@IDTipoPaciente", EntidadPaciente.TipoPaciente)
                {
                    SqlDbType = SqlDbType.Int
                });
                command.Parameters.Add(new SqlParameter("@Email", EntidadPaciente.Email)
                {
                    SqlDbType = SqlDbType.NVarChar
                });
                command.Parameters.Add(new SqlParameter("@Peso", EntidadPaciente.Peso)
                {
                    SqlDbType = SqlDbType.Decimal
                });
                command.Parameters.Add(new SqlParameter("@Altura", EntidadPaciente.Altura)
                {
                    SqlDbType = SqlDbType.Decimal
                });
                command.Parameters.Add(new SqlParameter("@Direccion", EntidadPaciente.Direccion)
                {
                    SqlDbType = SqlDbType.NVarChar
                });

                //Ejecuto el Query
                command.ExecuteNonQuery();



                flag = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            } // end catch
            finally
            {
                if (Da_Connection.Get.State != ConnectionState.Closed)
                {
                    Da_Connection.Get.Close();
                }
            }

            //retorno el resultado
            return(flag);
        }