Esempio n. 1
0
        private void OtherServiceList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CommContracts.OtherServiceDoctorAdvice otherService = OtherServiceList.SelectedItem as CommContracts.OtherServiceDoctorAdvice;
            ShowDetails(otherService);

            this.SaveBtn.IsEnabled   = false;
            this.DeleteBtn.IsEnabled = true;
        }
Esempio n. 2
0
        private void ShowDetails(CommContracts.OtherServiceDoctorAdvice otherService)
        {
            if (otherService == null)
            {
                return;
            }
            List <MyDetail> list = new List <MyDetail>();

            foreach (var tem in otherService.OtherServiceDoctorAdviceDetails)
            {
                MyDetail assayDetail = new MyDetail();
                assayDetail.ID           = tem.OtherServiceID;
                assayDetail.Name         = tem.OtherService.Name;
                assayDetail.SingleDose   = tem.AllNum;
                assayDetail.Illustration = tem.Remarks;
                list.Add(assayDetail);
            }

            this.OtherServiceMsg.Text = otherService.ToString();
            this.myTableEdit.SetAllDetails(list);
            this.myTableEdit.IsEnabled = false;
        }
Esempio n. 3
0
        public List <CommContracts.OtherServiceDoctorAdvice> getAllInHospitalOtherService(int InpatientID)
        {
            List <CommContracts.OtherServiceDoctorAdvice> list = new List <CommContracts.OtherServiceDoctorAdvice>();

            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var query = from a in ctx.OtherServiceDoctorAdvices
                            where a.InpatientID == InpatientID
                            select a;
                foreach (DAL.OtherServiceDoctorAdvice ass in query)
                {
                    var config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap <DAL.OtherServiceDoctorAdvice, CommContracts.OtherServiceDoctorAdvice>();
                    });
                    var mapper = config.CreateMapper();

                    CommContracts.OtherServiceDoctorAdvice temp = mapper.Map <CommContracts.OtherServiceDoctorAdvice>(ass);
                    list.Add(temp);
                }
            }
            return(list);
        }
Esempio n. 4
0
        public CommContracts.OtherServiceDoctorAdvice GetOtherService(int Id)
        {
            CommContracts.OtherServiceDoctorAdvice otherService = new CommContracts.OtherServiceDoctorAdvice();
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var query = from t in ctx.OtherServiceDoctorAdvices
                            where t.ID == Id
                            select t;
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <DAL.OtherServiceDoctorAdvice, CommContracts.OtherServiceDoctorAdvice>();
                });
                var mapper = config.CreateMapper();


                foreach (var tem in query)
                {
                    otherService = mapper.Map <CommContracts.OtherServiceDoctorAdvice>(tem);
                    break;
                }
            }
            return(otherService);
        }
Esempio n. 5
0
        public bool SaveOtherService(CommContracts.OtherServiceDoctorAdvice otherService)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <CommContracts.OtherServiceDoctorAdvice, DAL.OtherServiceDoctorAdvice>().ForMember(x => x.OtherServiceDoctorAdviceDetails, opt => opt.Ignore());
                });
                var mapper = config.CreateMapper();

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

                var configDetail = new MapperConfiguration(ctr =>
                {
                    ctr.CreateMap <CommContracts.OtherServiceDoctorAdviceDetail, DAL.OtherServiceDoctorAdviceDetail>().ForMember(x => x.OtherService, opt => opt.Ignore());
                });
                var mapperDetail = configDetail.CreateMapper();

                List <CommContracts.OtherServiceDoctorAdviceDetail> list1 = otherService.OtherServiceDoctorAdviceDetails;
                List <DAL.OtherServiceDoctorAdviceDetail>           res   = mapperDetail.Map <List <DAL.OtherServiceDoctorAdviceDetail> >(list1);;

                temp.OtherServiceDoctorAdviceDetails = res;
                ctx.OtherServiceDoctorAdvices.Add(temp);
                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 6
0
 public bool SaveOtherServiceDoctorAdvice(CommContracts.OtherServiceDoctorAdvice otherServiceDoctorAdvice)
 {
     CommClient.OtherServiceDoctorAdvice otherService = new CommClient.OtherServiceDoctorAdvice();
     return(otherService.SaveOtherService(otherServiceDoctorAdvice));
 }
Esempio n. 7
0
 public string newOtherService()
 {
     CommContracts.OtherServiceDoctorAdvice otherService = new CommContracts.OtherServiceDoctorAdvice();
     CurrentOtherService = otherService;
     return(CurrentOtherService.ToString());
 }
Esempio n. 8
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            List <MyDetail> listDetail = myTableEdit.GetAllDetails();
            List <CommContracts.OtherServiceDoctorAdviceDetail> list = new List <CommContracts.OtherServiceDoctorAdviceDetail>();
            decimal sum = 0.0m;

            foreach (var tem in listDetail)
            {
                CommContracts.OtherServiceDoctorAdviceDetail otherServiceDetail = new CommContracts.OtherServiceDoctorAdviceDetail();
                otherServiceDetail.OtherServiceID = tem.ID;
                otherServiceDetail.AllNum         = tem.SingleDose;
                otherServiceDetail.Remarks        = tem.Illustration;
                list.Add(otherServiceDetail);
                sum += tem.SingleDose * tem.SellPrice;
            }

            var vm = this.DataContext as HISGUIDoctorVM;

            CommContracts.OtherServiceDoctorAdvice otherServiceDoctorAdvice = new CommContracts.OtherServiceDoctorAdvice();
            otherServiceDoctorAdvice.NO = "";
            if (vm.IsClinicOrInHospital)
            {
                if (vm.CurrentRegistration != null)
                {
                    otherServiceDoctorAdvice.RegistrationID = vm.CurrentRegistration.ID;
                    otherServiceDoctorAdvice.PatientID      = vm.CurrentRegistration.PatientID;
                }
            }
            else
            {
                if (vm.CurrentInHospital != null)
                {
                    otherServiceDoctorAdvice.InpatientID = vm.CurrentInHospital.ID;
                    otherServiceDoctorAdvice.PatientID   = vm.CurrentInHospital.PatientID;
                }
            }

            otherServiceDoctorAdvice.SumOfMoney = sum;
            otherServiceDoctorAdvice.WriteTime  = DateTime.Now;
            if (vm.CurrentUser != null)
            {
                otherServiceDoctorAdvice.WriteDoctorUserID = vm.CurrentUser.ID;
            }
            otherServiceDoctorAdvice.OtherServiceDoctorAdviceDetails = list;

            bool?saveResult = vm?.SaveOtherServiceDoctorAdvice(otherServiceDoctorAdvice);

            if (!saveResult.HasValue)
            {
                MessageBox.Show("保存失败!");
                return;
            }
            else if ((bool)saveResult.Value)
            {
                MessageBox.Show("保存成功!");
                newOtherService();
                getAllOtherServiceList();
            }
            else
            {
                MessageBox.Show("保存失败!");
                return;
            }
        }