//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; }
/// <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); }
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(); } }
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); }
//Định nghĩa các luật kiểm tra public frmAppParams(InitParams InitParam, GetRule Rule) { InitializeComponent(); _init(InitParam, Rule); }
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); }
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; }
/// <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) { }
/// <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) { }
/// <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); }
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); }
public static GetRule With(this GetRule target, string path, IRule rule) { return(Merge(target, With(path, rule))); }
public static GetRule Merge(GetRule l, GetRule r) { return(fnPath => GetOneOrMerge(l(fnPath), r(fnPath), (lRule, rRule) => new RuleSet(new[] { lRule, rRule }))); }
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"); } }
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); }