コード例 #1
0
        private void InsertIntoAssayItem(CommContracts.AssayItem assayItem)
        {
            if (assayItem == null)
            {
                return;
            }
            if (CheckRepeat(assayItem.ID))
            {
                MessageBox.Show(assayItem.Name + "已经存在!");
                return;
            }

            MyDetail item = new MyDetail();

            item.ID             = assayItem.ID;
            item.Name           = assayItem.Name;
            item.SingleDoseUnit = assayItem.Unit;

            m_contentItems.Add(item);
            // 跳转到单次剂量
            if (m_skipList.Count > 0)
            {
                GridSkipTo(m_contentItems.Count - 1, m_skipList.ElementAt(0));
            }
        }
コード例 #2
0
        public bool UpdateAssayItem(CommContracts.AssayItem AssayItem)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var temp = ctx.AssayItems.FirstOrDefault(m => m.ID == AssayItem.ID);
                if (temp != null)
                {
                    temp.Name      = AssayItem.Name;
                    temp.AbbrPY    = AssayItem.AbbrPY;
                    temp.AbbrWB    = AssayItem.AbbrWB;
                    temp.Unit      = AssayItem.Unit;
                    temp.YiBaoEnum = (DAL.YiBaoEnum)AssayItem.YiBaoEnum;

                    temp.Price = AssayItem.Price;
                }
                else
                {
                    return(false);
                }

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

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

                ctx.AssayItems.Add(temp);
                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #4
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.NameEdit.Text.Trim()))
            {
                return;
            }

            if (this.YiBaoEnum.SelectedItem == null)
            {
                return;
            }
            if (bIsEdit)
            {
                AssayItem.Name      = this.NameEdit.Text.Trim();
                AssayItem.AbbrPY    = this.AbbrPY.Text;
                AssayItem.AbbrWB    = this.AbbrWB.Text;
                AssayItem.Unit      = this.Unit.Text;
                AssayItem.YiBaoEnum = (CommContracts.YiBaoEnum) this.YiBaoEnum.SelectedItem;
                AssayItem.Price     = decimal.Parse(this.Price.Text);


                CommClient.AssayItem myd = new CommClient.AssayItem();
                if (myd.UpdateAssayItem(AssayItem))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
            else
            {
                CommContracts.AssayItem assayItem = new CommContracts.AssayItem();
                assayItem.Name      = this.NameEdit.Text.Trim();
                assayItem.AbbrPY    = this.AbbrPY.Text.Trim();
                assayItem.AbbrWB    = this.AbbrWB.Text.Trim();
                assayItem.Unit      = this.Unit.Text.Trim();
                assayItem.YiBaoEnum = (CommContracts.YiBaoEnum) this.YiBaoEnum.SelectedItem;
                if (!string.IsNullOrEmpty(this.Price.Text))
                {
                    assayItem.Price = decimal.Parse(this.Price.Text.Trim());
                }

                CommClient.AssayItem myd = new CommClient.AssayItem();
                if (myd.SaveAssayItem(assayItem))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }
コード例 #5
0
        public EditAssayItemView(CommContracts.AssayItem asayItem = null)
        {
            InitializeComponent();
            YiBaoEnum.ItemsSource = Enum.GetValues(typeof(CommContracts.YiBaoEnum));

            bIsEdit = false;
            if (asayItem != null)
            {
                this.AssayItem      = asayItem;
                this.NameEdit.Text  = asayItem.Name;
                this.AbbrPY.Text    = asayItem.AbbrPY;
                this.AbbrWB.Text    = asayItem.AbbrWB;
                this.Unit.Text      = asayItem.Unit;
                this.YiBaoEnum.Text = asayItem.YiBaoEnum.ToString();
                this.Price.Text     = asayItem.Price.ToString();

                bIsEdit = true;
            }
        }
コード例 #6
0
        private void Grid1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter || e.Key == Key.Return)
            {
                if (editEnum == MyTableEditEnum.xichengyao || editEnum == MyTableEditEnum.zhongyao || editEnum == MyTableEditEnum.medicineInStock)
                {
                    CommContracts.Medicine medicine = this.Grid1.SelectedItem as CommContracts.Medicine;

                    CurrentMedicine = medicine;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.zhiliao)
                {
                    CommContracts.TherapyItem therapyItem = this.Grid1.SelectedItem as CommContracts.TherapyItem;

                    CurrentTherapyItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.jianyan)
                {
                    CommContracts.AssayItem therapyItem = this.Grid1.SelectedItem as CommContracts.AssayItem;

                    CurrentAssayItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.jiancha)
                {
                    CommContracts.InspectItem therapyItem = this.Grid1.SelectedItem as CommContracts.InspectItem;

                    CurrentInspectItem = therapyItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.cailiao || editEnum == MyTableEditEnum.materialInStock)
                {
                    CommContracts.MaterialItem materialItem = this.Grid1.SelectedItem as CommContracts.MaterialItem;

                    CurrentMaterialItem = materialItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.qita)
                {
                    CommContracts.OtherServiceItem otherServiceItem = this.Grid1.SelectedItem as CommContracts.OtherServiceItem;

                    CurrentOtherServiceItem = otherServiceItem;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.medicineOutStock)
                {
                    CommContracts.StoreRoomMedicineNum storeRoomMedicineNum = this.Grid1.SelectedItem as CommContracts.StoreRoomMedicineNum;

                    CurrentStoreRoomMedicineNum          = storeRoomMedicineNum;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
                else if (editEnum == MyTableEditEnum.materialOutStock)
                {
                    CommContracts.StoreRoomMaterialNum storeRoomMaterialNum = this.Grid1.SelectedItem as CommContracts.StoreRoomMaterialNum;

                    CurrentStoreRoomMaterialNum          = storeRoomMaterialNum;
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }