public FrmEdtPatientBaseInfo(Int64 id) { InitializeComponent(); //string sPwd = Des.Decrypt(ClsFrmMng.KEY, ConfigurationManager.AppSettings["DbPwd"]); db = new Database("XE"); _ID = id; //db.OpenSharedConnection(); patientBase = db.Single<PATIENT_BASEINFO>("select * from PATIENT_BASEINFO where ID = @0", _ID); //db.CloseSharedConnection(); pATIENTBASEINFOBindingSource.DataSource = patientBase; ConditionValidationRule ruleNoEmpty = new ConditionValidationRule(); ruleNoEmpty.ConditionOperator = ConditionOperator.IsNotBlank; ruleNoEmpty.ErrorText = "该项不能为空。"; dxValidationProvider1.SetValidationRule(NAMETextEdit, ruleNoEmpty); MEDICARE_TYPETextEdit.Properties.DataSource = db.Fetch<VALUE_CODE>("select DSP_MEMBER, VALUE_MEMBER from VALUE_CODE where GROUPNAME = @0", new object[] { 10 }); MEDICARE_TYPETextEdit.Properties.DisplayMember = "DSP_MEMBER"; MEDICARE_TYPETextEdit.Properties.ValueMember = "VALUE_MEMBER"; EDUCATIONAL_LEVELTextEdit.Properties.DataSource = db.Fetch<VALUE_CODE>("where GROUPNAME = @0", new object[] { 8 }); EDUCATIONAL_LEVELTextEdit.Properties.DisplayMember = "DSP_MEMBER"; EDUCATIONAL_LEVELTextEdit.Properties.ValueMember = "VALUE_MEMBER"; MARITAL_STATUSTextEdit.Properties.DataSource = db.Fetch<VALUE_CODE>("where GROUPNAME = @0", new object[] { 9 }); MARITAL_STATUSTextEdit.Properties.DisplayMember = "DSP_MEMBER"; MARITAL_STATUSTextEdit.Properties.ValueMember = "VALUE_MEMBER"; vALUECODEBindingSource.DataSource = db.Fetch<VALUE_CODE>("where groupname = 42"); vALUECODEBindingSource1.DataSource = db.Fetch<VALUE_CODE>("where groupname = 41"); vALUECODEBindingSource2.DataSource = db.Fetch<VALUE_CODE>("where groupname = 62"); vALUECODEBindingSource3.DataSource = db.Fetch<VALUE_CODE>("where groupname = 63"); }
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 barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!dxValidationProvider1.Validate()) return; if (XtraMessageBox.Show("确定保存该患者基本信息?", "操作确认", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { pATIENTBASEINFOBindingSource.EndEdit(); pATIENTBASEINFOBindingSource.CurrencyManager.EndCurrentEdit(); try { //db.OpenSharedConnection(); patientBase.CREATE_TIME = DateTime.Now; var id = db.Insert(patientBase); Console.WriteLine(id.ToString()); //db.CloseSharedConnection(); patientBase = new PATIENT_BASEINFO(); pATIENTBASEINFOBindingSource.DataSource = patientBase; } catch (Exception err) { XtraMessageBox.Show(err.Message, "错误提示", MessageBoxButtons.OK); } if (NewRegistEvt != null) NewRegistEvt(); } }