Пример #1
0
        public frmPatientDataUpdate(string PatientID)
        {
            InitializeComponent();
            dtpVST.DateTime = DateTime.Now.Date;
            PID             = PatientID;

            Patient        p  = new Patient();
            PatientContext px = new PatientContext();

            p           = px.GetPatient(PatientID);
            txtPID.Text = p.ID;
            txtPNM.Text = p.PatientName;
            txtADR.Text = p.Address;
            txtPHN.Text = p.PhoneNo;

            MedicineContext mx = new MedicineContext();
            ServerToClient  sc = new ServerToClient();

            sc = mx.GetMedicines();

            for (int i = 0; i <= sc.Count - 1; i++)
            {
                cboMED.Properties.Items.Add(sc.DT.Rows[i].ItemArray[0].ToString());
            }
        }
Пример #2
0
        public ServerToClient AddPatient(Patient p)
        {
            ServerToClient sc = new ServerToClient();
            OleDbCommand   cmd;

            cmd = new OleDbCommand("INSERT INTO Patient(ID, PatientName, DateOfBirth, Sex, MedicalHistory, Comments, Address, PhoneNo) VALUES (@PID, @PNM, @DOB, @SEX, @MHS, @CMT, @ADR, @PHN)", cm);
            cmd.Parameters.AddWithValue("@PID", p.ID);
            cmd.Parameters.AddWithValue("@PNM", p.PatientName);
            cmd.Parameters.AddWithValue("@DOB", p.DateOfBirth);
            cmd.Parameters.AddWithValue("@SEX", p.Sex);
            cmd.Parameters.AddWithValue("@MHS", p.MedicalHistory);
            cmd.Parameters.AddWithValue("@CMT", p.Comments);
            cmd.Parameters.AddWithValue("@ADR", p.Address);
            cmd.Parameters.AddWithValue("@PHN", p.PhoneNo);
            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();

                cmd      = new OleDbCommand("SELECT DMAX('ID', 'Patient')", cm);
                sc.Count = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #3
0
        public ServerToClient OverallView()
        {
            ServerToClient   sc  = new ServerToClient();
            OleDbCommand     cmd = new OleDbCommand("SELECT Treatments.ID AS TreatmentID, Treatments.TreatmentDate, Patient.ID AS PatientID, Patient.PatientName, Patient.Address, Patient.PhoneNo, Treatments.Amount FROM Patient INNER JOIN(Treatments LEFT OUTER JOIN Gallery ON Treatments.ID = Gallery.TreatmentID) ON Patient.ID = Treatments.PatientID", cm);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            sc.DT = ds.Tables[0];
            return(sc);
        }
Пример #4
0
        public ServerToClient GetPatients()
        {
            ServerToClient   sc  = new ServerToClient();
            OleDbCommand     cmd = new OleDbCommand("SELECT ID, PatientName, DateOfBirth, YEAR(NOW)-YEAR(DateOfBirth) AS Age, Sex, MedicalHistory, Comments, Address, PhoneNo FROM Patient", cm);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            sc.DT = ds.Tables[0];
            return(sc);
        }
Пример #5
0
        public ServerToClient GetTreatments(string PatientID)
        {
            ServerToClient   sc  = new ServerToClient();
            OleDbCommand     cmd = new OleDbCommand("SELECT ID, PatientID, MainComplain, Examination, Treatment, Medicine, TreatmentDate, Amount FROM Treatments WHERE PatientID='" + PatientID + "'", cm);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            sc.DT = ds.Tables[0];
            return(sc);
        }
Пример #6
0
        public ServerToClient GetMedicines()
        {
            ServerToClient   sc  = new ServerToClient();
            OleDbCommand     cmd = new OleDbCommand("SELECT DISTINCT MedicineName FROM Medicine ORDER BY MedicineName", cm);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            sc.DT    = ds.Tables[0];
            sc.Count = ds.Tables[0].Rows.Count;
            return(sc);
        }
Пример #7
0
        public ServerToClient OverallView(DateTime datefr, DateTime dateto)
        {
            string           df  = datefr.Year.ToString("0000") + "-" + datefr.Month.ToString("00") + "-" + datefr.Day.ToString("00");
            string           dt  = dateto.Year.ToString("0000") + "-" + dateto.Month.ToString("00") + "-" + dateto.Day.ToString("00");
            ServerToClient   sc  = new ServerToClient();
            OleDbCommand     cmd = new OleDbCommand("SELECT Treatments.ID AS TreatmentID, Treatments.TreatmentDate, Patient.ID AS PatientID, Patient.PatientName, Patient.Address, Patient.PhoneNo, Treatments.Amount FROM Patient INNER JOIN(Treatments LEFT OUTER JOIN Gallery ON Treatments.ID = Gallery.TreatmentID) ON Patient.ID = Treatments.PatientID WHERE Treatments.TreatmentDate BETWEEN #" + df + "# AND #" + dt + "#", cm);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            sc.DT = ds.Tables[0];
            return(sc);
        }
Пример #8
0
        public ServerToClient DeletePatient(string PatientID)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("DELETE FROM Patient WHERE ID='" + PatientID + "'", cm);

            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #9
0
        public ServerToClient DeleteTreatment(int TreatmentID)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("DELETE FROM Treatments WHERE ID=" + TreatmentID, cm);

            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #10
0
        public ServerToClient AddMedicine(Medicine m)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("INSERT INTO Medicine (MedicineName) VALUES (@MDN)", cm);

            cmd.Parameters.AddWithValue("@MDN", m.MedicineName);
            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #11
0
        public rptPatientList()
        {
            InitializeComponent();

            ServerToClient sc = new ServerToClient();
            PatientContext px = new PatientContext();

            sc = px.GetPatients();

            DataSource = sc.DT;

            lbPID.DataBindings.Add("Text", null, "ID");
            lbPNM.DataBindings.Add("Text", null, "PatientName");
            lbAGE.DataBindings.Add("Text", null, "Age");
            lbSEX.DataBindings.Add("Text", null, "Sex");
            lbHIS.DataBindings.Add("Text", null, "MedicalHistory");
            lbCMT.DataBindings.Add("Text", null, "Comments");
            lbADR.DataBindings.Add("Text", null, "Address");
            lbPHN.DataBindings.Add("Text", null, "PhoneNo");
        }
Пример #12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (btnSave.Text == "&Save")
            {
                ID             = txtPID.Text;
                PatientName    = txtPNM.Text;
                Sex            = cboSEX.Text;
                DateOfBirth    = dtpDOB.DateTime.Date;
                PhoneNo        = txtPHN.Text;
                Address        = txtADR.Text;
                Comments       = txtCMT.Text;
                MedicalHistory = txtHIS.Text;
                DialogResult   = DialogResult.OK;
            }
            else
            {
                ServerToClient sc = new ServerToClient();
                PatientContext px = new PatientContext();
                Patient        p  = new Patient();
                p.ID             = txtPID.Text;
                p.PatientName    = txtPNM.Text;
                p.Sex            = cboSEX.Text;
                p.DateOfBirth    = dtpDOB.DateTime.Date;
                p.PhoneNo        = txtPHN.Text;
                p.Address        = txtADR.Text;
                p.Comments       = txtCMT.Text;
                p.MedicalHistory = txtHIS.Text;

                sc = px.UpdatePatient(p);

                if (sc.Message == null)
                {
                    XtraMessageBox.Show("Patient detail updated!");
                    Close();
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }
            }
        }
Пример #13
0
        public rptPatientDetail(string PatientID)
        {
            InitializeComponent();

            ServerToClient   sc = new ServerToClient();
            Patient          p  = new Patient();
            PatientContext   px = new PatientContext();
            TreatmentContext tx = new TreatmentContext();

            p = px.GetPatient(PatientID);

            lbPID.Text = p.ID;
            lbPNM.Text = p.PatientName;
            lbADR.Text = p.Address;
            lbHIS.Text = p.MedicalHistory;
            lbCMT.Text = p.Comments;
            lbPHN.Text = p.PhoneNo;
            lbAGE.Text = p.Age.ToString();
            lbSEX.Text = p.Sex;

            sc         = tx.GetTreatments(PatientID);
            DataSource = sc.DT;

            GroupField tdt = new GroupField("TreatmentDate");

            GroupHeader1.GroupFields.Add(tdt);
            XRSummary amt = new XRSummary();

            lbTDT.DataBindings.Add("Text", null, "TreatmentDate", "{0:dd-MM-yyyy}");
            lbCMP.DataBindings.Add("Text", null, "MainComplain");
            lbEXM.DataBindings.Add("Text", null, "Examination");
            lbTMP.DataBindings.Add("Text", null, "Treatment");
            lbMED.DataBindings.Add("Text", null, "Medicine");
            lbAMT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
            lbTAM.DataBindings.Add("Text", null, "Amount");

            amt.FormatString = "{0:C2}";
            amt.Running      = SummaryRunning.Report;

            lbTAM.Summary = amt;
        }
Пример #14
0
        private void cboMED_KeyDown(object sender, KeyEventArgs e)
        {
            ServerToClient  sc = new ServerToClient();
            MedicineContext mx = new MedicineContext();
            Medicine        m  = new Medicine();

            if (e.KeyCode == Keys.Enter)
            {
                if (!dxValidationProvider1.Validate())
                {
                    return;
                }
                if (cboMED.SelectedIndex == -1)
                {
                    m.MedicineName = cboMED.Text;
                    sc             = mx.AddMedicine(m);
                }
                lstMED.Items.Add(cboMED.Text);
                cboMED.SelectedIndex = -1;
            }
        }
Пример #15
0
        public ServerToClient UpdatePatient(Patient p)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("UPDATE Patient SET PatientName=@PNM, DateOfBirth=@DOB, Sex=@SEX, MedicalHistory=@MHS, Comments=@CMT, Address=@ADR, PhoneNo=@PHN WHERE ID='" + p.ID + "'", cm);

            cmd.Parameters.AddWithValue("@PNM", p.PatientName);
            cmd.Parameters.AddWithValue("@DOB", p.DateOfBirth);
            cmd.Parameters.AddWithValue("@SEX", p.Sex);
            cmd.Parameters.AddWithValue("@MHS", p.MedicalHistory);
            cmd.Parameters.AddWithValue("@CMT", p.Comments);
            cmd.Parameters.AddWithValue("@ADR", p.Address);
            cmd.Parameters.AddWithValue("@PHN", p.PhoneNo);
            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #16
0
        public rptOverall(DateTime df, DateTime dt)
        {
            InitializeComponent();
            ServerToClient   sc = new ServerToClient();
            TreatmentContext tx = new TreatmentContext();

            sc = tx.OverallView(df, dt);
            if (DateTime.Equals(df, dt))
            {
                lbHDR.Text = "PATIENT REPORT ON " + dt.ToShortDateString();
            }
            else
            {
                lbHDR.Text = "PATIENT REPORT BETWEEN " + df.ToShortDateString() + " AND " + dt.ToShortDateString();
            }
            DataSource = sc.DT;
            XRSummary sam = new XRSummary();
            XRSummary gam = new XRSummary();

            GroupField tdt = new GroupField("TreatmentDate");

            GroupHeader1.GroupFields.Add(tdt);

            lbTDT.DataBindings.Add("Text", null, "TreatmentDate", "{0:dd-MM-yyyy}");
            lbPID.DataBindings.Add("Text", null, "PatientID");
            lbPNM.DataBindings.Add("Text", null, "PatientName");
            lbADR.DataBindings.Add("Text", null, "Address");
            lbPHN.DataBindings.Add("Text", null, "PhoneNo");
            lbAMT.DataBindings.Add("Text", null, "Amount", "{0:C2}");
            lbSAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
            lbGAM.DataBindings.Add("Text", null, "Amount", "{0:C2}");
            sam.FormatString = "{0:C2}";
            sam.Running      = SummaryRunning.Group;
            gam.FormatString = "{0:C2}";
            gam.Running      = SummaryRunning.Report;
            lbSAM.Summary    = sam;
            lbGAM.Summary    = gam;
        }
Пример #17
0
        public ServerToClient AddTreatment(Treatments t)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("INSERT INTO Treatments(PatientID, MainComplain, Examination, Treatment, Medicine, TreatmentDate, Amount) VALUES (@PID, @CMP, @EXM, @TRM, @MED, @TDT, @AMT)", cm);

            cmd.Parameters.AddWithValue("@PID", t.PatientID);
            cmd.Parameters.AddWithValue("@CMP", t.MainComplain);
            cmd.Parameters.AddWithValue("@EXM", t.Examination);
            cmd.Parameters.AddWithValue("@TRM", t.Treatment);
            cmd.Parameters.AddWithValue("@MED", t.Medicine);
            cmd.Parameters.AddWithValue("@TDT", t.TreatmentDate);
            cmd.Parameters.AddWithValue("@AMT", t.Amount);
            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
                cmd      = new OleDbCommand("SELECT DMAX('ID', 'Treatments')", cm);
                sc.Count = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #18
0
        public ServerToClient UpdateTreatment(Treatments t)
        {
            ServerToClient sc  = new ServerToClient();
            OleDbCommand   cmd = new OleDbCommand("UPDATE Treatments SET PatientID=@PID, MainComplain=@CMP, Examination=@EXM, Treatment=@TRM, Medicine=@MED, TreatmentDate=@TDT, Amount=@AMT WHERE ID=" + t.ID, cm);

            cmd.Parameters.AddWithValue("@PID", t.PatientID);
            cmd.Parameters.AddWithValue("@CMP", t.MainComplain);
            cmd.Parameters.AddWithValue("@EXM", t.Examination);
            cmd.Parameters.AddWithValue("@TRM", t.Treatment);
            cmd.Parameters.AddWithValue("@MED", t.Medicine);
            cmd.Parameters.AddWithValue("@TDT", t.TreatmentDate);
            cmd.Parameters.AddWithValue("@AMT", t.Amount);
            try
            {
                cm.Open();
                cmd.ExecuteNonQuery();
                cmd      = new OleDbCommand("SELECT DMAX('ID', 'Treatments')", cm);
                sc.Count = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex) { sc.Message = ex.Message; }
            finally { cm.Close(); }
            return(sc);
        }
Пример #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ServerToClient   sc = new ServerToClient();
            TreatmentContext tx = new TreatmentContext();
            Treatments       t  = new Treatments();

            t.ID           = TID;
            t.PatientID    = PID;
            t.MainComplain = txtCMP.Text;
            t.Examination  = txtEXM.Text;
            t.Treatment    = txtTRM.Text;
            string med = null;

            for (int i = 0; i < lstMED.Items.Count; i++)
            {
                med += lstMED.Items[i].ToString() + ",";
            }
            med.Remove(med.Length - 1);
            t.Medicine      = med;
            t.TreatmentDate = dtpVST.DateTime;
            t.Amount        = Convert.ToDouble(txtAMT.Text);

            sc = tx.AddTreatment(t);

            if (sc.Message == null)
            {
                if (XtraMessageBox.Show("Patient data updated!\nDo you want to print?", "Print Report?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    new rptClinicReport(sc.Count).ShowPreviewDialog();
                    Close();
                }
                else
                {
                    XtraMessageBox.Show(sc.Message);
                }
            }
        }