Beispiel #1
0
        public static string ReplaceFormula(string formula, string templateType)
        {
            new SalaryTemplate();
            SetSalaryBll       bll       = new SetSalaryBll();
            SamTemplateItemBll bll2      = new SamTemplateItemBll();
            List <string>      list      = StringUtility.ParseString(formula, "[", "]");
            List <string>      list2     = StringUtility.ParseString(formula, "{", "}");
            SalaryParameter    parameter = new SalaryParameter();

            foreach (string str in list2)
            {
                formula = formula.Replace(str, parameter.Paras[str]);
            }
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            if (string.Compare(templateType, "B", true) == 0)
            {
                dictionary = GetDictionaryFromTable(bll.GetFieldAndRemark(), "name", "value");
            }
            else if (string.Compare(templateType, "C", true) == 0)
            {
                dictionary = GetDictionaryFromTable(bll2.GetAllList(), "ItemCode", "ItemName");
            }
            foreach (string str2 in list)
            {
                formula = formula.Replace(str2, dictionary[str2]);
            }
            return(formula);
        }
Beispiel #2
0
        public static string ReplaceFormula(string formula)
        {
            new SalaryTemplate();
            SetSalaryBll bll = new SetSalaryBll();

            new SamTemplateItemBll();
            List <string>   list      = StringUtility.ParseString(formula, "[", "]");
            List <string>   list2     = StringUtility.ParseString(formula, "{", "}");
            SalaryParameter parameter = new SalaryParameter();

            foreach (string str in list2)
            {
                formula = formula.Replace(str, parameter.Paras[str]);
            }
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary = GetDictionaryFromTable(bll.GetFieldAndRemark(), "name", "value");
            foreach (string str2 in list)
            {
                formula = formula.Replace(str2, dictionary[str2]);
            }
            return(formula);
        }