private void Stat(List <DwNumber> numbers, string dbName, string dmName, string[] numberTypes, bool isReset) { Dictionary <string, Dictionary <string, int> > numberTypeLastSpanDict = new Dictionary <string, Dictionary <string, int> >(100000); List <DwSpan> entities = new List <DwSpan>(numbers.Count); IDwSpanDAO spanDao = DAOFactory.Create <IDwSpanDAO>(dbName, ConfigHelper.GetDwSpanTableName(dmName)); if (isReset) { spanDao.Truncate(); } long lastP = spanDao.SelectLatestPeroid(string.Empty); foreach (DwNumber number in numbers) { Dictionary <string, int> pSpanDict = GetSpanDict(numberTypeLastSpanDict, dmName, numberTypes, number); if (number.P > lastP) { entities.Add(this.CreateSpan(number, pSpanDict)); } } string[] columnNames = numberTypes.Select(x => x + "Spans").Union(new string[] { "P" }).ToArray(); spanDao.Insert(entities, SqlInsertMethod.SqlBulkCopy, columnNames); Console.WriteLine("{0} {1} Finished", dbName, dmName); }
private void AddSpan(DwNumber number) { string[] dmNames = DimensionNumberTypeBiz.Instance.GetEnabledDimensions("PL35"); List <BatchEntity <DwSpan> > batchEntities = new List <BatchEntity <DwSpan> >(dmNames.Length); foreach (string dmName in dmNames) { string[] numberTypes = DimensionNumberTypeBiz.Instance.GetNumberTypes("PL35", dmName); Dictionary <string, int> spanDict = this.DataAccessor.SelectSpansByNumberTypes(number, dmName, numberTypes); DwSpan dwSpan = new DwSpan() { P = number.P }; foreach (string key in spanDict.Keys) { string propertyName = string.Format("{0}Spans", key); dwSpan[propertyName] = spanDict[key]; } string destTableName = ConfigHelper.GetDwSpanTableName(dmName); string[] columnNames = numberTypes.Select(x => x + "Spans").Union(new string[] { "P" }).ToArray(); BatchEntity <DwSpan> batchEntity = new BatchEntity <DwSpan>(dwSpan, destTableName, columnNames); batchEntities.Add(batchEntity); } IDwSpanDAO spanDao = DAOFactory.Create <IDwSpanDAO>(this._currentDbName, string.Empty); spanDao.Insert(batchEntities); }
public void AddC5CXSpan(DwNumber number) { string[] dmNames = new string[] { "Peroid", "He" }; string[] numberTypes = new string[] { "A2", "A3", "A4", "A6", "A7", "A8" }; List <BatchEntity <DwC5CXSpan> > batchEntities = new List <BatchEntity <DwC5CXSpan> >(70); IDwC5CXSpanDAO spanDao = DAOFactory.Create <IDwC5CXSpanDAO>(this._currentDbName, string.Empty); foreach (var numberType in numberTypes) { string newNumberType = numberType.Replace("A", "C"); string tableName = ConfigHelper.GetDwSpanTableName(string.Format("{0}{1}", "C5", newNumberType)); var c5cxNumbers = NumberCache.Instance.GetC5CXNumbers(number.C5, newNumberType); var lastSpanDict = spanDao.SelectLastSpans(c5cxNumbers, number.Seq, tableName, dmNames, newNumberType); var c5cxSpans = this.GetC5CXSpans(lastSpanDict, c5cxNumbers, number, tableName, dmNames); batchEntities.AddRange(c5cxSpans); } spanDao.Insert(batchEntities); }
public DwSpanBiz(string dbName, string tableName) : base(DAOFactory.Create <IDwSpanDAO>(dbName, ConfigHelper.GetDwSpanTableName(tableName))) { }
public DmDPCBiz(string dbName, string tableName) : base(DAOFactory.Create <IDmDPCDAO>(dbName, ConfigHelper.GetDmTableName(tableName))) { }
public DmC5CXBiz(string dbName) : base(DAOFactory.Create <IDmC5CXDAO>(dbName)) { }
protected NumberTypeBiz() : base(DAOFactory.Create <INumberTypeDAO>("common")) { this.LoadToCache(); }
public DwNumberBiz(string dbName) : base(DAOFactory.Create <IDwNumberDAO>(dbName)) { this._currentDbName = dbName; }
protected CategoryBiz() : base(DAOFactory.Create <ICategoryDAO>("common")) { this.LoadToCache(); }
protected DimensionBiz() : base(DAOFactory.Create <IDimensionDAO>("common")) { this.LoadToCache(); }