Esempio n. 1
0
        public List <RuleForm> getRuleFormChild(string obChildID)
        {
            string          sql      = string.Format("Select [AllowAdd], [AllowDelete], [AllowEdit], [AllowAccess], [AllowPrint], [AllowExport], [AllowImport] From [SYS_RULE_FORM] where [OBJECT_CHILD_ID] = '{0}' ", obChildID);
            List <RuleForm> listRule = new List <RuleForm>();

            DataTable data = ConnectionDB.getData(sql);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                RuleForm ruleForm = new RuleForm();
                ruleForm.AllowAccess = bool.Parse(data.Rows[i]["AllowAccess"].ToString());
                ruleForm.AllowAdd    = bool.Parse(data.Rows[i]["AllowAdd"].ToString());
                ruleForm.AllowDelete = bool.Parse(data.Rows[i]["AllowDelete"].ToString());
                ruleForm.AllowEdit   = bool.Parse(data.Rows[i]["AllowEdit"].ToString());
                ruleForm.AllowPrint  = bool.Parse(data.Rows[i]["AllowPrint"].ToString());
                ruleForm.AllowExport = bool.Parse(data.Rows[i]["AllowExport"].ToString());
                ruleForm.AllowImport = bool.Parse(data.Rows[i]["AllowImport"].ToString());

                listRule.Add(ruleForm);
            }
            return(listRule);
        }
Esempio n. 2
0
        private bool SaveWorkflow()
        {
            bool IsSuccess = false;

            SaveXaml();

            if (string.IsNullOrEmpty(_idpeRule.Xaml))
            {
                MessageBox.Show("Can not save blank rule ", "Validation check", MessageBoxButton.OK, MessageBoxImage.Hand);
                return(IsSuccess);
            }

            if (!this._WorkflowDesigner.IsInErrorState())
            {
                TabItem ti = TabCtrl.SelectedItem as TabItem;
                if (ti.Header == "Designer")
                {
                    if (string.IsNullOrEmpty(_idpeRule.Name) || _idpeRule.Name == "New Rule Designer")
                    {
                        _idpeRule.Name = "new rule1";
                    }

                    _idpeRule.Xaml = this._WorkflowDesigner.Text;
                    RulesExtraInformation rulesExtraInformation = new RulesExtraInformation(_idpeRule);
                    _idpeRule.Name        = rulesExtraInformation.RuleName;
                    _idpeRule.Description = rulesExtraInformation.RuleDescription;

                    if (Keyboard.Modifiers == ModifierKeys.Control)
                    {
                        Save();
                    }
                    else
                    {
                        if (rulesExtraInformation.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            _idpeRule.Name        = rulesExtraInformation.RuleName;
                            _idpeRule.Description = rulesExtraInformation.RuleDescription;
                            Save();
                            rulesExtraInformation.Close();
                        }
                        else
                        {
                            return(false); //to avoid closing this form, we dont want to close and lose
                        }
                    }
                    if (RuleForm != null)
                    {
                        RuleForm.RefreshRules(RuleForm.txtSearch.Text);
                    }
                }
                else
                {
                    Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                    dlg.FileName   = _idpeRule.Name + ".xml";
                    dlg.DefaultExt = ".xml";
                    dlg.Filter     = "XML documents (.xml)|*.xml";

                    Nullable <bool> result = dlg.ShowDialog();

                    if (result == true)
                    {
                        this._WorkflowDesigner.Save(dlg.FileName);
                    }
                }

                IsSuccess          = true;
                _IsWorkflowChanged = false;
            }
            else
            {
                this.AddErrors();
                IsSuccess = false;
            }
            return(IsSuccess);
        }