Ejemplo n.º 1
0
        public override void add(string name, string Date, string address, string age, bool radioButton, string Specialist, string Doctor_name, string type, string room_number)
        {
            SqlCommand adddoc = new SqlCommand(@"INSERT INTO Doctor_(Name,Address,Age,Sex,Specialist,General_doctor) VALUES (@Name,@Address,@Age,@Sex,@Specialist,@General_doctor)", cs.GetDBConnection());

            adddoc.Parameters.AddWithValue("@Name", name);
            adddoc.Parameters.AddWithValue("@Address", address);
            adddoc.Parameters.AddWithValue("@Age", age);
            if (radioButton == true)
            {
                adddoc.Parameters.AddWithValue("@Sex", "Female");
            }
            else
            {
                adddoc.Parameters.AddWithValue("@Sex", "Male");
            }
            if (type == "Specialist")
            {
                adddoc.Parameters.AddWithValue("@General_doctor ", "false");
                adddoc.Parameters.AddWithValue("@Specialist", Specialist);
            }

            else
            {
                adddoc.Parameters.AddWithValue("@General_doctor ", "true");
                adddoc.Parameters.AddWithValue("@Specialist", "Null");
            }

            adddoc.Parameters.AddWithValue("@Doctor_Name", Doctor_name);

            adddoc.ExecuteNonQuery();


            MessageBox.Show("Inserting success");
            cs.CloseConnection();
        }
Ejemplo n.º 2
0
        public override void add(string name, string Date, string address, string age, bool radioButton, string Disease_description, string Doctor_name, string type, string room_number)
        {
            SqlCommand addpatient = new SqlCommand(@"INSERT INTO patient_(Name,Address,Age,Sex,Normal_Patients, Emergency_Patient, Room_Number, Doctor_Name, Disease_description,Date) 
                                    VALUES (@Name,@Address,@Age,@Sex,@Normal_Patients,@Emergency_Patient,@Room_Number,@Doctor_Name,@Disease_description,@Date)", cs.GetDBConnection());

            addpatient.Parameters.AddWithValue("@Name", name);
            addpatient.Parameters.AddWithValue("@Address", address);
            addpatient.Parameters.AddWithValue("@Age", age);
            addpatient.Parameters.AddWithValue("@Disease_description", Disease_description);


            if (radioButton == true)
            {
                addpatient.Parameters.AddWithValue("@sex", "Female");
            }
            else
            {
                addpatient.Parameters.AddWithValue("@sex", "Male");
            }

            if (type == "Normal patients")
            {
                addpatient.Parameters.AddWithValue("@Normal_Patients", "true");
                addpatient.Parameters.AddWithValue("@Emergency_Patient", "false");
                addpatient.Parameters.AddWithValue("@Room_Number", room_number);
            }

            else if (type == "Emergency patients")
            {
                addpatient.Parameters.AddWithValue("@Emergency_Patient", "true");
                addpatient.Parameters.AddWithValue("@Normal_Patients", "false");
                addpatient.Parameters.AddWithValue("@Room_Number", "NULL");
            }

            addpatient.Parameters.AddWithValue("@Doctor_Name", Doctor_name);
            addpatient.Parameters.AddWithValue("@Date", Date);

            addpatient.ExecuteNonQuery();
            MessageBox.Show("Inserting success");
            cs.CloseConnection();
        }
Ejemplo n.º 3
0
        public override void display(DataGridView dv)
        {
            ConnSingleton cs  = ConnSingleton.getDbInstance();
            SqlCommand    cmd = new SqlCommand("Select * from patient_ ORDER BY Name", cs.GetDBConnection());

            cmd.CommandType = CommandType.Text;
            SqlDataReader reader = cmd.ExecuteReader();
            DataTable     info   = new DataTable();

            info.Columns.Add("ID");
            info.Columns.Add("Name");
            info.Columns.Add("Address");
            info.Columns.Add("Age");
            info.Columns.Add("sex");
            info.Columns.Add("Date");
            info.Columns.Add("Doctor_Name");
            info.Columns.Add("Disease_description");

            DataRow row;

            while (reader.Read())
            {
                if (reader["Room_Number"].ToString() == "NULL      ")
                {
                    row                        = info.NewRow();
                    row["ID"]                  = reader["ID"];
                    row["Name"]                = reader["Name"];
                    row["Address"]             = reader["Address"];
                    row["Age"]                 = reader["Age"];
                    row["sex"]                 = reader["Sex"];
                    row["Doctor_Name"]         = reader["Doctor_Name"];
                    row["Disease_description"] = reader["Disease_description"];
                    row["Date"]                = reader["Date"];
                    info.Rows.Add(row);
                }
            }
            reader.Close();
            cs.CloseConnection();
            dv.DataSource = info;
        }