Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button == null)
            {
                return;
            }

            string buttonValue = button.Content.ToString();

            switch (buttonValue)
            {
            case "取消":
                this.Visibility = System.Windows.Visibility.Hidden;
                WFModelInst     = null;
                break;


            case "新建":
                WFModelInst = new model.WFModel();
                if (textBox_WFModelName.Text != "")
                {
                    WFModelInst.WFModel_Name = textBox_WFModelName.Text;
                }
                else
                {
                    MessageBox.Show("请填写流转任务模型名称");
                    WFModelInst = null;
                    //this.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }
                if (comboBox_WFModelType.Text != "")
                {
                    WFModelInst.WFModel_Type = comboBox_WFModelType.Text;
                }
                else
                {
                    MessageBox.Show("请选择流转任务模型类型");
                    WFModelInst = null;
                    //this.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }
                if (Check_Profe.IsChecked == true)
                {
                    WFModelInst.WFModel_Owner += "Professional,";
                }
                else
                {
                    if (Check_Admin.IsChecked == true)
                    {
                        WFModelInst.WFModel_Owner += "Administrator,";
                    }
                    else
                    {
                        if (Check_Busin.IsChecked == true)
                        {
                            WFModelInst.WFModel_Owner += "Business";
                        }
                        else
                        {
                            MessageBox.Show("请选择用户类型");
                            WFModelInst = null;
                            //this.Visibility = System.Windows.Visibility.Hidden;
                            break;
                        }
                    }
                }


                int saveReport = saveModel();
                if (saveReport == 0)
                {
                    MessageBox.Show("新建流转任务模型成功");
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                else if (saveReport == -1)
                {
                    MessageBox.Show("新建流转任务模型失败,流转任务模型名称已存在");
                    WFModelInst     = null;
                    this.Visibility = System.Windows.Visibility.Visible;
                }
                else if (saveReport == -2)
                {
                    MessageBox.Show("新建流转任务模型失败,网络暂时无法连接,请稍后重试");
                    WFModelInst     = null;
                    this.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    MessageBox.Show("新建流转任务模型失败,请重试");
                    WFModelInst     = null;
                    this.Visibility = System.Windows.Visibility.Visible;
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button == null)
            {
                return;
            }

            string buttonValue = button.Content.ToString();

            switch (buttonValue)
            {
                case "取消":
                    this.Visibility = System.Windows.Visibility.Hidden;
                    WFModelInst = null;
                    break;


                case "新建":
                    WFModelInst = new model.WFModel();
                    if (textBox_WFModelName.Text != "")
                    {
                        WFModelInst.WFModel_Name = textBox_WFModelName.Text;
                    }
                    else
                    {
                        MessageBox.Show("请填写流转任务模型名称");
                        WFModelInst = null;
                        //this.Visibility = System.Windows.Visibility.Hidden;
                        break;
                    }
                    if (comboBox_WFModelType.Text != "")
                    {
                        WFModelInst.WFModel_Type = comboBox_WFModelType.Text;
                    }
                    else
                    {
                        MessageBox.Show("请选择流转任务模型类型");
                        WFModelInst = null;
                        //this.Visibility = System.Windows.Visibility.Hidden;
                        break;
                    }
                    if (Check_Profe.IsChecked == true)
                    {
                        WFModelInst.WFModel_Owner += "Professional,";
                    }
                    else
                    {

                        if (Check_Admin.IsChecked == true)
                        {
                            WFModelInst.WFModel_Owner += "Administrator,";
                        }
                        else
                        {
                            if (Check_Busin.IsChecked == true)
                            {
                                WFModelInst.WFModel_Owner += "Business";
                            }
                            else
                            {
                                MessageBox.Show("请选择用户类型");
                                WFModelInst = null;
                                //this.Visibility = System.Windows.Visibility.Hidden;
                                break;
                            }
                        }
                    }

                    
                    int saveReport = saveModel();
                    if (saveReport == 0)
                    {
                        MessageBox.Show("新建流转任务模型成功");
                        this.Visibility = System.Windows.Visibility.Hidden;
                    }
                    else if (saveReport == -1)
                    {
                        MessageBox.Show("新建流转任务模型失败,流转任务模型名称已存在");
                        WFModelInst = null;
                        this.Visibility = System.Windows.Visibility.Visible;
                    }
                    else if (saveReport == -2)
                    {
                        MessageBox.Show("新建流转任务模型失败,网络暂时无法连接,请稍后重试");
                        WFModelInst = null;
                        this.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        MessageBox.Show("新建流转任务模型失败,请重试");
                        WFModelInst = null;
                        this.Visibility = System.Windows.Visibility.Visible;
                    }
                    break;

            }
        }