Exemple #1
0
        public bool UpdateOtherServiceItem(CommContracts.OtherServiceItem OtherServiceItem)
        {
            using (DAL.HisContext ctx = new DAL.HisContext())
            {
                var temp = ctx.OtherServiceItem.FirstOrDefault(m => m.ID == OtherServiceItem.ID);
                if (temp != null)
                {
                    temp.Name   = OtherServiceItem.Name;
                    temp.AbbrPY = OtherServiceItem.AbbrPY;
                    temp.AbbrWB = OtherServiceItem.AbbrWB;
                    temp.Unit   = OtherServiceItem.Unit;

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

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

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

                ctx.OtherServiceItem.Add(temp);
                try
                {
                    ctx.SaveChanges();
                }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
                catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #3
0
        private void InsertIntoOtherServiceItem(CommContracts.OtherServiceItem otherServiceItem)
        {
            if (otherServiceItem == null)
            {
                return;
            }
            if (CheckRepeat(otherServiceItem.ID))
            {
                MessageBox.Show(otherServiceItem.Name + "已经存在!");
                return;
            }

            MyDetail item = new MyDetail();

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

            m_contentItems.Add(item);
            // 跳转到单次剂量
            if (m_skipList.Count > 0)
            {
                GridSkipTo(m_contentItems.Count - 1, m_skipList.ElementAt(0));
            }
        }
        public EditOtherServiceItemView(CommContracts.OtherServiceItem asayItem = null)
        {
            InitializeComponent();

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

                bIsEdit = true;
            }
        }
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.NameEdit.Text.Trim()))
            {
                return;
            }
            if (bIsEdit)
            {
                OtherServiceItem.Name   = this.NameEdit.Text.Trim();
                OtherServiceItem.AbbrPY = this.AbbrPY.Text;
                OtherServiceItem.AbbrWB = this.AbbrWB.Text;
                OtherServiceItem.Unit   = this.Unit.Text;
                OtherServiceItem.Price  = decimal.Parse(this.Price.Text);


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

                CommClient.OtherServiceItem myd = new CommClient.OtherServiceItem();
                if (myd.SaveOtherServiceItem(OtherServiceItem))
                {
                    (this.Parent as Window).DialogResult = true;
                    (this.Parent as Window).Close();
                }
            }
        }
Exemple #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();
                }
            }
        }