コード例 #1
0
ファイル: UnitTest.cs プロジェクト: tynGuardian/OCMS
        public void saveConsultation()
        {
            ConsultationBusiness _bll = new ConsultationBusiness();
            var db = new ConsultationModel();

            db.ConsultatonId = "123GG";
            db.MemberCode    = "12345678";
            db.TimeIn        = DateTime.Now;
            db.TimeOut       = DateTime.Now;
            db.Complaints    = "head ache";
            db.Medicine      = "biogesic";
            db.Disposition   = "n/a";
            db.DiagCode      = "Dx8252"; //head ache due to sleep deprivation
            db.CreatedBy     = "knguardian";
            db.CreatedDate   = DateTime.Now;

            _bll.saveConsultation(db);

            Assert.AreEqual(true, true);
        }
コード例 #2
0
ファイル: frmConsultation.cs プロジェクト: tynGuardian/OCMS
        private void btnSaveConsultation_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.AppStarting;
            try
            {
                ConsultationModel consultationModel = new ConsultationModel();

                consultationModel.ConsultatonId = consultationID;
                consultationModel.GEID          = GEID;
                consultationModel.MemberCode    = membercode;
                consultationModel.TimeIn        = Convert.ToDateTime(txtTimeIn.Text);
                consultationModel.TimeOut       = Convert.ToDateTime(dtpTimeOut.Text + " " + dtpTimeOutTime.Text);
                consultationModel.Disposition   = cmbDisposition.Text.ToString();

                //getting listBoxComplaint items
                string complaints = "";
                foreach (var item in listComplaint.Items)
                {
                    complaints += item.ToString() + ",";
                }
                if (complaints == "")
                {
                    complaints = "";
                    consultationModel.Complaints = complaints;
                }
                else
                {
                    complaints = complaints.Remove(complaints.Length - 1);
                    consultationModel.Complaints = complaints;
                }

                //getting listViewMed items
                string medicine = "";
                foreach (ListViewItem itemRow in this.lvMedicine.Items)
                {
                    for (int i = 0; i < itemRow.SubItems.Count - 1; i++)
                    {
                        medicine += itemRow.Text + "," + itemRow.SubItems[1].Text + ",";
                    }
                }
                if (medicine == "")
                {
                    medicine = "";
                    consultationModel.Medicine = medicine;
                }
                else
                {
                    medicine = medicine.Remove(medicine.Length - 1);
                    consultationModel.Medicine = medicine;
                }

                consultationModel.CreatedBy   = clsGlobal.usercode;
                consultationModel.CreatedDate = DateTime.Now;

                if (clsGlobal.lblrole == "Doctor")
                {
                    //getting listViewMed items
                    string diagnosis = "";
                    foreach (ListViewItem itemRow in this.lvDiagnosis.Items)
                    {
                        for (int i = 0; i < itemRow.SubItems.Count - 1; i++)
                        {
                            diagnosis += itemRow.SubItems[1].Text + ",";
                        }
                    }
                    if (diagnosis == "")
                    {
                        diagnosis = "";
                        consultationModel.DiagCode = diagnosis;
                    }
                    else
                    {
                        diagnosis = diagnosis.Remove(diagnosis.Length - 1);
                        consultationModel.DiagCode = diagnosis;
                    }
                }

                _bll.saveConsultation(consultationModel);
                MessageBox.Show("Successfully saved!", "OCMS", MessageBoxButtons.OK);
                ClearAllText();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to saved" + ex.Message, "OCMS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Cursor.Current = Cursors.Default;
        }