Beispiel #1
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (mtime.Text != " No Medicine Time Now")
            {
                connection sv = new connection();
                sv.thisConnection.Open();

                OracleDataAdapter thisAdapter = new OracleDataAdapter("SELECT * FROM prescription", sv.thisConnection);

                OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter);

                DataSet thisDataSet = new DataSet();
                thisAdapter.Fill(thisDataSet, "prescription");

                DataRow thisRow = thisDataSet.Tables["prescription"].NewRow();
                try
                {
                    thisRow["p_id"]   = textBox1.Text;
                    thisRow["med"]    = comboBox1.Text;
                    thisRow["YES"]    = mtime.Text;
                    thisRow["t_date"] = today;


                    thisDataSet.Tables["prescription"].Rows.Add(thisRow);



                    thisAdapter.Update(thisDataSet, "prescription");
                    MessageBox.Show("Checked");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                sv.thisConnection.Close();
                this.Hide();
                nurse_page ob = new nurse_page();
                ob.Show();
            }
            else
            {
                MessageBox.Show("No medicine can be applied now");
            }
        }
Beispiel #2
0
        private void logincheck()
        {
            if (!(String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text)))
            {
                try
                {
                    connection CN = new connection();
                    CN.thisConnection.Open();
                    OracleCommand thisCommand = new OracleCommand();
                    thisCommand.Connection  = CN.thisConnection;
                    thisCommand.CommandText = "SELECT * FROM HOSPITAL_LOGIN WHERE username='******' AND password='******'";
                    thisReader = thisCommand.ExecuteReader();



                    if (thisReader.Read())
                    {
                        if (comboBox1.Text == "Administrator" && thisReader["designation"].ToString() == "admin")
                        {
                            AdminPage oform = new AdminPage();
                            oform.Show();
                            this.Hide();
                        }
                        else if (comboBox1.Text == "Doctor" && thisReader["designation"].ToString() == "doctor")
                        {
                            DoctorPage pat = new DoctorPage(textBox1.Text);
                            pat.Show();
                            this.Hide();
                        }
                        else if (comboBox1.Text == "Receptionist" && thisReader["designation"].ToString() == "receptionist")
                        {
                            PatientPage oform = new PatientPage();
                            oform.Show();
                            this.Hide();
                        }
                        else if (comboBox1.Text == "Compounder" && thisReader["designation"].ToString() == "compounder")
                        {
                            compounder oform = new compounder();
                            oform.Show();
                            this.Hide();
                        }
                        else if (comboBox1.Text == "Nurse" && thisReader["designation"].ToString() == "nurse")
                        {
                            nurse_page oform = new nurse_page();
                            oform.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("select your using position");
                        }
                    }
                    else
                    {
                        MessageBox.Show("username or password incorrect");
                    }
                    //this.Close();
                    CN.thisConnection.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }


            else
            {
                MessageBox.Show("Please input username and password!!!!");
            }
        }