private string GetRuleName(RuleBase rule) { if (rule == null) { return string.Empty; } else { string sClassName = rule.ClassName; int iIndex = sClassName.LastIndexOf('.'); if (iIndex == -1) { return sClassName; } else { return sClassName.Substring(iIndex + 1); } } }
/// <summary> /// 建立規則 /// </summary> /// <param name="className">規則類別名稱</param> /// <returns>返回值:規則類別</returns> internal static RuleBase CreateRule(RuleBase rule) { RuleBase cRule = null; if (rule != null) { object oArgs = rule.args; string sRuleClass = rule.ClassName; if (oArgs == null) { cRule = Activator.CreateInstance(Type.GetType(sRuleClass)) as RuleBase; } else { cRule = Activator.CreateInstance(Type.GetType(sRuleClass), oArgs) as RuleBase; } cRule.ClassName = sRuleClass; } return cRule; }
private bool SetRule(ref RuleBase rule, string className, bool isSetting) { if (rule != null) { if (isSetting && className.Equals(rule.ClassName)) { DialogResult cResult = MessageBox.Show(__sMessageContent_001, __sMessageHeader_001, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (cResult == DialogResult.Yes) { IRuleSetting cSetting = rule as IRuleSetting; cSetting.ShowSetting(); return false; } } } rule = new RuleBase(); rule.ClassName = className; return true; }
/// <summary> /// 建立佣金規則介面 /// </summary> /// <param name="rule">基礎規則類別</param> /// <returns>返回值: ICommission 介面</returns> public override ICommission CreateCommission(RuleBase rule) { return RuleCreater.CreateRule(rule) as ICommission; }
/// <summary> /// 建立佣金規則介面 /// </summary> /// <param name="rule">基礎規則類別</param> /// <returns>返回值: ICommission 介面</returns> public abstract ICommission CreateCommission(RuleBase rule);