public static void C5CX(string name, string type, int length, string output) { List<DmDPC> srcNumbers = null; if (length > 5) { srcNumbers = NumberCache.Instance.GetNumberList(type); } else { srcNumbers = NumberCache.Instance.GetNumberList("C5"); } DmC5CXBiz biz = new DmC5CXBiz(name); List<DmC5CX> entities = new List<DmC5CX>(srcNumbers.Count * 56); foreach (var srcNumber in srcNumbers) { string number = srcNumber.Number.Replace(' ', ','); var cxNumbers = new Combinations<int>(number.ToList(), length > 5 ? 5 : length); foreach (var cxNumber in cxNumbers) { string cx = NumberCache.Instance.GetNumberId(length > 5 ? "C5" : type, cxNumber.Format("D2", ",")); DmC5CX entity = new DmC5CX(); entity.C5 = (length > 5) ? cx : srcNumber.Id; entity.CX = (length > 5) ? srcNumber.Id : cx; entity.C5Number = (length > 5) ? cx.ToString(2, " ") : srcNumber.Number; entity.CXNumber = (length > 5) ? srcNumber.Number : cx.ToString(2, " "); entity.NumberType = type; entities.Add(entity); } } biz.DataAccessor.Insert(entities, SqlInsertMethod.SqlBulkCopy); }
public static void C5CX(string name, string type, int length, string output) { List <DmDPC> srcNumbers = null; if (length > 5) { srcNumbers = NumberCache.Instance.GetNumberList(type); } else { srcNumbers = NumberCache.Instance.GetNumberList("C5"); } DmC5CXBiz biz = new DmC5CXBiz(name); List <DmC5CX> entities = new List <DmC5CX>(srcNumbers.Count * 56); foreach (var srcNumber in srcNumbers) { string number = srcNumber.Number.Replace(' ', ','); var cxNumbers = new Combinations <int>(number.ToList(), length > 5 ? 5 : length); foreach (var cxNumber in cxNumbers) { string cx = NumberCache.Instance.GetNumberId(length > 5 ? "C5" : type, cxNumber.Format("D2", ",")); DmC5CX entity = new DmC5CX(); entity.C5 = (length > 5) ? cx : srcNumber.Id; entity.CX = (length > 5) ? srcNumber.Id : cx; entity.C5Number = (length > 5) ? cx.ToString(2, " ") : srcNumber.Number; entity.CXNumber = (length > 5) ? srcNumber.Number : cx.ToString(2, " "); entity.NumberType = type; entities.Add(entity); } } biz.DataAccessor.Insert(entities, SqlInsertMethod.SqlBulkCopy); }
private void LoadC5CXData() { this.c5cxCaching.Clear(); DmC5CXBiz dmC5CXBiz = new DmC5CXBiz(ConfigHelper.D11x5DmTableConnStringName); List<DmC5CX> c5cxNumbers = dmC5CXBiz.GetAll(DmC5CX.C_C5, DmC5CX.C_CX, DmC5CX.C_NumberType); foreach (var c5cxNumber in c5cxNumbers) { if (!c5cxCaching.ContainsKey(c5cxNumber.C5)) { List<DmC5CX> subNumbers = new List<DmC5CX>(20); subNumbers.Add(c5cxNumber); Dictionary<string, List<DmC5CX>> numberTypeNumbers = new Dictionary<string, List<DmC5CX>>(6); numberTypeNumbers.Add(c5cxNumber.NumberType, subNumbers); c5cxCaching.Add(c5cxNumber.C5, numberTypeNumbers); continue; } if (!c5cxCaching[c5cxNumber.C5].ContainsKey(c5cxNumber.NumberType)) { List<DmC5CX> subNumbers = new List<DmC5CX>(20); subNumbers.Add(c5cxNumber); c5cxCaching[c5cxNumber.C5].Add(c5cxNumber.NumberType, subNumbers); continue; } c5cxCaching[c5cxNumber.C5][c5cxNumber.NumberType].Add(c5cxNumber); } }