private DataTable GetData()
        {
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("(Select  Vendor.Name, RecvdDate, ExpiryDate, QtyRcvd, Comments from MedicineReceived join Vendor on " +
                                   "Vendor.idVendor = MedicineReceived.idVendor where idMedicine = " + InventoryView.SetID + ")", false, null);

            return(ds.Tables[0]);
        }
        public SearchPatient()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select MR_No, Patient.Name, FatherOrHusband from Patient", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
Example #3
0
        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("select Type.Name from Type where idType in (select Type from Medicine where Medicine.Name like '" + textBox4.Text + "')", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    comboBox1.DisplayMember = "Name";
                    comboBox1.ValueMember   = "Name";
                    comboBox1.DataSource    = ds.Tables[0];
                }
            }
        }
Example #4
0
        public InventoryView()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select idMedicine, Medicine.Name, Quantity, Type.Name from Medicine " +
                                   "join Type on Medicine.Type = Type.idType", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         MessageBox.Show("Please insert vendor's name.");
     }
     else
     {
         DataSet ds = new DataSet();
         ds = _sqlSetup.GetData("select Name from Vendor where Name = '" + textBox1.Text + "'", false, null);
         if (ds != null)
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 MessageBox.Show("This vendor already exists.");
             }
             else
             {
                 int insert = _sqlSetup.SetData("Insert into Vendor(idVendor, Name) values " +
                                                "((Select Top 1 idVendor from Vendor order by idVendor desc) +1,'"
                                                + textBox1.Text + "')", false, null);
                 MessageBox.Show("Vendor Added.");
                 this.Close();
                 AddMedicineStock fm = new AddMedicineStock();
                 fm.Show();
             }
         }
     }
 }
        public NewMedicine()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select Name from Type", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    comboBox1.DisplayMember = "Name";
                    comboBox1.ValueMember   = "Name";

                    comboBox1.DataSource = ds.Tables[0];
                }
            }
        }
        public DosageHistory()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("select idAppointment, Name, Date  from Appointment join Doctors on " +
                                   "Doctors.idDoctors = Appointment.idDoctors where idAppointment like '" + textBox1.Text +
                                   "%' and MR_No = " + PharmacySearch.SetMR + " and Datepart(dayofyear,Date) = " +
                                   "DatePart(dayofyear,GetDate())", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
Example #8
0
        public PharmacySearch()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select idAppointment AS 'Appointment ID', Appointment.MR_No, " +
                                   "Patient.Name AS 'Patient Name', Doctors.[Name] AS 'Doctor', Convert( varchar, Time, 8)" +
                                   " as 'Time' from Appointment join Patient on Appointment.MR_No = Patient.MR_No join" +
                                   " Doctors on Appointment.idDoctors = Doctors.idDoctors where Convert(varchar, Date, 6) =" +
                                   " Convert(varchar, GETDATE(), 6)  order by Time", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
        public NewAppointment()
        {
            InitializeComponent();
            dateTimePicker2.Format     = DateTimePickerFormat.Time;
            dateTimePicker2.ShowUpDown = true;
            textBox2.Text = SearchPatient.SetMrNo.ToString();
            textBox1.Text = SearchPatient.SetPatientName;
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select Age as age from Patient where Name like '" + textBox1.Text + "' and MR_No = " + textBox2.Text + "", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox4.Text = ds.Tables[0].Rows[0]["age"].ToString();
                }
            }
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Information Missing!");
            }

            string userid   = textBox1.Text;
            string password = textBox2.Text;


            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select username, pw, isDoctor, isReceptionist, isAdmin, isPharmacist from Users where username='******'and pw='" + textBox2.Text + "'", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["isDoctor"].ToString() == "True")
                    {
                        this.Hide();
                        DoctorView fm = new DoctorView();
                        fm.Show();
                    }

                    else if (ds.Tables[0].Rows[0]["isReceptionist"].ToString() == "True")
                    {
                        this.Hide();
                        ReceptionView fm = new ReceptionView();
                        fm.Show();
                    }

                    else if (ds.Tables[0].Rows[0]["isAdmin"].ToString() == "True")
                    {
                        this.Hide();
                        AdminView fm = new AdminView();
                        fm.Show();
                    }

                    else if (ds.Tables[0].Rows[0]["isPharmacist"].ToString() == "True")
                    {
                        this.Hide();
                        PharmacyView fm = new PharmacyView();
                        fm.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Login. Please check username and password");
                }
            }
            else
            {
                MessageBox.Show("Invalid Login. Please check username and password");
            }
        }
Example #11
0
        private void Auto()
        {
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("select Name from Vendor where Name like '" + textBox1.Text + "%'", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        coll.Add(ds.Tables[0].Rows[i]["Name"].ToString());
                    }
                }
            }
            textBox1.AutoCompleteMode         = AutoCompleteMode.Suggest;
            textBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            textBox1.AutoCompleteCustomSource = coll;
        }
        public DoctorPresc()
        {
            InitializeComponent();
            textBox1.Enabled      = false;
            textBox2.Enabled      = false;
            dataGridView1.Enabled = false;
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select MR_No, Doctors.Name as DName from Appointment " +
                                   "join Doctors on Appointment.idDoctors = Doctors.idDoctors where idAppointment = " + ConsultationForm.appt + " and MR_No = " +
                                   DoctorView.MR + " and Date = '" + ConsultationForm.date + "'", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox1.Text = ds.Tables[0].Rows[0]["MR_No"].ToString();
                    textBox2.Text = ds.Tables[0].Rows[0]["DName"].ToString();
                }
            }
            DisplayData();
        }
        public ViewPatient()
        {
            InitializeComponent();
            DataSet ds = new DataSet();

            textBox1.Text = SearchPatient.SetMrNo.ToString();
            textBox2.Text = SearchPatient.SetPatientName;
            ds            = _sqlSetup.GetData("Select Patient.Age as PAge, Patient.FatherOrHusband as PFa, Patient.CNIC as PCNIC, Patient.Address as PAdd, Patient.Cell_No as PCell, City.Name as CName, Province.Name as ProvName from Patient, City, Province where Patient.idCity = City.idCity and City.idProvince = Province.idProvince and Patient.Name like '" + textBox2.Text + "' and Patient.MR_No = " + Convert.ToInt32(textBox1.Text), false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox6.Text  = ds.Tables[0].Rows[0]["PAge"].ToString();
                    textBox3.Text  = ds.Tables[0].Rows[0]["PFa"].ToString();
                    textBox4.Text  = ds.Tables[0].Rows[0]["PCNIC"].ToString();
                    textBox5.Text  = ds.Tables[0].Rows[0]["PAdd"].ToString();
                    textBox8.Text  = ds.Tables[0].Rows[0]["PCell"].ToString();
                    textBox7.Text  = ds.Tables[0].Rows[0]["CName"].ToString();
                    comboBox1.Text = ds.Tables[0].Rows[0]["ProvName"].ToString();
                }
            }
        }
        public PharmacyPrescription()
        {
            InitializeComponent();
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select MR_No, Doctors.Name as DName from Appointment " +
                                   "join Doctors on Appointment.idDoctors = Doctors.idDoctors where idAppointment = " + DosageHistory.SetApp + " and MR_No = " +
                                   PharmacySearch.SetMR + " and Date = '" + DosageHistory.SetDate + "'", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox1.Text = ds.Tables[0].Rows[0]["MR_No"].ToString();
                    textBox2.Text = ds.Tables[0].Rows[0]["DName"].ToString();
                }
                else
                {
                    MessageBox.Show("No appointments found.");
                }
            }
            DisplayData();
        }
        private void ViewTodaysAppointment_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select idAppointment, Appointment.MR_No, Patient.Name as 'Patient', Doctors.[Name] as 'Doctor', " +
                                   "Convert( varchar, Time, 8) as 'Time' from Appointment join Patient on Appointment.MR_No =" +
                                   " Patient.MR_No join Doctors on Appointment.idDoctors = Doctors.idDoctors where " +
                                   "Convert(varchar, Date, 6) = Convert(varchar, GETDATE(), 6)  order by Time", false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dataGridView1.DataSource = ds.Tables[0];
                }
            }
        }
        private void EditConsultationDetails_Load(object sender, EventArgs e)
        {
            //Adding feet and inches to height
            comboBox2.Items.Add(1);
            comboBox2.Items.Add(2);
            comboBox2.Items.Add(3);
            comboBox2.Items.Add(4);
            comboBox2.Items.Add(5);
            comboBox2.Items.Add(6);
            comboBox2.Items.Add(7);
            comboBox2.Items.Add(8);
            comboBox2.Items.Add(9);
            comboBox2.Items.Add(10);
            comboBox2.Items.Add(11);
            comboBox1.Items.Add(1);
            comboBox1.Items.Add(2);
            comboBox1.Items.Add(3);
            comboBox1.Items.Add(4);
            comboBox1.Items.Add(5);
            comboBox1.Items.Add(6);

            textBox2.Text        = DoctorView.Patient;
            textBox3.Text        = DoctorView.MR.ToString();
            textBox12.Text       = ConsultationForm.appt.ToString();
            textBox13.Text       = ConsultationForm.doc;
            dateTimePicker1.Text = ConsultationForm.date;
            DataSet ds = new DataSet();

            ds = _sqlSetup.GetData("Select PresentComplaints, Investigation, Heightf, Heighti, Weight, Temp, BP, Pulse, RespRate from Appointment, Doctors where Doctors.idDoctors = Appointment.idDoctors and Doctors.Name like '" + ConsultationForm.doc + "' and MR_No = " + DoctorView.MR.ToString() + " and Date = '" + ConsultationForm.date + "' and idAppointment = " + ConsultationForm.appt.ToString(), false, null);
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox1.Text  = ds.Tables[0].Rows[0]["PresentComplaints"].ToString();
                    textBox4.Text  = ds.Tables[0].Rows[0]["Investigation"].ToString();
                    comboBox1.Text = ds.Tables[0].Rows[0]["Heightf"].ToString();
                    comboBox2.Text = ds.Tables[0].Rows[0]["Heighti"].ToString();
                    textBox9.Text  = ds.Tables[0].Rows[0]["Weight"].ToString();
                    textBox8.Text  = ds.Tables[0].Rows[0]["Temp"].ToString();
                    textBox7.Text  = ds.Tables[0].Rows[0]["BP"].ToString();
                    textBox6.Text  = ds.Tables[0].Rows[0]["Pulse"].ToString();
                    textBox5.Text  = ds.Tables[0].Rows[0]["RespRate"].ToString();
                }
            }
        }
        public void Auto()
        {
            DataSet ds2 = new DataSet();

            ds2 = _sqlSetup.GetData("select City.Name as CName from City", false, null);
            if (ds2 != null)
            {
                if (ds2.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                    {
                        coll.Add(ds2.Tables[0].Rows[i]["CName"].ToString());
                    }
                }
                else
                {
                    textBox7.Clear();
                    MessageBox.Show("City not found");
                }
            }
            textBox7.AutoCompleteMode         = AutoCompleteMode.Suggest;
            textBox7.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            textBox7.AutoCompleteCustomSource = coll;
        }
        private void Reg_Click_1(object sender, EventArgs e)
        {
            if (uname.Text == "" || pass.Text == "" || cpass.Text == "")
            {
                MessageBox.Show("Incomplete Information!");
            }
            else if (pass.Text.Length < 8)
            {
                MessageBox.Show("Password needs more characters");
            }
            else if (pass.Text != cpass.Text)
            {
                MessageBox.Show("Passwords don't match");
            }

            else
            {
                DataSet ds = new DataSet();
                ds = _sqlSetup.GetData("select username from Users where username ='******'", false, null);
                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("A user already exists with these credentials. Please enter a different username and password.");
                    }
                    else
                    {
                        string command;

                        if (radioButton1.Checked == true)
                        {
                            command = "Insert into dbo.Users(username,pw,isDoctor,isReceptionist,isPharmacist,isAdmin) " +
                                      "values( '" + uname.Text + "', '" + pass.Text + "', 0,0,1,0)";
                            int update = _sqlSetup.SetData(command, false, null);
                            MessageBox.Show("User Details Added!");
                            this.Close();
                        }
                        else if (radioButton2.Checked == true)
                        {
                            command = "Insert into dbo.Users(username,pw,isDoctor,isReceptionist,isPharmacist,isAdmin) " +
                                      "values( '" + uname.Text + "', '" + pass.Text + "',  0,1,0,0)";
                            int update = _sqlSetup.SetData(command, false, null);
                            MessageBox.Show("User Details Added!");
                            this.Close();
                        }

                        else if (radioButton3.Checked == true)
                        {
                            command = "Insert into dbo.Users(username,pw,isDoctor,isReceptionist,isPharmacist,isAdmin) " +
                                      "values( '" + uname.Text + "', '" + pass.Text + "',  0,0,0,1)";
                            int update = _sqlSetup.SetData(command, false, null);
                            MessageBox.Show("User Details Added!");
                            this.Close();
                        }
                        else if (radioButton4.Checked == true)
                        {
                            command = "Insert into dbo.Users(username,pw,isDoctor,isReceptionist,isPharmacist,isAdmin) " +
                                      "values( '" + uname.Text + "', '" + pass.Text + "', 1,0,0,0)";

                            int add    = _sqlSetup.SetData("Insert into dbo.Doctors(Name) values('" + uname.Text + "')", false, null);
                            int update = _sqlSetup.SetData(command, false, null);
                            MessageBox.Show("User Details Added!");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Please select your position!");
                        }
                    }
                }
            }
        }