示例#1
0
        public ViewActions()
        {
            InitializeComponent();
            DatabaseMethods _data = new DatabaseMethods();
            var             items = _data.GetAllActions();

            tblActions.ItemsSource = items;
        }
示例#2
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            string requirement             = txtRequirement.Text;
            string specification           = string.Empty;
            List <ReplaceParams>  replaces = new List <ReplaceParams>();
            List <Specifications> specs    = new List <Specifications>();
            DatabaseMethods       _data    = new DatabaseMethods();
            var items = _data.GetAllActions();

            string[] splitreqs = requirement.Split(' ');
            int      intreturn = 0, intSuffix = 1;

            if (!string.IsNullOrEmpty(requirement))
            {
                foreach (var item in items)
                {
                    if (requirement.Contains(item.ActionName))
                    {
                        int x = GetIndexOfArray(item.ActionName, splitreqs);

                        for (int i = 0; i < splitreqs.Length; i++)
                        {
                            if (item.ActionName == splitreqs[i])
                            {
                                bool isInt = int.TryParse(splitreqs[i + 1], out intreturn);

                                specs.Add(new Specifications
                                {
                                    sortid = i,
                                    SpecificationAction = "FS_" + Convert.ToString(intSuffix) + " : " + item.ActionName,
                                    Action    = item.ActionName,
                                    Mechanism =
                                        isInt ?  "IF " + item.ActionMechanism + " " + splitreqs[i + 1] + " THEN Thea shall notify with a voice message - you " + item.ActionName + "ed " + splitreqs[i + 1] + " " + splitreqs[i + 2]
                                           : "IF " + item.ActionMechanism + " " + splitreqs[i + 1] + " THEN Thea shall notify with a voice message - you " + item.ActionName + "ed " + splitreqs[i + 1]
                                });
                                intSuffix    = intSuffix + 1;
                                splitreqs[i] = splitreqs[i] + "XXXX";
                            }
                        }
                    }
                }
            }


            tblSpecifications.ItemsSource = specs.OrderBy(t => t.sortid).ToList();
        }