private void EditProcedure()
 {
     //Name存在性检查
     strName = NameComboBox.Text;
     Procedure curProce = mainDataSet.GetProcedureItem(strName);
     if (curProce == null)
     {
         InputWarning.PlacementTarget = NewNameBox;
         WarningInfo.Text = "Selected User is not exists in DB.";
         InputWarning.IsOpen = true;
         return;
     }
     //Task Type
     if (strType != "")
     {
         TaskType curType = mainDataSet.GetTypeItem(strType);
         if (curType == null)
         {
             curType = new TaskType(strType);
             mainDataSet.InsertNewType(curType);
         }
         curProce.BindingType = curType;
         curType.BindingProcedure = curProce;
     }
     //Procedure
     RefreshSteps(curProce);
     //Description
     curProce.Description = strDescription;
     return;
 }
예제 #2
0
        private bool InputVarification()
        {
            const string    strExtractPattern = @"[\u4E00-\u9FA5A-Za-z0-9_]+"; //匹配目标"Step:+Handler:"组合
            MatchCollection matches;
            Regex           regObj;

            //任务名
            if (IsCreateCheckBox.IsChecked == true)
            {
                strName = NewNameBox.Text;
                if (strName == "")
                {
                    InputWarning.PlacementTarget = NewNameBox;
                    WarningInfo.Text             = "Please enter a non-empty value.";
                    InputWarning.IsOpen          = true;
                    return(false);
                }
                regObj  = new Regex(strExtractPattern); //正则表达式初始化,载入匹配模式
                matches = regObj.Matches(strName);      //正则表达式对分词结果进行匹配
                if (matches.Count == 0)
                {
                    InputWarning.PlacementTarget = NewNameBox;
                    WarningInfo.Text             = "Name field only include Chinese, English, Underline characters.";
                    InputWarning.IsOpen          = true;
                    return(false);
                }
            }
            //优先级
            if (PriorityTextBox.Text == "")
            {
                InputWarning.PlacementTarget = PriorityTextBox;
                WarningInfo.Text             = "Please select a submitter for the task.";
                InputWarning.IsOpen          = true;
                return(false);
            }
            if (int.TryParse(PriorityTextBox.Text, out intPriority) == false)
            {
                InputWarning.PlacementTarget = PriorityTextBox;
                WarningInfo.Text             = "Please input a number between 0 and 100.";
                InputWarning.IsOpen          = true;
                return(false);
            }
            if (intPriority > 100 || intPriority < 0)
            {
                InputWarning.PlacementTarget = PriorityTextBox;
                WarningInfo.Text             = "Please input a number between 0 and 100.";
                InputWarning.IsOpen          = true;
                return(false);
            }
            //绑定流程
            strProcedure = ProcedureComboBox.Text;
            if (strProcedure != "")
            {
                if (mainDataSet.GetProcedureItem(strProcedure) == null)
                {
                    InputWarning.PlacementTarget = PriorityTextBox;
                    WarningInfo.Text             = "Selected Procedure is not exists in DB.";
                    InputWarning.IsOpen          = true;
                    return(false);
                }
                if (mainDataSet.GetProcedureItem(strProcedure).IsBindingType == true)
                {
                    InputWarning.PlacementTarget = PriorityTextBox;
                    WarningInfo.Text             = "Selected Procedure already binding a Type.";
                    InputWarning.IsOpen          = true;
                    return(false);
                }
            }
            //描述
            strDescription = DescriptionBox.Text;
            if (strDescription == "")
            {
                InputWarning.PlacementTarget = DescriptionBox;
                WarningInfo.Text             = "Please enter a non-empty value.";
                InputWarning.IsOpen          = true;
                return(false);
            }
            return(true);
        }