using System; using System.Collections.Generic; using System.Linq; using System.Data; using System.Text.RegularExpressions; using MySystem.Models; using Library; namespace MySystem { public class PublicFunction { public static decimal NumberFormat(decimal number, int floatCount = 2) { string str = number.ToString(); if (str.Contains(".")) { string[] list = str.Split('.'); if (list[1].Length > floatCount) { str = list[0] + "." + list[1].Substring(0, floatCount); } } else { str += ".00"; } return decimal.Parse(str); } public static string GetPublicParam(WebCMSEntities db, string Key) { CustomTagSet set = db.CustomTagSet.FirstOrDefault(m => m.Tags == Key); if(set != null) { return set.Contents; } return ""; } } }