public override List <RulePropertyAttribute> GetRuleItems(ERuleType ruleType) { List <RulePropertyAttribute> cRuleItems = null; __cRuleItems.TryGetValue(ruleType, out cRuleItems); return(cRuleItems); }
/// <summary> /// 建構子 /// </summary> /// <param name="type">規則類型</param> /// <param name="name">規則名稱</param> /// <param name="className">規則類別名稱</param> /// <param name="comment">規則說明</param> /// <param name="isNeedSetting">是否需要設定(如果需要設定則需要時做 IRuleSetting 介面)</param> public RulePropertyAttribute(ERuleType type, string name, string className, string comment, bool isNeedSetting = false) { __cRuleType = type; __sName = name; __sClassName = className; __sComment = comment; __bNeedSetting = isNeedSetting; }
internal frmProductRuleSettings(string exchangeName, ERuleType ruleType, AbstractProductProperty property) { InitializeComponent(); __cRuleType = ruleType; __cProperty = property; AbstractExchange cExchange = ProductManager.Manager.GetExchange(exchangeName); __cRules = cExchange.GetRuleItems(ruleType); }
private void RuleButton_onClick(object sender, EventArgs e) { Button cButton = sender as Button; ERuleType cRuleType = (ERuleType)cButton.Tag; frmProductRuleSettings frmProductRuleSettings = new frmProductRuleSettings(__sExchangeName, cRuleType, __cProperty); frmProductRuleSettings.ShowDialog(); RefreshRules(); }
private Rule(ERuleType ruleType, List <Rule> children, List <int> strIndex, int index, int len, int offset, byte[] buffer = null) { RuleType = ruleType; Children = children; strIndex?.Sort(); StrIndex = strIndex; Index = index; Len = len; Offset = offset; AddBuffer = buffer; }
private void comboType_SelectedIndexChanged(object sender, EventArgs e) { int iIndex = comboType.SelectedIndex; switch (iIndex) { case 0: __cRuleType = ERuleType.Commission; break; case 1: __cRuleType = ERuleType.Fee; break; } LoadRuls(); }
/// <summary> /// 取得腳本物件內的所有使用者自訂的必要參數 /// </summary> /// <param name="target">Assembly 組件</param> /// <returns>返回值: 規則屬性類別列表(根據 ERuleType 分類)</returns> public static Dictionary <ERuleType, List <RulePropertyAttribute> > GetRules(Assembly target) { Dictionary <ERuleType, List <RulePropertyAttribute> > cRules = null; Type[] cTypes = target.GetTypes(); int iLength = cTypes.Length; if (iLength > 0) { cRules = new Dictionary <ERuleType, List <RulePropertyAttribute> >(); foreach (Type cType in cTypes) { if (cType.IsClass) { bool bExist = cType.IsDefined(typeof(RulePropertyAttribute), false); if (bExist) { object[] oAttribs = cType.GetCustomAttributes(typeof(RulePropertyAttribute), false); foreach (object oAttrib in oAttribs) { RulePropertyAttribute cRule = oAttrib as RulePropertyAttribute; ERuleType cRuleType = cRule.RuleType; List <RulePropertyAttribute> cList = null; if (!cRules.TryGetValue(cRuleType, out cList)) { cList = new List <RulePropertyAttribute>(); cRules.Add(cRuleType, cList); } cList.Add(cRule); } } } } } return(cRules); }
/// <summary> /// 取得可用的規則項目列表 /// </summary> /// <param name="ruleType">規則型態(由型態區分規則項目)</param> /// <returns>返回值:規則項目列表</returns> public abstract List<RulePropertyAttribute> GetRuleItems(ERuleType ruleType);
public override List<RulePropertyAttribute> GetRuleItems(ERuleType ruleType) { List<RulePropertyAttribute> cRuleItems = null; __cRuleItems.TryGetValue(ruleType, out cRuleItems); return cRuleItems; }