public rptPatientRegist(PATIENT_REGIST reg )
        {
            InitializeComponent();

            bindingSource1.DataSource = reg;
        }
            public PATIENT_BASEINFO MapIt(PATIENT_BASEINFO a, PATIENT_REGIST p)
            {
                // Terminating call.  Since we can return null from this function
                // we need to be ready for PetaPoco to callback later with null
                // parameters
                if (a == null)
                    return current;

                // Is this the same author as the current one we're processing
                if (current != null && current.ID == a.ID)
                {
                    // Yes, just add this post to the current author's collection of posts
                    current.PATIENT_REG.Add(p);

                    // Return null to indicate we're not done with this author yet
                    return null;
                }

                // This is a different author to the current one, or this is the
                // first time through and we don't have an author yet

                // Save the current author
                var prev = current;

                // Setup the new current author
                current = a;
                current.PATIENT_REG = new List<PATIENT_REGIST>();
                current.PATIENT_REG.Add(p);

                //Return the now populated previous author (or null if first time through)
                return prev;
            }
        private void btnSave_Print_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!dxValidationProvider1.Validate())
                return;

            if (XtraMessageBox.Show("确定保存该挂号单?", "操作确认", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    pATIENTREGISTBindingSource.EndEdit();
                    pATIENTREGISTBindingSource.CurrencyManager.EndCurrentEdit();

                    patientReg.BASE_INFO_ID = _baseID;
                    patientReg.CREATEDATE = DateTime.Now;

                    //db.OpenSharedConnection();
                    db.Insert(patientReg);
                    //db.CloseSharedConnection();

                    patientReg = new PATIENT_REGIST();
                    patientReg.OPERATOR = ClsFrmMng.WorkerID;
                    patientReg.STATUS = 0;
                    patientReg.BASE_INFO_ID = _baseID;
                    pATIENTREGISTBindingSource.DataSource = patientReg;

                    if (NewRegistEvt != null)
                    {
                        NewRegistEvt();
                    }
                }
                catch (Exception err)
                {
                    XtraMessageBox.Show(err.Message, "错误提示", MessageBoxButtons.OK);
                }
            }
        }