コード例 #1
0
        //Chú ý tên table trong DataTable phải giống như tên table mà mình cần thao tác thêm xóa
        public static PLGridViewUpdate ToPLGridViewUpdate(GridControl grid, PLGridView gridView,
            DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission,
            PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc,
            PLDelegation.ProcessDataRow UpdateFunc, int RowPerPage)
        {
            PLGridViewUpdate update = new PLGridViewUpdate();
            for (int i = 0; i < gridView.Columns.Count; i++)
            {
                update.gridView.Columns.Add(gridView.Columns[i]);
            }

            update._init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule,
                        permission, InsertFunc, DeleteFunc, UpdateFunc);

            PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(update.gridControl, RowPerPage, update);
            page.AddFunction = update.AddAction;
            page.DeleteFunction = update.DeleteAction;
            page.EditFunction = update.EditAction;
            page.NoSaveFunction = update.NoSaveAction;
            page.PrintFunction = update.PrintAction;
            page.SaveFunction = update.SaveAction;

            update.Dock = grid.Dock;
            update.Location = grid.Location;

            return update;
        }
コード例 #2
0
ファイル: DMBasicGrid.cs プロジェクト: khanhdtn/my-fw-win
 /// <summary>Unique: N Field, Phân quyền: Có (Chưa xây dựng)
 /// </summary>
 public DMBasicGrid(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
     InitGridColumns InitGridCol, GetRule Rule,
     DelegationLib.DefinePermission permission,
     PLDelegation.ProcessDataRow InsertFunc,
     PLDelegation.ProcessDataRow DeleteFunc,
     PLDelegation.ProcessDataRow UpdateFunc)
 {
     InitializeComponent();
     _init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission,
          InsertFunc,  DeleteFunc,  UpdateFunc);
 }
コード例 #3
0
ファイル: frmAppParams.cs プロジェクト: khanhdtn/my-fw-win
        public void _init(InitParams InitParam, GetRule Rule)
        {
            ParamList = frmAppParamsHelp._initParams();
            ParamGroupList = frmAppParamsHelp._initParamGroup();

            this.InitParam = InitParam;
            this.Rule = Rule;

            if (InitParam != null)
            {
                InitGrid(InitParam());
                InitEventGrid();
                InitDataGrid();
            }
        }
コード例 #4
0
        public void GetRule()
        {
            string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "GetRule.xml"));
            var    request  = new GetRule
            {
                SessionId = "sid",
                Who       = "*****@*****.**",
                RuleID    = 1
            };
            var xml = request.ToXml().InnerXmlFormatted();

            Assert.AreEqual(expected, xml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "GetRule.xml")));
            var response = request.FromHttpRequestResult(new HttpRequestResult {
                Response = doc.InnerXml
            });

            Assert.AreEqual("result", response.Type);
            Assert.AreEqual("Test", response.Title);
            Assert.True(response.Active);
            Assert.AreEqual(1, response.RuleID);

            Assert.AreEqual(1, response.Conditions.Items.Count);
            Assert.AreEqual(typeof(TRuleSomeWordsCondition), response.Conditions.Items.First().GetType());
            Assert.AreEqual(TRuleConditionType.CustomHeader, response.Conditions.Items.First().ConditionType);
            Assert.True(response.Conditions.Items.First().OperatorAnd);
            Assert.AreEqual(TRuleSomeWordsFunctionType.Regex, ((TRuleSomeWordsCondition)response.Conditions.Items.First()).MatchFunction);
            Assert.AreEqual("X-Priority: 2", ((TRuleSomeWordsCondition)response.Conditions.Items.First()).MatchValue);

            Assert.AreEqual(2, response.Actions.Items.Count);
            Assert.AreEqual(typeof(TRuleMessageActionAction), response.Actions.Items.First().GetType());
            Assert.AreEqual(TRuleActionType.MessageAction, response.Actions.Items.First().Actiontype);

            Assert.AreEqual(typeof(TRulePriorityAction), response.Actions.Items.Last().GetType());
            Assert.AreEqual(TRuleActionType.Priority, response.Actions.Items.Last().Actiontype);
        }
コード例 #5
0
ファイル: frmAppParams.cs プロジェクト: khanhdtn/my-fw-win
 //Định nghĩa các luật kiểm tra
 public frmAppParams(InitParams InitParam, GetRule Rule)
 {
     InitializeComponent();
     _init(InitParam, Rule);
 }
コード例 #6
0
ファイル: Engine.cs プロジェクト: y2737924daohegua/tweek
        public static GetRuleValue GetRulesEvaluator(IdentityHashSet identities, GetLoadedContextByIdentityType contextByIdentity, GetRule getRule)
        {
            var identityTypes  = identities.Select(x => x.Type).ToArray();
            var flattenContext = ContextHelpers.FlattenLoadedContext(contextByIdentity);

            GetRuleValue    getRuleValue     = null;
            GetContextValue recursiveContext = key =>
            {
                if (key.StartsWith("@@key:"))
                {
                    key = key.Replace("@@key:", "keys.");
                }
                if (!key.StartsWith("keys."))
                {
                    return(Option <JsonValue> .None);
                }
                var path = new ConfigurationPath(key.Split('.')[1]);
                return(getRuleValue(path).Map(x => x.Value));
            };

            var context = ContextHelpers.Merge(flattenContext, recursiveContext);

            getRuleValue = Memoize(path =>
            {
                try
                {
                    foreach (var identity in identityTypes)
                    {
                        var fixedResult = ContextHelpers.GetFixedConfigurationContext(context, identity)(path);
                        if (fixedResult.IsSome)
                        {
                            return(fixedResult);
                        }
                    }

                    return(getRule(path).Bind(x => x.GetValue(context)));
                }
                catch (Exception e)
                {
                    return(ConfigurationValue.Error(e));
                }
            });
            return(getRuleValue);
        }
コード例 #7
0
        public void _init(
            string TableName, string IDField,
            string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission, int RowPerPage)
        {
            base._init(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission);

            PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(gridControl, RowPerPage, this);
            page.AddFunction = AddAction;
            page.DeleteFunction = DeleteAction;
            page.EditFunction = EditAction;
            page.NoSaveFunction = NoSaveAction;
            page.PrintFunction = PrintAction;
            page.SaveFunction = SaveAction;
        }
コード例 #8
0
ファイル: DMBasicGrid.cs プロジェクト: khanhdtn/my-fw-win
 /// <summary>Unique: 1 Field, Phân quyền: Không
 /// </summary>
 public DMBasicGrid(string TableName, string IDField, string NameField, string Subject, 
     InitGridColumns InitGridCol, GetRule Rule)
     : this(TableName, IDField, new string[] { NameField }, new string[] { Subject }, InitGridCol, Rule, null)
 {
 }
コード例 #9
0
ファイル: DMBasicGrid.cs プロジェクト: khanhdtn/my-fw-win
 /// <summary>Unique: N Field, Phân quyền: Không
 /// </summary>
 public DMBasicGrid(string TableName, string IDField, string[] NameFields, string[] Subjects,
     InitGridColumns InitGridCol, GetRule Rule)
     : this(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, null)
 {
 }
コード例 #10
0
ファイル: DMBasicGrid.cs プロジェクト: khanhdtn/my-fw-win
 /// <summary>Unique: N Field, Phân quyền: Có (Chưa xây dựng)
 /// </summary>
 public DMBasicGrid(string TableName, string IDField, string[] NameFields, string[] Subjects, 
     InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission)
 {
     InitializeComponent();
     _init(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission);
 }
コード例 #11
0
ファイル: DMBasicGrid.cs プロジェクト: khanhdtn/my-fw-win
        public void _init(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects,
            InitGridColumns InitGridCol, GetRule Rule,
            DelegationLib.DefinePermission permission,
            PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc)
        {
            this.TableName = null;
            this.DataSource = DataSource;
            this.InsertFunc = InsertFunc;
            this.DeleteFunc = DeleteFunc;
            this.UpdateFunc = UpdateFunc;

            this.IDField = IDField;
            this.NameFields = NameFields;
            this.Subjects = Subjects;
            this.InitGridCol = InitGridCol;
            this.Rule = Rule;
            InitGrid();
            InitDataGrid();
            InitEventGrid();
            this.permission = permission;
            this.gridView.DoubleClick += new EventHandler(gridView_DoubleClick);
        }
コード例 #12
0
 public static GetRule With(this GetRule target, string path, IRule rule)
 {
     return(Merge(target, With(path, rule)));
 }
コード例 #13
0
 public static GetRule Merge(GetRule l, GetRule r)
 {
     return(fnPath => GetOneOrMerge(l(fnPath), r(fnPath), (lRule, rRule) => new RuleSet(new[] { lRule, rRule })));
 }
コード例 #14
0
        public void _init(bool OnlyVGrid)
        {
            object instance = GenerateClass.initObject(ClassName);

            if(instance != null && instance is IObject){
                IObject obj = (IObject)instance;
                if (OnlyVGrid)
                    this.InitInfoGridCol = null;
                else
                    this.InitInfoGridCol = obj.CreateInfoGrid;

                this.InitVGridCol = obj.CreateVGrid;
                this.Rule = obj.GetRuleVGrid;

                InitGrid();
            }
            else
            {
                PLMessageBoxDev.ShowMessage("Cấu hình sai vì " + ClassName + " không tồn tại");
            }
        }
コード例 #15
0
        public void _initThamSoNghiepVu(InitParams InitParam, GetRule Rule)
        {
            ParamList = frmAppParamsHelp._initParams();
            ParamGroupList = frmAppParamsHelp._initParamGroup();

            this.InitParam = InitParam;
            this.Rule = Rule;

            if (InitParam != null)
            {
                InitGridNghiepVu(InitParam());
                InitDataGridNghiepVu();
            }

            vGridMain_FocusedRowChanged(null, null);
        }