public bool SaveDoctorAdviceItem(CommContracts.DoctorAdviceItem DoctorAdviceItem) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.DoctorAdviceItem, DAL.DoctorAdviceItem>(); }); var mapper = config.CreateMapper(); DAL.DoctorAdviceItem temp = new DAL.DoctorAdviceItem(); temp = mapper.Map <DAL.DoctorAdviceItem>(DoctorAdviceItem); ctx.DoctorAdviceItems.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
private void listKeyUp(object sender, KeyEventArgs e) { var item = this.m_list.SelectedItem as CommContracts.DoctorAdviceItem; if (item == null) { return; } if (e.Key == Key.Enter) { CurrentAdviceItem = item; this.DialogResult = true; Close(); } }
public bool UpdateDoctorAdviceItem(CommContracts.DoctorAdviceItem DoctorAdviceItem) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.DoctorAdviceItems.FirstOrDefault(m => m.ID == DoctorAdviceItem.ID); if (temp != null) { temp.Name = DoctorAdviceItem.Name; temp.Specification = DoctorAdviceItem.Specification; temp.Abbr = DoctorAdviceItem.Abbr; temp.WuBi = DoctorAdviceItem.WuBi; temp.doctorAdviceItemType = (DAL.DoctorAdviceItemType)DoctorAdviceItem.doctorAdviceItemType; temp.SellPackageName = DoctorAdviceItem.SellPackageName; temp.MinPackageName = DoctorAdviceItem.MinPackageName; temp.MinPackageNum = DoctorAdviceItem.MinPackageNum; temp.MinPackageUnit = DoctorAdviceItem.MinPackageUnit; temp.ScalingFactor = DoctorAdviceItem.ScalingFactor; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool SaveDoctorAdviceItem(CommContracts.DoctorAdviceItem DoctorAdviceItem) { return(client.SaveDoctorAdviceItem(DoctorAdviceItem)); }
public bool UpdateDoctorAdviceItem(CommContracts.DoctorAdviceItem DoctorAdviceItem) { return(client.UpdateDoctorAdviceItem(DoctorAdviceItem)); }