/// <summary>
        /// Handles the SelectedIndexChanged event of the cboFigure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void cboFigure_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isSkipUpdatingFigure)
            {
                return;
            }

            var removeList = _prescriptionDetailList.Where(x => x.FigureDetailId != null).ToList();

            foreach (var item in removeList)
            {
                _prescriptionDetailList.Remove(item);
            }


            var comboboxEx    = (ComboBoxEx)sender;
            var figureId      = (int)comboboxEx.SelectedValue;
            var figureDetails = this._figureDetailRepo.GetByFigure(figureId);

            foreach (var figureDetail in figureDetails)
            {
                var prescriptionDetail = new PrescriptionDetail()
                {
                    FigureDetailId = figureDetail.Id,
                    MedicineId     = figureDetail.MedicineId,
                    //Medicine = figureDetail.Medicine,
                    VolumnPerDay = figureDetail.Volumn,
                    Day          = this.Day,
                    Amount       = DefaultVolumn * figureDetail.Volumn,
                    Version      = 0
                };
                try
                {
                    prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId);
                }
                catch (Exception ex)
                {
                    prescriptionDetail.InventoryVolumn = 0;
                }
                _prescriptionDetailList.Insert(0, prescriptionDetail);
            }

            this.bdsPrescriptionDetail.DataSource = _prescriptionDetailList;
            // this.bdsPrescriptionDetail.EndEdit();
            ReupdateNo();
        }
        /// <summary>
        /// Handles the SelectedIndexChanged event of the cboFigure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void CboFigureSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isSkipUpdatingFigure)
            {
                return;
            }

            var removeList = _prescriptionDetailList.Where(x => x.FigureDetailId != null).ToList();

            foreach (var item in removeList)
            {
                _prescriptionDetailList.Remove(item);
            }

            var comboboxEx    = (ComboBoxEx)sender;
            var figureId      = (int)comboboxEx.SelectedValue;
            var figureDetails = this._figureDetailRepo.GetByFigure(figureId);

            foreach (var figureDetail in figureDetails)
            {
                var prescriptionDetail = new PrescriptionDetail()
                {
                    FigureDetailId = figureDetail.Id,
                    MedicineId     = figureDetail.MedicineId,
                    VolumnPerDay   = figureDetail.Volumn,
                    TradeName      = figureDetail.Medicine.TradeName,
                    MedicineName   = figureDetail.Medicine.Name,
                    UnitName       = figureDetail.Medicine.Define.Name,
                    Day            = this.Day,
                    Amount         = DefaultVolumn * figureDetail.Volumn,
                    Version        = 0
                };
                prescriptionDetail.InventoryVolumn = _medicineRepo.GetInventoryVolumeWareHouseByMedicineId(AppContext.CurrentClinic.Id, prescriptionDetail.MedicineId);
                _prescriptionDetailList.Insert(0, prescriptionDetail);
            }

            this.bdsPrescriptionDetail.DataSource = _prescriptionDetailList;
            this.bdsPrescriptionDetail.ResetBindings(false);
            this.dataGridViewX1.Update();
        }