protected override void OnDeleteClick()
        {
            OPDPrescription obj = this.GetSelectedProcedure(this.dgvPrescription);

            if (obj != null)
            {
                this.mOPDPrescription = obj;
                this.mOPDPrescription.MarkToDelete();
                this.mOPDPrescription.UpdateChanges();
            }
            for (int i = 0; i < cmbMedicine.Items.Count; i++)
            {
                if (cmbMedicine.GetItemChecked(i))
                {
                    cmbMedicine.SetItemChecked(i, false);
                }
            }
            this.txtDoseage.ResetText();
            this.txtTimings.ResetText();
            this.dptPrescriptionDate.Value = DateTime.Now;
            LoadListPrescriptionData(obj);
            this.mPatient.OPDPrescription = null;
            this.mOPDPrescription         = new OPDPrescription();
            this.cmbMedicine.SelectedItem = null;
        }
        private void OnOpenClick(object sender, EventArgs e)
        {
            OPDPrescription obj = this.GetSelectedProcedure(this.dgvPrescription);

            if (obj != null)
            {
                obj.RefershData();
                this.mOPDPrescription = obj;
                for (int i = 0; i < cmbMedicine.Items.Count; i++)
                {
                    if (cmbMedicine.GetItemChecked(i))
                    {
                        cmbMedicine.SetItemChecked(i, false);
                    }
                }
                if (this.mOPDPrescription.OPDMedicines.Count > 0)
                {
                    for (int i = 0; i < cmbMedicine.Items.Count; i++)
                    {
                        for (int j = 0; j < this.mOPDPrescription.OPDMedicines.Count; j++)
                        {
                            if (mOPDPrescription.OPDMedicines[j].MedicineGuid == new Guid(cmbMedicine.Items[i].ToString()))
                            {
                                cmbMedicine.SetItemChecked(i, true);
                                break;
                            }
                        }
                    }
                }

                this.txtDoseage.Text           = obj.Doseage;
                this.txtTimings.Text           = obj.Timings;
                this.dptPrescriptionDate.Value = obj.OPDPrescriptionDate;
            }
        }
        private OPDPrescription GetSelectedProcedure(DataGridView dgv)
        {
            OPDPrescription obj = null;

            if (dgv != null && dgv.CurrentRow != null)
            {
                obj = dgv.CurrentRow.Tag as OPDPrescription;
            }
            return(obj);
        }
        protected override void OnSaveComplete()
        {
            base.OnSaveComplete();
            this.cmbMedicine.SelectedIndex = 0;
            this.txtDoseage.ResetText();
            this.txtTimings.ResetText();
            this.dptPrescriptionDate.Value = DateTime.Now;
            this.mOPDPrescription          = new OPDPrescription();
            OPDPrescription obj = this.GetSelectedProcedure(this.dgvPrescription);

            LoadListPrescriptionData(obj);
        }
        public OPDPrescriptionForm(Patient obj)
            : base(obj, false)
        {
            this.mPatient         = obj;
            this.mOPDPrescription = new OPDPrescription();

            this.mOPDPrescriptionCollection = new OPDPrescriptionCollection(this.mPatient.ObjectGuid);

            //Medicine

            this.OPDMedicines = new Object.OPDMedicines(this.mOPDPrescription.ObjectGuid);

            this.InitializeComponent();
            this.UserInitialize();
        }
        private void LoadListPrescriptionData(OPDPrescription Selected)
        {
            int count = 0;

            this.LoadEntityList <OPDPrescription>(this.dgvPrescription, this.clmId.Index, new OPDPrescriptionCollection(this.mPatient.ObjectGuid), Selected,
                                                  false, true, delegate(DataGridViewRow row, OPDPrescription obj)
            {
                count++;
                row.Cells[this.clmId.Index].Value               = obj.Id;
                row.Cells[this.clmMedicine.Index].Value         = obj.Medicine;
                row.Cells[this.clmDoseage.Index].Value          = obj.Doseage;
                row.Cells[this.clmTimings.Index].Value          = obj.Timings;
                row.Cells[this.clmPrescriptionDate.Index].Value = obj.OPDPrescriptionDate.ToString() != string.Empty ? string.Format("{0:dd/MM/yyyy}", obj.OPDPrescriptionDate) : string.Empty;
            }
                                                  );
        }