Ejemplo n.º 1
0
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            MdlProductTest mPrdctTest = new MdlProductTest();

            mPrdctTest.EditFlag = 1;//新增
            TestItemEdit tiEdit = new TestItemEdit(mPrdctTest);

            tiEdit.Refurbish += new TestItemEdit.DisplayUpdate(edit_Refurbish);//关联事件
            bool?result = tiEdit.ShowDialog();

            if (result != null && result.Value)
            {
                System.Windows.MessageBox.Show("添加成功!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Ejemplo n.º 2
0
 //添加后触发的刷新事件
 private void edit_Refurbish(MdlProductTest item)
 {
     if (item == null)
     {
         return;
     }
     if (item.EditFlag == 1)
     {
         schedulingRefresh();//刷新数据
     }
     else if (item.EditFlag == 2)
     {
         schedulingRefresh();//刷新数据
     }
 }
Ejemplo n.º 3
0
        //右键菜单功能
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is MenuItem))
            {
                return;
            }
            MenuItem mi = (MenuItem)sender;

            switch (mi.Header.ToString())
            {
            case "删除":
                if (this.dgPrdctTest.SelectedItem != null)
                {
                    if (MessageBox.Show("确定要删除选中的试验数据吗?", "删除提示", MessageBoxButton.OKCancel, MessageBoxImage.Question)
                        == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                    PrdctTestBindEntity prdctTest = this.dgPrdctTest.SelectedItem as PrdctTestBindEntity;
                    if (dbPrdctTestDelete(prdctTest.Id.ToString()))
                    {
                        schedulingRefresh();    //刷新数据
                    }
                }
                else
                {
                    MessageBox.Show("没有选中要删除的项", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                break;

            case "修改":
                if (this.dgPrdctTest.SelectedItem != null)
                {
                    PrdctTestBindEntity prdctTestSel = this.dgPrdctTest.SelectedItem as PrdctTestBindEntity;
                    MdlProductTest      mptTemp      = new MdlProductTest();
                    mptTemp.EditFlag                 = 2;
                    mptTemp.Id                       = prdctTestSel.Id;
                    mptTemp.PrdctDataIns             = new MdlProductData();
                    mptTemp.PrdctDataIns.Id          = prdctTestSel.PrdctId;
                    mptTemp.PrdctDataIns.PrdctNumber = prdctTestSel.PrdctNumber;
                    mptTemp.PrdctDataIns.TreatType   = prdctTestSel.TreatType;
                    mptTemp.PrdctDataIns.WeDuration  = prdctTestSel.WeDuration;
                    mptTemp.PrdctDataIns.ReDuration  = prdctTestSel.ReDuration;
                    mptTemp.PrdctId                  = prdctTestSel.PrdctId;
                    mptTemp.StartTime                = prdctTestSel.StartTime;
                    mptTemp.WeLossTime               = prdctTestSel.WeLossTime;
                    mptTemp.ReLossTime               = prdctTestSel.ReLossTime;
                    mptTemp.Remark                   = prdctTestSel.Remark;
                    TestItemEdit tiEdit = new TestItemEdit(mptTemp);
                    tiEdit.Refurbish += new TestItemEdit.DisplayUpdate(edit_Refurbish);    //关联事件
                    bool?result = tiEdit.ShowDialog();
                    if (result != null && result.Value)
                    {
                        System.Windows.MessageBox.Show("修改成功!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
                else
                {
                    MessageBox.Show("没有选中要修改的项", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                break;
            }
        }
Ejemplo n.º 4
0
 public TestItemEdit(MdlProductTest _mpt)
 {
     InitializeComponent();
     this.mpt  = _mpt;
     this.Icon = App.Current.MainWindow.Icon;
 }