Example #1
0
        public bool UpdateDoctorAdviceDetail(CommContracts.DoctorAdviceDetail DoctorAdviceDetail)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var temp = ctx.DoctorAdviceDetails.FirstOrDefault(m => m.ID == DoctorAdviceDetail.ID);
                if (temp != null)
                {
                    temp.DoctorAdviceItemID = DoctorAdviceDetail.DoctorAdviceItemID;
                    temp.TotalNum           = DoctorAdviceDetail.TotalNum;
                    temp.SignalDose         = DoctorAdviceDetail.SignalDose;
                }
                else
                {
                    return(false);
                }

                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        public bool SaveDoctorAdviceDetail(CommContracts.DoctorAdviceDetail DoctorAdviceDetail)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <CommContracts.DoctorAdviceDetail, DAL.DoctorAdviceDetail>();
                });
                var mapper = config.CreateMapper();

                DAL.DoctorAdviceDetail temp = new DAL.DoctorAdviceDetail();
                temp = mapper.Map <DAL.DoctorAdviceDetail>(DoctorAdviceDetail);

                ctx.DoctorAdviceDetails.Add(temp);
                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
Example #3
0
 public bool SaveDoctorAdviceDetail(CommContracts.DoctorAdviceDetail DoctorAdviceDetail)
 {
     return(client.SaveDoctorAdviceDetail(DoctorAdviceDetail));
 }