Example #1
0
        private void LoadTokens()
        {
            //this.dgvTokens.Rows.Clear();
            patients = new PatientBLL().GetPatientLabTestDetail();
            this.dgvTokens.DataSource = null;
            this.dgvTokens.DataSource = patients;
            for (int i = 0; i < dgvTokens.Columns.Count; i++)
            {
                if (dgvTokens.Columns[i].Name != "TokenNumber" && dgvTokens.Columns[i].Name != "TokenDate")
                {
                    dgvTokens.Columns[i].Visible = false;
                }
                else
                {
                    dgvTokens.Columns[i].Width = 80;
                }
            }

            //for (int j = 0; j < patients.Count; j++)
            //{
            //    object[] values = { patients[j].TokenNumber, patients[j].TokenDate.ToShortDateString() };
            //    this.dgvTokens.Rows.Add(values);
            //    List<LabTest> labs = new InjectionLabTestBLL().GetLabTestAssigned(patients[j]);
            //    if (labs.Count > 0)
            //    {
            //        patients[j].LabTests = labs.Where(unperformed=>unperformed .IsTestPerformed == false).ToList<LabTest>();
            //    }
            //}
            if (patients.Count > 0)
            {
                pr = patients[0];
                DataGridViewPopulate(pr);
            }
        }
        private void PrintPreview(bool preview, PatientRegistration pr)
        {
            string BranchName    = ConfigurationManager.AppSettings["Name"].ToString();
            string BranchAddress = ConfigurationManager.AppSettings["Address"].ToString();

            prt = new DsPatientRegistration.PatientRegistrationDataTable();
            object[] values = { 0, pr.TokenDate, pr.TokenMonthYear, pr.TokenNumber, pr.Patient.FirstName, pr.Patient.LastName, pr.Patient.NIC, pr.Patient.Address, pr.TokenType, pr.CashReceived, pr.Room.Name, pr.Patient.RegistrationNumber, pr.Patient.RegistrationDate };
            prt.LoadDataRow(values, true);
            rptTokenReceipt crp = new rptTokenReceipt();

            crp.SetDataSource((DataTable)prt);
            crp.SetParameterValue("Duplicate", PrintDuplicate);
            crp.SetParameterValue("Name", BranchName);
            crp.SetParameterValue("Address", BranchAddress);
            FrmReportViewer frmViewer = new FrmReportViewer();

            frmViewer.crystalReportViewer1.ReportSource = crp;
            if (preview)
            {
                frmViewer.ShowDialog();
            }
            else
            {
                //frmViewer.crystalReportViewer1.RefreshReport();
                frmViewer.crystalReportViewer1.PrintReport();
            }
            PrintDuplicate = false;
        }
Example #3
0
        public bool SaveLabTestRemarks(PatientRegistration pr, LabTestRemarks Remarks)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand();
                cmd.Connection  = con;
                cmd.Transaction = tran;
                cmd.CommandText = "Update LabTestPerformed set Remarks='" + Remarks.Remarks + "',TestPerformed = " + Remarks.IsTestPerformed + " where TokenNumber=" + pr.TokenNumber + " and TokenDate='" + pr.TokenDate.ToShortDateString() + "' and TokenMonthYear=" + pr.TokenMonthYear + " and LabTestID=" + Remarks.LabTest.LabTestId;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }

            finally
            { con.Close(); }
        }
Example #4
0
 public bool PatientChecked(PatientRegistration pr)
 {
     try
     {
         string update = "Update PatientRegistration set Checked = " + true + " where TokenMonthYear="
                         + pr.TokenMonthYear + " and TokenNumber=" + pr.TokenNumber;
         con = new OleDbConnection();
         this.readconfile     = new ReadConfigFile();
         con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         con.Open();
         tran            = con.BeginTransaction();
         cmd             = new OleDbCommand(update, con);
         cmd.Transaction = tran;
         cmd.ExecuteNonQuery();
         tran.Commit();
         return(true);
     }
     catch (Exception ex)
     {
         tran.Rollback();
         throw ex;
     }
     finally
     { con.Close(); }
 }
Example #5
0
        public bool LabTestAssigned(PatientRegistration pr, List <LabTest> labs)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand();
                cmd.Connection  = con;
                cmd.Transaction = tran;
                foreach (LabTest lab in labs)
                {
                    //cmd.CommandText = "insert into LabTestPerformed (TokenDate,TokenMonthYear,TokenNumber,LabTestID,TestPerformed) values('" + pr.TokenDate.ToString("MM/dd/yyyy") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + lab.LabTestId + "," + 0 + ")";
                    cmd.CommandText = "insert into LabTestPerformed (TokenDate,TokenMonthYear,TokenNumber,LabTestID,TestPerformed,Room,DrName) values('" + pr.TokenDate.ToString("MM/dd/yyyy") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + lab.LabTestId + "," + 0 + ",'" + pr.Room.Name + "','" + pr.Room.LabelName + "')";
                    cmd.ExecuteNonQuery();
                }

                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }

            finally
            { con.Close(); }
        }
Example #6
0
 public List <PatientRegistration> GetPatientLabTestDetail()
 {
     try
     {
         string select = "select distinct TokenNumber,TokenDate,TokenMonthYear from LabTestPerformed ltp where TestPaid=1 and TestPerformed = 0";
         con = new OleDbConnection();
         this.readconfile     = new ReadConfigFile();
         con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         con.Open();
         cmd             = new OleDbCommand();
         cmd.CommandText = select;
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = con;
         dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             PatientRegistration pr = new PatientRegistration();
             pr.TokenDate      = Convert.ToDateTime(dr["TokenDate"]);
             pr.TokenMonthYear = Convert.ToInt64(dr["TokenMonthYear"]);
             pr.TokenNumber    = Convert.ToInt64(dr["TokenNumber"]);
             roomPatients.Add(pr);
         }
         dr.Close();
         return(roomPatients);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally { con.Close(); }
 }
Example #7
0
        public int GetNextTokenNumber(Room r)
        {
            PatientRegistration pr = new PatientRegistration();

            try
            {
                string select = "select min(tokenNumber) from patientregistration where TokenMonthYear="
                                + System.DateTime.Today.Month.ToString() + System.DateTime.Today.Year.ToString()
                                + " and Room='" + r.Name + "' and Checked=" + false;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                cmd = new OleDbCommand(select, con);
                if (DBNull.Value != (cmd.ExecuteScalar()))
                {
                    int NextTokenNumber = Convert.ToInt32(cmd.ExecuteScalar());
                    return(NextTokenNumber);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
        public bool MedicineCanceled(PatientRegistration pr, LabTest medicine)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran = con.BeginTransaction();
                string delete = "delete from MedicineIssuedByDoc where TokenDate='" + pr.TokenDate + "' and TokenMonthYear=" + pr.TokenMonthYear + " and TokenNumber=" + pr.TokenNumber + " and ID=" + medicine.MedicineIssuedSerialID;
                cmd             = new OleDbCommand();
                cmd.Connection  = con;
                cmd.Transaction = tran;
                cmd.CommandText = delete;
                cmd.ExecuteNonQuery();
                cmd.CommandText = "insert into MedicineIssued_Canceled(TokenDate,TokenMonthYear,TokenNumber,MedicineID,DosePerDay,MedicineCanceled) values('" + pr.TokenDate + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + medicine.LabTestId + "," + medicine.TimesADay + ",1)";
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }

            finally
            { con.Close(); }
        }
Example #9
0
        public bool PatientChecked(PatientRegistration pr, List <LabTest> medicines)
        {
            try
            {
                string update = "Update PatientRegistration set Checked = " + 1 + " where TokenMonthYear="
                                + pr.TokenMonthYear + " and TokenNumber=" + pr.TokenNumber;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(update, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                foreach (LabTest med in medicines)
                {
                    cmd.CommandText = "insert into MedicineIssuedByDoc (TokenDate,TokenMonthYear,TokenNumber,MedicineID,DosePerDay,Room,DrName) values('" + pr.TokenDate.ToString("MM/dd/yyyy") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + med.LabTestId + "," + med.TimesADay + ",'" + pr.Room.Name + "','" + pr.Room.LabelName + "')";
                    cmd.ExecuteNonQuery();
                }

                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }

            finally
            { con.Close(); }
        }
Example #10
0
 public bool SavePatientToken(PatientRegistration pr)
 {
     try
     {
         string insert = "Insert Into PatientRegistration(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName"
                         + ",PatientNIC,PatientAddress,PatientType,TokenAmount,Room,PatientRegistrationNumber,PatientRegistrationDate) "
                         + "values (#" + pr.TokenDate + "#," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','"
                         + pr.Patient.NIC + "','" + pr.Patient.Address + "','" + pr.TokenType.ToString() + "'," + (int)pr.TokenType + ",'"
                         + pr.Room.Name + "','" + pr.Patient.RegistrationNumber + "',#" + pr.Patient.RegistrationDate + "#)";
         con = new OleDbConnection();
         this.readconfile     = new ReadConfigFile();
         con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         con.Open();
         tran            = con.BeginTransaction();
         cmd             = new OleDbCommand(insert, con);
         cmd.Transaction = tran;
         cmd.ExecuteNonQuery();
         tran.Commit();
         return(true);
     }
     catch (Exception ex)
     {
         tran.Rollback();
         throw ex;
     }
     finally
     { con.Close(); }
 }
Example #11
0
        public bool LabTestCanceled(PatientRegistration pr, LabTest medicine)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran = con.BeginTransaction();
                string delete = "delete from LabTestPerformed where TokenDate='" + pr.TokenDate + "' and TokenMonthYear=" + pr.TokenMonthYear + " and TokenNumber=" + pr.TokenNumber + " and LabTestID=" + medicine.LabTestId;
                cmd             = new OleDbCommand(delete, con);
                cmd.Transaction = tran;
                //   cmd.ExecuteNonQuery();
                cmd.CommandText = "insert into LabTestPerformed_Canceled(TokenDate,TokenMonthYear,TokenNumber,LabTestID,TestCanceled) values('" + pr.TokenDate + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + "," + medicine.LabTestId + ",1)";
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }

            finally
            { con.Close(); }
        }
Example #12
0
        public ActionResult CreatePatient(Patient patient)
        {
            try
            {
                var userId         = Request.IsAuthenticated ? UserId : Guid.Empty;
                var roles          = new string[] { HospitalManagementSystem.Models.Constants.Roles.PATIENT };
                var registerHelper = new RegisterHelper(userId, patient.Person, roles);
                registerHelper.Register();

                if (!registerHelper.Response.Item1)
                {
                    patient.Person.Error = registerHelper.Response.Item2;
                    return(View(patient));
                }

                //PatientRegistration.Register(new Patient() { PersonId = patient.Person.Id });int personId = porter.Person.Id;
                int personId = patient.Person.Id;
                patient.PersonId = personId;
                patient.Person   = null;
                PatientRegistration.Register(patient);

                return(RedirectToAction("RegisterSuccess", "Account", new { statusMessage = registerHelper.Response.Item2 }));
            }
            catch
            {
                return(View());
            }
        }
Example #13
0
        private MongoCollection <PatientRegistration> Createpatient(PatientRegistration patient, MongoDatabase mongoDatabase)
        {
            MongoCollection <PatientRegistration> patientRegistration = mongoDatabase.GetCollection <PatientRegistration>("PatientRegistration");

            patientRegistration.Insert(patient);
            return(patientRegistration);
        }
Example #14
0
        public void GivenPatientWhenRegisteringThenPersistToDb()
        {
            HospitalManagementSystemContext HospitalManagementSystemContext = EntityFrameworkMock.Create <HospitalManagementSystemContext>();

            TypeFactory.RegisterInstance(HospitalManagementSystemContext);

            Patient patient = new Patient();

            patient.PersonId         = 1;
            patient.Person.Id        = 1;
            patient.Person.FirstName = "Vusi";
            patient.Person.Surname   = "Khoza";
            patient.Person.IdNumber  = "1234";

            IPatientRepository   patientRepository   = new PatientRepository();
            IPatientRegistration patientRegistration = new PatientRegistration(patientRepository);

            patientRegistration.Register(patient);

            IPatientRetriever patientRetriever = new PatientRetriever(patientRepository);

            patientRetriever.Retrieve(patient.Person.IdNumber);

            Assert.IsNotNull(patientRetriever.Patient);
            Assert.AreEqual(patient.Person.Id, patientRetriever.Patient.Person.Id);
            Assert.AreEqual(patient.Person.FirstName, patientRetriever.Patient.Person.FirstName);
            Assert.AreEqual(patient.Person.Surname, patientRetriever.Patient.Person.Surname);
        }
Example #15
0
 private void dgvTokens_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvTokens.RowCount > 0)
     {
         pr = patients[e.RowIndex];
         DataGridViewPopulate(pr);
     }
 }
Example #16
0
 private void PopulatePatientDetails(PatientRegistration pr)
 {
     this.txtPatientName.Text = pr.Patient.FirstName + " " + pr.Patient.LastName;
     this.txtPatientRegistrationNumber.Text = pr.Patient.RegistrationNumber;
     this.txtPatientDetails.Text           += "CNIC #:" + pr.Patient.NIC + Environment.NewLine;
     this.txtPatientDetails.Text           += "Address :" + pr.Patient.Address + Environment.NewLine;
     this.txtPatientDetails.Text           += "Type :" + pr.TokenType.ToString() + Environment.NewLine;
 }
Example #17
0
        public ActionResult EditPatientInfo(PatientRegistration model, string patientId)
        {
            MongoCollection <PatientRegistration> patientRegistration = database().GetCollection <PatientRegistration>("PatientRegistration");
            var query  = Query.EQ("_id", ObjectId.Parse(patientId));
            var update = Update.Set("Email", model.Email).Set("Password", model.Password);

            patientRegistration.Update(query, update);
            return(RedirectToAction("ListPatients", "Doctors"));
        }
Example #18
0
        private void NextTokenData()
        {
            long nextTokenNumber = pbll.GetNextTokenNumber(CurrentRoom);

            pr = pbll.GetPatientDetail(nextTokenNumber, CurrentRoom);
            this.lblCurrentTokenNumber.Text = nextTokenNumber.ToString("0000");
            PopulatePatientDetails(pr);
            // comm.WriteDataWithoutDisplay("*" + this.lblCurrentTokenNumber.Text + "#");
        }
        private void tsSave_Click(object sender, EventArgs e)
        {
            PatientRegistration pr = new PatientRegistration();

            try
            {
                // pr.TokenDate = System.DateTime.Today;
                pr.TokenDate = System.DateTime.Now;
                int num = 0;
                List <InjectionLabTest> ilt = new List <InjectionLabTest>();
                ilt            = new InjectionLabTestBLL().GetTokenNum(pr.TokenDate);
                pr.TokenNumber = Convert.ToInt64(this.lblCurrentTokenNumber.Text.Trim());
                // pr.TokenNumber = ilt[0].TokenNumber+1;
                pr.TokenType = (rbGeneral.Checked) ? TokenType.General : (rbPoor.Checked) ? TokenType.Poor : TokenType.Private;
                //pr.TokenType = (rbGeneral.Checked) ? TokenType.General : TokenType.Private;------------------->>>>>>>>>
                pr.CashReceived               = Convert.ToDouble(this.txtCashRecieved.Text.Trim());
                pr.Patient.FirstName          = this.txtPatientFirstName.Text;
                pr.Patient.LastName           = this.txtPatientLastName.Text;
                pr.Patient.NIC                = this.txtPatientCNIC.Text;
                pr.Patient.Age                = Convert.ToInt16(this.txtPatientAge.Text);
                pr.Patient.Mobile             = this.txtPatientMobile.Text;
                pr.Patient.RegistrationDate   = this.dtpPatientRegistrationDate.Value.Date;
                pr.Patient.RegistrationNumber = this.txtPateintRegistrationNumber.Text;
                pr.Patient.Address            = this.txtPatientAddress.Text;
                pr.TokenMonthYear             = Convert.ToInt64(DateTime.Today.Month.ToString() + DateTime.Today.Year.ToString());

                string BranchCode = ConfigurationManager.AppSettings["BranchCode"].ToString();
                pr.Patient.RegistrationNumber = BranchCode;

                pr.TokenBy = IsLoginUser;
                if (this.lstRooms.SelectedItem != null)
                {
                    pr.Room = (Room)this.lstRooms.SelectedItem;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Patient Registration Data");
            }
            try
            {
                if (pbll.SavePatientToken(pr))
                {
                    PrintPreview(false, pr);
                    GetNextTokenNumber();
                    NewPatient();
                    MessageBox.Show("Patient Registered Successfully", "Token Granted");
                    this.txtPatientFirstName.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Save Patient Registration Error");
            }
            // }
        }
Example #20
0
        private void RegisterPatient_Click(object sender, EventArgs e)
        {
            this.Hide();
            PatientRegistration patientView = new PatientRegistration();

            radiantDentalPracticePresenter.registerPatient(patientView);
            patientView.ShowDialog();

            this.Close();
        }
 private void dgvTokens_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvTokens.RowCount > 0)
     {
         pr = patients[e.RowIndex];
         long nextTokenNumber = pr.TokenNumber;
         PopulatePatientDetails(pr);
         CurrentAdmission.PatientRegistration = pr;
     }
 }
Example #22
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     frm.doctor = true;
     frm.ShowDialog();
     if (frm.pr != null)
     {
         prCancel = frm.pr;
         PopulateExistingToken();
     }
 }
Example #23
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (Reprint == true)
     {
         Int64 tNo = 0, mYNo = 0;
         Int64.TryParse(txtTokenNo.Text, out tNo);
         InjectionLabTestBLL inLabBll = new InjectionLabTestBLL();
         PatientRegistration pr = inLabBll.GetPatientRegistration(new PatientRegistration(tNo, Convert.ToInt64(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year)));
         if (pr.Patient.RegistrationNumber != null && pr.Patient.RegistrationNumber != "")
         {
             this.pr = pr;
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid token no. for selected month and year");
             txtTokenNo.Text = "0";
         }
     }
     else
     {
         Int64 tNo = 0, mYNo = 0;
         Int64.TryParse(txtTokenNo.Text, out tNo);
         InjectionLabTestBLL inLabBll = new InjectionLabTestBLL();
         InjectionLabTest    inLb = inLabBll.GetInjectionLabTest(new InjectionLabTest(tNo, Convert.ToInt64(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year)));
         if (inLb.Patient.RegistrationNumber != null && inLb.Patient.RegistrationNumber != "")
         {
             this.inLb = inLb;
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid token no. for selected month and year");
         }
     }
     if (doctor)
     {
         Int64 tNo = 0, mYNo = 0;
         Int64.TryParse(txtTokenNo.Text, out tNo);
         InjectionLabTestBLL inLabBll = new InjectionLabTestBLL();
         InjectionLabTest    inLb = inLabBll.GetInjectionLabTest(new InjectionLabTest(tNo, Convert.ToInt32(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year)));
         PatientRegistration pr = inLabBll.GetPatientRegistration(new PatientRegistration(tNo, Convert.ToInt32(dateTimePicker1.Value.Month + "" + dateTimePicker1.Value.Year)));
         if (pr.Patient.RegistrationNumber != null && pr.Patient.RegistrationNumber != "")
         {
             this.pr   = pr;
             this.inLb = inLb;
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid token no. for selected month and year");
             txtTokenNo.Text = "0";
         }
     }
 }
Example #24
0
 private void btnThirdExistingToken_Click(object sender, EventArgs e)
 {
     frm3rd         = new FrmExistingToken();
     frm3rd.Reprint = true;
     frm3rd.ShowDialog();
     if (frm3rd.pr != null)
     {
         prCancel = frm3rd.pr;
         PopulateExistingToken3rd();
     }
 }
Example #25
0
        private void NextTokenData()
        {
            rbOneDay.Checked = true;
            lstLabTest.Items.Clear();
            lstLabTestId.Items.Clear();
            long nextTokenNumber = pbll.GetNextTokenNumber(CurrentRoom);

            pr = pbll.GetPatientDetail(nextTokenNumber, CurrentRoom);
            this.lblCurrentTokenNumber.Text = nextTokenNumber.ToString("00000");
            PopulatePatientDetails(pr);
            // comm.WriteDataWithoutDisplay("*" + this.lblCurrentTokenNumber.Text + "#");
        }
Example #26
0
        public ActionResult AddPatient(PatientRegistration patient)
        {
            var db = database();

            patient.DoctorId = ((CustomPrincipal)HttpContext.User).UserId;

            var patientid = ReadPatientRegisterationTable(db).FindAll().Select(s => s.DoctorId == patient.DoctorId).Count();

            patient.PatientId = "PA" + patient.DoctorId + patientid;
            Createpatient(patient, db);

            return(RedirectToAction("ListPatients", "Doctors"));
        }
Example #27
0
        public ActionResult AddPatient(PatientRegistration patient)
        {
            var db = database();

            patient.DoctorId = ((CustomPrincipal)HttpContext.User).UserId;

            var patientid = ReadPatientRegisterationTable(db).FindAll().Count();

            patient.PatientId = "PA" + patientid.ToString("D4");
            Createpatient(patient, db);
            this.AddToastMessage("Patient Created", "Add New Patient", ToastType.Info);
            return(RedirectToAction("ListPatients", "Doctors"));
        }
Example #28
0
 private void dgvTokens_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvTokens.RowCount > 0)
     {
         pr = patients[e.RowIndex];
         long nextTokenNumber = pr.TokenNumber;
         this.lblCurrentTokenNumber.Text = nextTokenNumber.ToString("00000");
         //this.lblToDate.Text = pr.TokenDate.ToShortDateString();
         this.lblToDate.Text = pr.TokenDate.ToShortDateString();
         PopulatePatientDetails(pr);
         this.lbxLabTest.Items.Clear();
         LoadLabTests(pr);
     }
 }
Example #29
0
        private void LoadLabTests(PatientRegistration pr)
        {
            this.lbxLabTest.Items.Clear();
            List <LabTest> labs = new InjectionLabTestBLL().GetLabTestAssigned(pr);

            pr.LabTests = labs;
            if (pr.LabTests.Count > 0)
            {
                foreach (LabTest lbt in pr.LabTests)
                {
                    this.lbxLabTest.Items.Add(lbt);
                }
            }
        }
Example #30
0
        public bool SavePatientToken(PatientRegistration pr)
        {
            try
            {
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();

                tran = con.BeginTransaction();
                int VID = 0;
                cmd             = new OleDbCommand("Select Max(tokennumber) From patientregistration where TokenMonthYear=" + pr.TokenMonthYear + "", con);
                cmd.Transaction = tran;

                if (DBNull.Value != (cmd.ExecuteScalar()))
                {
                    VID            = Convert.ToInt32(cmd.ExecuteScalar());
                    pr.TokenNumber = VID + 1;
                }
                else
                {
                    pr.TokenNumber = 1;
                }


                pr.Patient.RegistrationNumber = pr.TokenNumber + "" + pr.TokenMonthYear + "" + pr.Patient.RegistrationNumber;

                string insert = "Insert Into PatientRegistration(TokenDate,TokenMonthYear,TokenNumber,PatientFirstName,PatientLastName,PatientNIC"
                                + ",PatientAge,PatientMobile,PatientAddress,PatientType,TokenAmount,Room,PatientRegistrationNumber,PatientRegistrationDate,Shift,TokenBy,DrName) "
                                + "values ('" + pr.TokenDate.ToString("MM/dd/yyyy HH:mm:ss") + "'," + pr.TokenMonthYear + "," + pr.TokenNumber + ",'" + pr.Patient.FirstName + "','" + pr.Patient.LastName + "','" + pr.Patient.NIC + "',"
                                + pr.Patient.Age + ",'" + pr.Patient.Mobile + "','" + pr.Patient.Address + "','" + pr.TokenType.ToString() + "'," + (int)pr.TokenType + ",'"
                                + pr.Room.Name + "','" + pr.Patient.RegistrationNumber + "','" + pr.Patient.RegistrationDate.ToString("MM/dd/yyyy") + "'," + new ShiftDAL().GetActiveShiftCode().ID + "," + pr.TokenBy.Userno + ",'" + pr.Room.LabelName + "' )";

                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            { con.Close(); }
        }
 private void btnNewPatientReg_Click(object sender, RoutedEventArgs e)
 {
     PatientRegistration register = new PatientRegistration(this.HomeWindow);
     register.Show();
     this.Close();
 }