Exemplo n.º 1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     standTestRefeBLL = new BLL.TB_StandTestRefe();
     testInfoBLL      = new BLL.TB_TestInfo();
     athleteBLL       = new BLL.TB_AthleteInfo();
     standPramsBLL    = new BLL.TB_StandardParams();
     standParam       = standPramsBLL.GetModelByStandID(StandInfo.ID);
     parentStandParam = standPramsBLL.GetModelByStandID((int)StandInfo.Stand_ParentID);
     tbTitle.Text    += "  当前测试参考值为:" + StandInfo.Stand_Name;
 }
Exemplo n.º 2
0
        private void init()
        {
            Binding dictBind = new Binding()
            {
                Source = jointDictList
            };

            cbJoint.SetBinding(ComboBox.ItemsSourceProperty, dictBind);
            cbJointSide.SetBinding(ComboBox.ItemsSourceProperty, new Binding()
            {
                Source = jointsideDictList
            });
            cbTestMode.SetBinding(ComboBox.ItemsSourceProperty, new Binding()
            {
                Source = testmodeDictList
            });
            cbPlane.SetBinding(ComboBox.ItemsSourceProperty, new Binding()
            {
                Source = planeDictList
            });
            if (!isAdd)
            {
                tbTitle.Text  = "编辑" + StandardInfo.Stand_Name;
                standardParam = standardParamsBLL.GetModelByStandID(StandardInfo.ID);
                if (standardParam == null)
                {
                    standardParam         = new Model.TB_StandardParams();
                    standardParam.StandID = StandardInfo.ID;
                }
                txtName.Text = StandardInfo.Stand_Name;
            }
            else
            {
                standardParam = new Model.TB_StandardParams();
                if (StandardInfo.Stand_Level == -1)
                {
                    tbTitle.Text = "添加测试参考值类别";
                }
                else
                {
                    tbTitle.Text = "为" + StandardInfo.Stand_Name + "添加子参考值";
                }
                txtName.Text = "";
            }

            Binding standParamBind = new Binding()
            {
                Source = standardParam
            };

            grid.SetBinding(Grid.DataContextProperty, standParamBind);

            txtName.Focus();
        }
Exemplo n.º 3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     standTestRefeBLL = new BLL.TB_StandTestRefe();
     testInfoBLL = new BLL.TB_TestInfo();
     athleteBLL = new BLL.TB_AthleteInfo();
     standPramsBLL = new BLL.TB_StandardParams();
     standParam = standPramsBLL.GetModelByStandID(StandInfo.ID);
     parentStandParam = standPramsBLL.GetModelByStandID((int)StandInfo.Stand_ParentID);
     tbTitle.Text +="  当前测试参考值为:" +StandInfo.Stand_Name;
 }
Exemplo n.º 4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("名称不能为空!", "系统信息");
                return;
            }
            Model.TB_StandardInfo info = new Model.TB_StandardInfo();
            bool result;

            if (!isAdd)
            {
                StandardInfo.Stand_Name = txtName.Text;
                result = standardInfoBLL.Update(StandardInfo);
                standardParamsBLL.Update(standardParam);
            }
            else
            {
                info.Stand_Name = txtName.Text;
                if (StandardInfo.Stand_Level == -1)
                {
                    info.Stand_Level    = 1;
                    info.Stand_ParentID = 0;
                }
                else
                {
                    info.Stand_Level    = 2;
                    info.Stand_ParentID = StandardInfo.ID;
                }

                result = standardInfoBLL.Add(info);
                int maxStandInfoId = standardInfoBLL.GetMaxId();
                standardParam.StandID = maxStandInfoId;
                standardParamsBLL.Add(standardParam);
            }
            if (!result)
            {
                MessageBox.Show("保存到数据库出错,请稍后重试!", "系统错误");
            }
            else
            {
                if (isAdd)
                {
                    RaiseEvent(new RoutedEventArgs(AddOrUpdateLevel2.AddSuccessRoutedEvent, this));
                    string desc = "添加成功!\r\n";
                    if (StandardInfo.Stand_Level == -1)
                    {
                        desc += "是否继续添加参考值类别?";
                    }
                    else
                    {
                        desc += "是否继续为" + StandardInfo.Stand_Name + "添加子参考值?";
                    }
                    if (MessageBox.Show(desc, "系统信息", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        standardParam = new Model.TB_StandardParams();
                        txtName.Text  = "";
                        init();
                    }
                    else
                    {
                        this.DialogResult = true;
                        this.Close();
                    }
                }
                else
                {
                    this.DialogResult = true;
                    this.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text == "") {
                MessageBox.Show("名称不能为空!","系统信息");
                return;
            }
            Model.TB_StandardInfo info = new Model.TB_StandardInfo();
            bool result;
            if (!isAdd)
            {
                StandardInfo.Stand_Name = txtName.Text;
                result = standardInfoBLL.Update(StandardInfo);
                standardParamsBLL.Update(standardParam);
            }
            else {

                info.Stand_Name = txtName.Text;
                if (StandardInfo.Stand_Level == -1)
                {
                    info.Stand_Level = 1;
                    info.Stand_ParentID = 0;
                }
                else {
                    info.Stand_Level = 2;
                    info.Stand_ParentID = StandardInfo.ID;
                }

                result = standardInfoBLL.Add(info);
                int maxStandInfoId=  standardInfoBLL.GetMaxId();
                standardParam.StandID = maxStandInfoId;
                standardParamsBLL.Add(standardParam);
            }
            if (!result)
            {
                MessageBox.Show("保存到数据库出错,请稍后重试!", "系统错误");
            }
            else {
                if (isAdd)
                {
                    RaiseEvent(new RoutedEventArgs(AddOrUpdateLevel2.AddSuccessRoutedEvent, this));
                    string desc = "添加成功!\r\n";
                    if (StandardInfo.Stand_Level == -1)
                    {
                        desc += "是否继续添加参考值类别?";
                    }
                    else {
                        desc += "是否继续为" + StandardInfo.Stand_Name + "添加子参考值?";
                    }
                    if (MessageBox.Show(desc, "系统信息", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        standardParam = new Model.TB_StandardParams();
                        txtName.Text = "";
                        init();
                    }
                    else
                    {
                        this.DialogResult = true;
                        this.Close();
                    }
                }
                else {
                    this.DialogResult = true;
                    this.Close();
                }

            }
        }
Exemplo n.º 6
0
        private void init()
        {
            Binding dictBind = new Binding() { Source = jointDictList };
            cbJoint.SetBinding(ComboBox.ItemsSourceProperty, dictBind);
            cbJointSide.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = jointsideDictList });
            cbTestMode.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = testmodeDictList });
            cbPlane.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = planeDictList });
            if (!isAdd)
            {
                tbTitle.Text = "编辑" + StandardInfo.Stand_Name;
                standardParam = standardParamsBLL.GetModelByStandID(StandardInfo.ID);
                if (standardParam==null)
                {
                    standardParam = new Model.TB_StandardParams();
                    standardParam.StandID = StandardInfo.ID;
                }
                txtName.Text = StandardInfo.Stand_Name;
            }
            else
            {
                standardParam = new Model.TB_StandardParams();
                if (StandardInfo.Stand_Level == -1)
                {
                    tbTitle.Text = "添加测试参考值类别";
                }
                else
                {
                    tbTitle.Text = "为" + StandardInfo.Stand_Name + "添加子参考值";
                }
                txtName.Text = "";

            }

            Binding standParamBind = new Binding() { Source = standardParam };
            grid.SetBinding(Grid.DataContextProperty, standParamBind);

            txtName.Focus();
        }