Ejemplo n.º 1
0
        public static void InsertUser(User user)
        {
            OracleCommand cmd = new OracleCommand("Register", App.con);

            cmd.CommandType = CommandType.StoredProcedure;
            OracleParameter user_par = new OracleParameter("prc", OracleDbType.RefCursor);

            cmd.Parameters.Add("username", user.Login);
            cmd.Parameters.Add("userpassword", user.Password);
            if (user.Doctor == null)
            {
                cmd.Parameters.Add("doctor", "");
            }
            else
            {
                cmd.Parameters.Add("doctor", (DoctorDataAccess.GetDoctorByName(user.Doctor.Name)).Id);
            }
            if (user.Patient == null)
            {
                cmd.Parameters.Add("patient", "");
            }
            else
            {
                cmd.Parameters.Add("patient", (PatientsDataAccess.GetPatientByName(user.Patient.Name)).Id);
            }
            cmd.Parameters.Add("role", user.RoleID);

            int res = cmd.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
        public static Visit GetVisitByID(int visitid)
        {
            OracleCommand cmd = new OracleCommand("admin.GetVisitByID", App.con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("did", visitid);
            OracleParameter user_par = new OracleParameter("prc", OracleDbType.RefCursor);

            cmd.Parameters.Add(user_par).Direction = System.Data.ParameterDirection.Output;
            var dt = cmd.ExecuteReader();

            if (dt.Read())
            {
                Visit visit = new Visit();
                visit.DateTime     = Convert.ToDateTime(dt[3].ToString());
                visit.Room         = new Room(dt[9].ToString(), null);
                visit.ID           = Convert.ToInt32(dt[0]);
                visit.Symthoms     = dt[5].ToString();
                visit.Diagnosis    = dt[6].ToString();
                visit.Prescription = dt[7].ToString();
                visit.Notes        = dt[8].ToString();
                visit.Patient      = PatientsDataAccess.GetPatientByName(dt[2].ToString());
                visit.Doctor       = DoctorDataAccess.GetDoctorByName(dt[1].ToString());
                if (dt[10].ToString() != "")
                {
                    visit.file = (byte[])dt[10];
                }
                return(visit);
            }
            else
            {
                return(null);
            }
        }