private void btnDelAction_Click(object sender, RoutedEventArgs e) { Prescription Prescription = CourseListBox.SelectedItem as Prescription; if (Prescription != null) { WPFMessageBox IfMsgBox = new WPFMessageBox(); IfMsgBox.lblMsg.Text = "是否删除!"; IfMsgBox.lblTitle.Text = "提示信息"; IfMsgBox.Topmost = true; IfMsgBox.ShowDialog(); if (IfMsgBox.IsFlag) { if (Prescription.PatientId != "" && Prescription.PatientId != null) { var list = (from od in MySession.Query<Prescriptiondetails>() where od.PrescriptionId == Prescription.Id select od).OrderBy(x => x.LastTime).ToList(); if (list.Count > 0) { foreach (var item in list) { MySession.Session.Delete(item); MySession.Session.Flush(); } } MySession.Session.Delete(Prescription); MySession.Session.Flush(); tabChoose.SelectedIndex = 0; BindPrescription(ModuleConstant.PatientId); } else { AlarmDialog msgBox = new AlarmDialog(); msgBox.lblMsg.Text = "内置疗程,不能删除!"; msgBox.lblTitle.Text = "提示信息"; msgBox.Show(); } } else { AlarmDialog msgBox = new AlarmDialog(); msgBox.lblMsg.Text = "请选择疗程!"; msgBox.lblTitle.Text = "提示信息"; msgBox.Show(); } } }
private void btnSelectAction_Click(object sender, RoutedEventArgs e) { //int index=this Prescription Prescription = CourseListBox.SelectedItem as Prescription; if (Prescription != null) { var list = (from od in MySession.Query<Prescriptiondetails>() where od.PrescriptionId == Prescription.Id select od).OrderBy(x => x.LastTime).ToList(); if (list.Count > 0) { foreach (var item in list) { ItemDemo demo = new ItemDemo(); demo.Id = item.Id; demo.MaxAngle = Convert.ToInt32(item.MaxAngle); demo.ActionName = GetModeTypeName(item.ActionId.ToString()); demo.ModeName = GetModeTypeName(item.ModeId.ToString()); demo.MinAngle = Convert.ToInt32(item.MinAngle); demo.Mode = Convert.ToInt32(item.ModeId); demo.ActionId = Convert.ToInt32(item.ActionId); demo.Speed = Convert.ToInt32(item.Speed); demo.Times = Convert.ToInt32(item.Times); demo.Force = Convert.ToInt32(item.PForce); demo.Position = Convert.ToInt32(item.LastLocation); if (item.PGroup.HasValue) { demo.GroupTimes = Convert.ToInt32(item.PGroup); } demo.PicturePath = "/images/prescribe.png"; listResult.Add(demo); } if (listResult.Count > 0) { MyActionListBox.DataContext = listResult; MyActionListBox.SelectedIndex = listResult.Count - 1; } } } else { AlarmDialog msgBox = new AlarmDialog(); msgBox.lblMsg.Text = "请选择疗程!"; msgBox.lblTitle.Text = "提示信息"; msgBox.Show(); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { ObservableCollection<PrescriptionItem> list= SetPrescriptionItems(); if (list != null && list.Count > 0) { prescriptionDialog = new PrescriptionDialog(); prescriptionDialog.Parent = this; SavePrescriptionView child = new SavePrescriptionView(list); child.Close += new EventHandler(child_Close); prescriptionDialog.Content = child; prescriptionDialog.Show(); } else { AlarmDialog msgBox = new AlarmDialog(); msgBox.lblMsg.Text = "暂无可保存的处方信息!"; msgBox.lblTitle.Text = "提示信息"; msgBox.Show(); } }