Esempio n. 1
0
        /// <summary>
        /// Удалить выделенного пациента
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                int currentNumber = PatientList.CurrentCellAddress.Y;
                if (currentNumber < 0)
                {
                    MessageBox.Show("Нет выделенных записей", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                PatientClass patientInfo = GetSelectedPatient();
                if (patientInfo.OpenedPatientViewForm != null && !patientInfo.OpenedPatientViewForm.IsDisposed)
                {
                    MessageBox.Show("Данный пациент заблокирован для удаления,\r\nтак как он в данный момент редактируется.\r\nЗакройте окно просмотра информации по данному пациенту\r\nи попробуйте ещё раз.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (DialogResult.Yes == MessageBox.Show("Вы уверены, что хотите удалить все данные о пациенте " + patientInfo.GetFullName() + "?\r\nДанная операция необратима.", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    _dbEngine.RemovePatient(patientInfo.Id);
                }

                ShowPatients();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Положить введённые данные в операцию и пациента
        /// </summary>
        /// <param name="operationInfo">Информация про операцию</param>
        /// <param name="patientInfo">Информация о пациенте</param>
        private void PutDataToOperationAndPatient(OperationClass operationInfo, PatientClass patientInfo)
        {
            operationInfo.BeforeOperationEpicrisisIsDairyEnabled = checkBoxDnevnik.Checked;

            operationInfo.BeforeOperationEpicrisisADFirst     = (int)numericUpDownADFirst.Value;
            operationInfo.BeforeOperationEpicrisisADSecond    = (int)numericUpDownADSecond.Value;
            operationInfo.BeforeOperationEpicrisisBreath      = comboBoxBreath.Text;
            operationInfo.BeforeOperationEpicrisisChDD        = (int)numericUpDownChDD.Value;
            operationInfo.BeforeOperationEpicrisisComplaints  = textBoxComplaints.Text;
            operationInfo.BeforeOperationEpicrisisState       = comboBoxState.Text;
            operationInfo.BeforeOperationEpicrisisHeartRhythm = comboBoxHeartRhythm.Text;
            operationInfo.BeforeOperationEpicrisisHeartSounds = comboBoxHeartSounds.Text;
            operationInfo.BeforeOperationEpicrisisPulse       = (int)numericUpDownPulse.Value;
            operationInfo.BeforeOperationEpicrisisStLocalis   = textBoxStLocalis.Text;
            operationInfo.BeforeOperationEpicrisisStomach     = textBoxStomach.Text;
            operationInfo.BeforeOperationEpicrisisStool       = textBoxStool.Text;
            operationInfo.BeforeOperationEpicrisisTemperature = textBoxTemperature.Text;
            operationInfo.BeforeOperationEpicrisisUrination   = textBoxUrination.Text;
            operationInfo.BeforeOperationEpicrisisWheeze      = textBoxWheeze.Text;

            patientInfo.IsTreatmentPlanActiveInOperationProtocol = checkBoxPlan.Checked;
            patientInfo.TreatmentPlanInspection = comboBoxInspectionPlan.Text;
            patientInfo.TreatmentPlanDate       = dateTimePickerDatePlan.Value;

            operationInfo.BeforeOperationEpicrisisIsAntibioticProphylaxisExist = checkBoxAntibioticProphylaxis.Checked;
            operationInfo.BeforeOperationEpicrisisAntibioticProphylaxis        = comboBoxAntibioticProphylaxis.Text;

            operationInfo.OperationCourse = textBoxOperationCourse.Text.TrimEnd(new[] { '\r', '\n' });
        }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Data loading for the DataList1*/
        try
        {
            PatientClass pc = new PatientClass();

            String    username = Session["username"].ToString();
            DataTable dt       = pc.checkUpHistory(username);
            if (dt.Rows.Count > 0)
            {
                ltrMessage.Text = "";

                DataList1.DataSource = dt;
                DataList1.DataBind();
            }
            else
            {
                DataList1.DataSource = dt;
                DataList1.DataBind();
                ltrMessage.Text = "No any data before!";
            }
        }

        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
    /*Making this function to work independently for Loading Data*/
    protected void loadData()
    {
        try
        {
            PatientClass hc = new PatientClass();

            DataTable dt = hc.SelectForViewPatientRecords();
            if (dt.Rows.Count > 0)
            {
                ltrMessage.Text = "";

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
                ltrMessage.Text = "No data found!";
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
    protected void lnkbtn_B_Click(object sender, EventArgs e)
    {
        try
        {
            PatientClass pc = new PatientClass();

            DataTable dt = pc.SelectForViewPatientRecords_SpecificLetter("B");
            if (dt.Rows.Count > 0)
            {
                ltrMessage.Text      = "";
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
                ltrMessage.Text = "No data found!";
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Data loading for the Labels*/
        try
        {
            PatientClass pc = new PatientClass();

            String    selectedRow_Username = Session["selectedRow_Username"].ToString();
            DataTable dt = pc.patientDetails_ForDoctor(selectedRow_Username);
            if (dt.Rows.Count > 0)
            {
                Session["selected_Username"] = dt.Rows[0]["Username"].ToString();
                Session["selected_Name"]     = dt.Rows[0]["Name"].ToString();
                Session["selected_Dob"]      = dt.Rows[0]["Dob"].ToString();
                Session["selected_AgeGrp"]   = dt.Rows[0]["AgeGrp"].ToString();
                Session["selected_Sex"]      = dt.Rows[0]["Sex"].ToString();

                ltrMessage1.Text  = "";
                lbl_Username.Text = Session["selected_Username"].ToString();
                lbl_Name.Text     = Session["selected_Name"].ToString();
                lbl_Dob.Text      = Session["selected_Dob"].ToString();
                lbl_AgeGrp.Text   = Session["selected_AgeGrp"].ToString();
                lbl_Gender.Text   = Session["selected_Sex"].ToString();
            }
            else
            {
                ltrMessage1.Text = "No data found!";
            }
        }
        catch (Exception ex)
        {
            ltrMessage1.Text = ex.Message;
        }

        /*Data loading for the Gridview1*/
        try
        {
            PatientClass pc = new PatientClass();

            String    selectedRow_Username = Session["selectedRow_Username"].ToString();
            DataTable dt = pc.checkUpHistory(selectedRow_Username);
            if (dt.Rows.Count > 0)
            {
                ltrMessage.Text = "";

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
                ltrMessage.Text = "No any checkup history before!";
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Data loading for the DataList1*/
        try
        {
            PatientClass pc = new PatientClass();
            UserClass    uc = new UserClass();

            String    selectedRow_Username = Session["selectedRow_Username"].ToString();
            DataTable dt1 = uc.GetUserIdFromUsername(selectedRow_Username);
            if (dt1.Rows.Count > 0)
            {
                Session["selectedRow_UserId"] = dt1.Rows[0]["userId"].ToString();
                int       selectedRow_UserId = Convert.ToInt32(Session["selectedRow_UserId"].ToString());
                DataTable dt = pc.logOfPatient(selectedRow_UserId);
                if (dt.Rows.Count > 0)
                {
                    ltrMessage.Text = "";

                    DataList1.DataSource = dt;
                    DataList1.DataBind();
                }
                else
                {
                    DataList1.DataSource = dt;
                    DataList1.DataBind();
                    ltrMessage.Text = "No any data!";
                }
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
        /// <summary>
        /// Сгенерировать отчёт в Worde
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonDocuments_Click(object sender, EventArgs e)
        {
            var tempPatientInfo = new PatientClass(_patientInfo);

            PutDataToPatient(tempPatientInfo);

            WordExportEngine.ExportLineOfCommunicationEpicrisis(tempPatientInfo, _dbEngine.GlobalSettings);
        }
Esempio n. 9
0
        /// <summary>
        /// Сгенерировать лист дополнительных методов обследования в ворде
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonExportSurveys_Click(object sender, EventArgs e)
        {
            var tempPatientInfo = new PatientClass(_patientInfo);

            PutDataToSurveys(tempPatientInfo);

            new WordExportEngine(_dbEngine).ExportSurveys(tempPatientInfo);
        }
Esempio n. 10
0
        /// <summary>
        /// Сгенерировать лист назначений в ворде
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonExportPrescriptionList_Click(object sender, EventArgs e)
        {
            var tempPatientInfo = new PatientClass(_patientInfo);

            PutDataToPescriptionTherapy(tempPatientInfo);

            new WordExportEngine(_dbEngine).ExportPrescriptionTherapy(tempPatientInfo);
        }
Esempio n. 11
0
 /// <summary>
 /// Заполнить список дополнительных методов обследования
 /// </summary>
 /// <param name="patientInfo"></param>
 private void PutDataToSurveys(PatientClass patientInfo)
 {
     patientInfo.PrescriptionSurveys = new List <string>();
     foreach (DataGridViewRow row in SurveyList.Rows)
     {
         patientInfo.PrescriptionSurveys.Add(GetValue(row.Cells[0]) + "&" + GetValue(row.Cells[1]));
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Заполнить список терапии
 /// </summary>
 /// <param name="patientInfo"></param>
 private void PutDataToPescriptionTherapy(PatientClass patientInfo)
 {
     patientInfo.PrescriptionTherapy = new List <string>();
     foreach (DataGridViewRow row in TherapyList.Rows)
     {
         patientInfo.PrescriptionTherapy.Add(GetValue(row.Cells[0]) + "&" + GetValue(row.Cells[1]) + "&" + GetValue(row.Cells[2]));
     }
 }
Esempio n. 13
0
        /// <summary>
        /// Сгенерировать отчёт в Worde
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonDocuments_Click(object sender, EventArgs e)
        {
            var tempPatientInfo = new PatientClass(_patientInfo);

            PutDataToPatient(tempPatientInfo);

            new WordExportEngine(_dbEngine).ExportMedicalInspection(tempPatientInfo);
        }
        /// <summary>
        /// Сгенерировать отчёт в Worde
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonDocuments_Click(object sender, EventArgs e)
        {
            var tempPatientInfo = new PatientClass(_patientInfo);

            PutDataToPatient(tempPatientInfo);

            new WordExportEngine(_dbEngine).ExportTransferableEpicrisis(tempPatientInfo);
        }
Esempio n. 15
0
        /// <summary>
        /// Положить введённые данные в пациента
        /// </summary>
        /// <param name="patientInfo"></param>
        private void PutDataToPatient(PatientClass patientInfo)
        {
            patientInfo.MedicalInspectionIsPlanEnabled  = checkBoxIsPlanEnabled.Checked;
            patientInfo.MedicalInspectionInspectionPlan = comboBoxInspectionPlan.Text;
            patientInfo.MedicalInspectionComplaints     = textBoxComplaints.Text;
            patientInfo.MedicalInspectionTeoRisk        = comboBoxTeoRisk.Text;

            if (radioButtonLnWithNumber.Checked)
            {
                patientInfo.MedicalInspectionExpertAnamnese = 1;
            }
            else if (radioButtonNewLn.Checked)
            {
                patientInfo.MedicalInspectionExpertAnamnese = 2;
            }
            else
            {
                patientInfo.MedicalInspectionExpertAnamnese = 3;
            }

            patientInfo.MedicalInspectionLnWithNumberDateStart = dateTimePickerLnWithNumberStart.Value;
            patientInfo.MedicalInspectionLnWithNumberDateEnd   = dateTimePickerLnWithNumberEnd.Value;
            patientInfo.MedicalInspectionLnFirstDateStart      = dateTimePickerLnFirstStart.Value;
            patientInfo.MedicalInspectionStLocalisDescription  = textBoxStLocalisDescription.Text;
            patientInfo.MedicalInspectionStLocalisRentgen      = comboBoxRentgen.Text;

            patientInfo.MedicalInspectionIsAnamneseActive = checkBoxIsAnamnezEnabled.Checked;
            if (dateTimePickerDateTrauma.Checked)
            {
                patientInfo.MedicalInspectionAnamneseTraumaDate = dateTimePickerDateTrauma.Value;
            }
            else
            {
                patientInfo.MedicalInspectionAnamneseTraumaDate = null;
            }

            patientInfo.MedicalInspectionAnamneseAnMorbi    = textBoxAnMorbi.Text;
            patientInfo.MedicalInspectionAnamneseAnVitae    = GetCheckBoxes(groupBoxAnVitae.Controls, 13, 4);
            patientInfo.MedicalInspectionAnamneseTextBoxes  = GetTextBoxes(tabPageAnamnes.Controls, 1, 8);
            patientInfo.MedicalInspectionAnamneseCheckboxes = GetCheckBoxes(tabPageAnamnes.Controls, 1, 12);

            patientInfo.MedicalInspectionStPraesensComboBoxes     = GetComboBoxes(tabPageStPraesens.Controls, 1, 4);
            patientInfo.MedicalInspectionStPraesensTextBoxes      = GetTextBoxes(tabPageStPraesens.Controls, 9, 17);
            patientInfo.MedicalInspectionStPraesensNumericUpDowns = GetNumericUpDowns(tabPageStPraesens.Controls, 1, 4);
            patientInfo.MedicalInspectionStPraesensOthers         = textBoxStPraesensOther.Text;

            patientInfo.MedicalInspectionIsStLocalisPart1Enabled        = checkBoxIsUpperExtremityJoint.Checked;
            patientInfo.MedicalInspectionStLocalisPart1OppositionFinger = comboBoxOppositionFinger.Text;
            patientInfo.MedicalInspectionStLocalisPart1Fields           = GetTextBoxes(tabPageStLocalis1.Controls, 26, 62);

            patientInfo.MedicalInspectionIsStLocalisPart2Enabled     = checkBoxIsHandDamage.Checked;
            patientInfo.MedicalInspectionStLocalisPart2WhichHand     = comboBoxWhichHand.Text;
            patientInfo.MedicalInspectionStLocalisPart2ComboBoxes    = GetComboBoxes(tabPageStLocalis2.Controls, 7, 10);
            patientInfo.MedicalInspectionStLocalisPart2TextBoxes     = GetTextBoxes(tabPageStLocalis2.Controls, 100, 11);
            patientInfo.MedicalInspectionStLocalisPart2NumericUpDown = (int)numericUpDown5.Value;
            patientInfo.MedicalInspectionStLocalisPart2LeftHand      = GetComboBoxes(groupBoxLeftHand.Controls, 100, 24);
            patientInfo.MedicalInspectionStLocalisPart2RightHand     = GetComboBoxes(groupBoxRightHand.Controls, 200, 24);
        }
 /// <summary>
 /// Положить введённые данные в пациента
 /// </summary>
 /// <param name="patientInfo"></param>
 private void PutDataToPatient(PatientClass patientInfo)
 {
     patientInfo.TransferEpicrisAdditionalInfo       = textBoxAdditionalInfo.Text;
     patientInfo.TransferEpicrisAfterOperationPeriod = textBoxAfterOperationPeriod.Text;
     patientInfo.TransferEpicrisPlan                    = textBoxPlan.Text;
     patientInfo.TransferEpicrisWritingDate             = dateTimePickerDateWriting.Value;
     patientInfo.TransferEpicrisDisabilityList          = textBoxDisabilityList.Text;
     patientInfo.TransferEpicrisIsIncludeDisabilityList = checkBoxDisabilityList.Checked;
 }
Esempio n. 17
0
        private void buttonDocuments_Click(object sender, EventArgs e)
        {
            var tempOperationInfo = new OperationClass(_operationInfo);
            var tempPatientInfo   = new PatientClass(_patientInfo);

            PutDataToOperationAndPatient(tempOperationInfo, tempPatientInfo);

            new WordExportEngine(_dbEngine).ExportOperationProtocol(tempOperationInfo, tempPatientInfo);
        }
Esempio n. 18
0
        public PrescriptionForm(DbEngine dbEngine, PatientClass patientInfo)
        {
            _stopSaveParameters = true;

            InitializeComponent();

            _dbEngine    = dbEngine;
            _patientInfo = patientInfo;
        }
Esempio n. 19
0
        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="ID">Patient ID</param>
        /// <param name="patientClass">Patient class of patient</param>
        public EntityPatient(int ID, PatientClass patientClass)
            : base(ID)
        {
            _patientClass        = patientClass;
            _correspondingDoctor = null;
            _staysInBed          = false;

            DataEntries.Add("TotalWait", 0d);
        } // end of EntityPatient
Esempio n. 20
0
        public DischargeEpicrisisForm(PatientClass patientInfo, DbEngine dbEngine)
        {
            _stopSaveParameters = true;

            InitializeComponent();

            _dbEngine    = dbEngine;
            _patientInfo = patientInfo;
        }
        public LineOfCommunicationEpicrisisForm(PatientClass patientInfo, DbEngine dbEngine)
        {
            _stopSaveParameters = true;

            InitializeComponent();

            _dbEngine    = dbEngine;
            _patientInfo = patientInfo;
        }
Esempio n. 22
0
        public MedicalInspectionForm(PatientClass patientInfo, DbEngine dbEngine)
        {
            _stopSaveParameters = true;

            InitializeComponent();

            _dbEngine    = dbEngine;
            _patientInfo = patientInfo;
        }
Esempio n. 23
0
        public OperationProtocolForm(OperationClass operationInfo, PatientClass patientInfo, DbEngine dbEngine)
        {
            _stopSaveParameters = true;

            InitializeComponent();

            _dbEngine      = dbEngine;
            _operationInfo = operationInfo;
            _patientInfo   = patientInfo;
        }
Esempio n. 24
0
        public DocumentsForm(PatientViewForm patientViewForm, PatientClass patientInfo, GlobalSettingsClass globalSettings)
        {
            InitializeComponent();

            _patientViewForm = patientViewForm;
            _patientInfo     = patientInfo;
            _globalSettings  = globalSettings;
            _patientViewForm.SelectedDocument = string.Empty;
            _additionalDocumentsFolderPath    = Path.Combine(Application.StartupPath, AdditionalDocumentsFolderName);
        }
Esempio n. 25
0
        public DocumentsForm(PatientViewForm patientViewForm, PatientClass patientInfo, DbEngine dbEngine)
        {
            InitializeComponent();

            _patientViewForm = patientViewForm;
            _patientInfo     = patientInfo;
            _dbEngine        = dbEngine;
            _patientViewForm.SelectedDocument = string.Empty;
            _additionalDocumentsFolderPath    = Path.Combine(Application.StartupPath, AdditionalDocumentsFolderName);
        }
Esempio n. 26
0
        } // end of CreateOutpatientTreatmentPath

        #endregion

        #region GetNextWaitingListPatient

        /// <summary>
        /// Stream of patients arriving at the waiting list , for this example exponential interarrival time
        /// and patients arrive 24/7
        /// </summary>
        /// <param name="arrivalTime">Arrival time of next patient</param>
        /// <param name="admission">Admission type of next patient</param>
        /// <param name="parentControlUnit">Control unit of outpatient department</param>
        /// <param name="currentTime">Current time</param>
        /// <returns>Next patient with associated patient class</returns>
        public EntityPatient GetNextWaitingListPatient(out DateTime arrivalTime, out Admission admission, ControlUnit parentControlUnit, DateTime currentTime)
        {
            PatientClass newPatientClass = (PatientClass)PatientClassPerXmlPatientClass[PatientClassDistribution.GetRandomValue()].Clone();

            EntityPatient patient = new EntityPatient(EntityPatient.RunningPatientID++, newPatientClass);

            admission   = new Admission(patient, new OutpatientAdmissionTypes("SurgicalOutpatient"), 0, 100, true);
            arrivalTime = currentTime + TimeSpan.FromMinutes(Distributions.Instance.Exponential(400));

            return(patient);
        } // end of GetNextWaitingListPatient
Esempio n. 27
0
        public OperationForm(PatientViewForm patientViewForm, DbEngine dbEngine, PatientClass patientInfo)
        {
            _stopSaveParameters = true;
            InitializeComponent();

            _patientInfo     = patientInfo;
            _dbEngine        = dbEngine;
            _patientViewForm = patientViewForm;

            Text = "Список операций для " + _patientInfo.GetFullName();
        }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        try
        {
            int              selected_userId;
            UserClass        uc  = new UserClass();
            PatientClass     pc  = new PatientClass();
            UserPatientClass upc = new UserPatientClass();
            LogUserClass     luc = new LogUserClass();
            LogPatientClass  lpc = new LogPatientClass();

            /*Delete Users' and Patient's record
             * Insert values on Log_UsersWholeFieldWithName and Log_PatientWholeFieldWithName table*/
            /*Getting userId from username from Users table*/
            DataTable dt = uc.SelectAllUsersFromUsername(Session["selectedRow_Username"].ToString());
            if (dt.Rows.Count > 0)
            {
                Session["selected_userId"] = dt.Rows[0]["userId"].ToString();
                selected_userId            = Convert.ToInt32(Session["selected_userId"]);

                /*Getting patientRecord from userId from Patient table*/
                DataTable dtPatient = pc.SelectAllPatientFromUserId(selected_userId);
                if (dtPatient.Rows.Count > 0)
                {
                    Session["selected_patientId"] = dtPatient.Rows[0]["patientId"].ToString();
                    int selected_patientId = Convert.ToInt32(Session["selected_patientId"]);

                    String selected_patientFirstName  = dtPatient.Rows[0]["patientFirstName"].ToString();
                    String selected_patientMiddleName = dtPatient.Rows[0]["patientMiddleName"].ToString();
                    String selected_patientLastName   = dtPatient.Rows[0]["patientLastName"].ToString();
                    Session["selected_patientName"] = selected_patientFirstName + " "
                                                      + selected_patientMiddleName + " " + selected_patientLastName;

                    luc.insertOn_Log_UsersWholeFieldWithName_WithDeleteOperation(selected_userId, Session["selectedRow_Username"].ToString());
                    lpc.insertOn_Log_PatientWholeFieldWithName_WithDeleteOperation(selected_userId, selected_patientId, Session["selected_patientName"].ToString());
                    uc.delete_UsersFrom_userId(selected_userId);
                    pc.delete_PatientFrom_userId(selected_userId);
                }
                //else { ltrMessage.Text = "Error 2nd if"; }
            }
            //else { ltrMessage.Text += "Error 1st if"; }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
        finally
        {
            ltrDelMsg.Visible = false;
            btnOk.Visible     = false;
            loadData();
        }
    }
    /*Insert on Log_PatientWholeField table with the insert Operation */
    public void insertOn_Log_PatientWholeField_WithInsertOperation(String username)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.Connection = gc.cn;

        String patientWholeFieldLog_Date;
        String patientWholeFieldLog_Operation = "Insert";

        /*Current date and time calculated*/
        DateTime currentDateNTime = DateTime.Now;

        patientWholeFieldLog_Date = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt");

        cmd.CommandText = "sp_Log_patientWholeField";
        cmd.CommandType = CommandType.StoredProcedure;

        /*Getting Patient Id from Patient's username and putting that userId value*/
        try
        {
            UserClass    uc = new UserClass();
            PatientClass pc = new PatientClass();
            int          userId, patientId;

            DataTable dt = uc.GetUserIdFromUsername(username);
            if (dt.Rows.Count > 0)
            {
                String userIdString = dt.Rows[0]["userId"].ToString();
                userId = Convert.ToInt32(userIdString);
                cmd.Parameters.Add("@userId", userId);

                /*Getting Patient Id from Patient's userId*/
                DataTable dtPatient = pc.SelectAllPatientFromUserId(userId);
                if (dtPatient.Rows.Count > 0)
                {
                    String patientIdString = dtPatient.Rows[0]["patientId"].ToString();
                    patientId = Convert.ToInt32(patientIdString);
                    cmd.Parameters.Add("@patientId", patientId);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        cmd.Parameters.Add("@patientWholeFieldLog_Date", patientWholeFieldLog_Date);
        cmd.Parameters.Add("@patientWholeFieldLog_Operation", patientWholeFieldLog_Operation);
        cmd.ExecuteNonQuery();
    }
        //add patient
        public PatientClass AddPatient(PatientClass patient)
        {
            var sql      = "INSERT INTO Patients([DoctorId], [Password]) VALUES(@DoctorId, @Password);";
            var sqlIdent =
                "SELECT * From Patients WHERE Password = @Password";

            this.db.Query <PatientContact>(sql, patient);
            var newPatient = db.Query <PatientClass>(sqlIdent, patient).FirstOrDefault();

            patient.Contact.PatientId    = newPatient.PatientID;
            patient.Program[0].PatientId = newPatient.PatientID;
            newPatient.Contact           = _patientContactRepository.AddContact(patient.Contact);
            newPatient.Program           = new List <ProgramClass>();
            newPatient.Program.Add(_programRepository.CreateProgram(patient.Program[0]));
            return(newPatient);
        }