private Dictionary<string, int> GetSpanDict(Dictionary<string, Dictionary<string, int>> numberTypeLastSpanDict, string dmName, string[] numberTypes, DwNumber number) { if (dmName.Equals("Peroid")) return this.GetPeroidSpanDict(numberTypeLastSpanDict, numberTypes, number); Dictionary<string, int> pSpanDict = new Dictionary<string, int>(numberTypes.Length); foreach (string numberType in numberTypes) { if (!numberTypeLastSpanDict.ContainsKey(numberType)) numberTypeLastSpanDict.Add(numberType, new Dictionary<string, int>(1000)); int spans = number.Seq - 1; string dmValue = number[numberType].GetDmValue(1, dmName, 4); if (numberTypeLastSpanDict[numberType].ContainsKey(dmValue)) { spans = number.Seq - numberTypeLastSpanDict[numberType][dmValue] - 1; numberTypeLastSpanDict[numberType][dmValue] = number.Seq; } else { numberTypeLastSpanDict[numberType].Add(dmValue, number.Seq); } pSpanDict.Add(numberType, spans); } return pSpanDict; }
private DwC5CXSpan GetC5CXSpan(Dictionary <string, Dictionary <string, int> > lastSpanDict, DwNumber number, string[] dmNames, DmC5CX cxNumber) { DwC5CXSpan c5cxSpan = new DwC5CXSpan(); c5cxSpan.P = number.P; c5cxSpan.Seq = number.Seq; c5cxSpan.C5 = number.C5; c5cxSpan.CX = cxNumber.CX; foreach (string dmName in dmNames) { if (!lastSpanDict.ContainsKey(dmName)) { lastSpanDict.Add(dmName, new Dictionary <string, int>(1000)); } string propertyName = dmName + "Spans"; int spans = number.Seq - 1; string dmValue = cxNumber.CX.GetDmValue(2, dmName, 5); if (lastSpanDict[dmName].ContainsKey(dmValue)) { spans = number.Seq - lastSpanDict[dmName][dmValue] - 1; lastSpanDict[dmName][dmValue] = number.Seq; } else { lastSpanDict[dmName].Add(dmValue, number.Seq); } c5cxSpan[propertyName] = spans; } return(c5cxSpan); }
private DwC5CXSpan GetC5CXSpan(Dictionary<string, Dictionary<string, int>> lastSpanDict, DwNumber number, string[] dmNames, DmC5CX cxNumber) { DwC5CXSpan c5cxSpan = new DwC5CXSpan(); c5cxSpan.P = number.P; c5cxSpan.Seq = number.Seq; c5cxSpan.C5 = number.C5; c5cxSpan.CX = cxNumber.CX; foreach (string dmName in dmNames) { if (!lastSpanDict.ContainsKey(dmName)) lastSpanDict.Add(dmName, new Dictionary<string, int>(1000)); string propertyName = dmName + "Spans"; int spans = number.Seq - 1; string dmValue = cxNumber.CX.GetDmValue(2, dmName, 5); if (lastSpanDict[dmName].ContainsKey(dmValue)) { spans = number.Seq - lastSpanDict[dmName][dmValue] - 1; lastSpanDict[dmName][dmValue] = number.Seq; } else { lastSpanDict[dmName].Add(dmValue, number.Seq); } c5cxSpan[propertyName] = spans; } return c5cxSpan; }
private Dictionary <string, int> GetPeroidSpanDict(Dictionary <string, Dictionary <string, int> > numberTypeLastSpanDict, string[] numberTypes, DwNumber number) { Dictionary <string, int> pSpanDict = new Dictionary <string, int>(numberTypes.Length); foreach (string numberType in numberTypes) { if (!numberTypeLastSpanDict.ContainsKey(numberType)) { numberTypeLastSpanDict.Add(numberType, new Dictionary <string, int>(1000)); } int spans = number.Seq - 1; string numTypeValue = number[numberType].ToString(); if (numberTypeLastSpanDict[numberType].ContainsKey(numTypeValue)) { spans = number.Seq - numberTypeLastSpanDict[numberType][numTypeValue] - 1; numberTypeLastSpanDict[numberType][numTypeValue] = number.Seq; } else { numberTypeLastSpanDict[numberType].Add(numTypeValue, number.Seq); } pSpanDict.Add(numberType, spans); } return(pSpanDict); }
public static void Update(int categoryId, string p, string code) { Category category = CategoryBiz.Instance.GetById(categoryId); DwNumberBiz biz = new DwNumberBiz(category.DbName); DwNumber number = biz.GetById(p); DwNumber newNumber = biz.Create(number.P, number.N, code, number.Date, number.Created.ToString()); newNumber.Seq = number.Seq; biz.Modify(newNumber, newNumber.P.ToString()); }
private DwSpan CreateSpan(DwNumber number, Dictionary<string, int> pSpanDict) { DwSpan span = new DwSpan() { P = number.P }; foreach (string key in pSpanDict.Keys) { string propertyName = string.Format("{0}Spans", key); span[propertyName] = pSpanDict[key]; } return span; }
private List<DwC5CXSpan> GetC5CXSpanList(Dictionary<string,Dictionary<string, int>> lastSpanDict, List<DmC5CX> cxNumbers, DwNumber number,string[] dmNames) { List<DwC5CXSpan> c5cxSpans = new List<DwC5CXSpan>(cxNumbers.Count); foreach (var cxNumber in cxNumbers) { DwC5CXSpan c5cxSpan = this.GetC5CXSpan(lastSpanDict, number, dmNames, cxNumber); c5cxSpans.Add(c5cxSpan); } return c5cxSpans; }
private List <DwC5CXSpan> GetC5CXSpanList(Dictionary <string, Dictionary <string, int> > lastSpanDict, List <DmC5CX> cxNumbers, DwNumber number, string[] dmNames) { List <DwC5CXSpan> c5cxSpans = new List <DwC5CXSpan>(cxNumbers.Count); foreach (var cxNumber in cxNumbers) { DwC5CXSpan c5cxSpan = this.GetC5CXSpan(lastSpanDict, number, dmNames, cxNumber); c5cxSpans.Add(c5cxSpan); } return(c5cxSpans); }
public static void Insert(int categoryId, string speroid, string code, string sdate) { string no = code.Replace(" ", ","); DateTime datetime = DateTime.Parse(sdate); int dateint = int.Parse(datetime.ToString("yyyyMMdd")); int p = 2000000000 + int.Parse(speroid); int n = int.Parse(speroid.Substring(speroid.Length - 2)); Category category = CategoryBiz.Instance.GetById(categoryId); DwNumberBiz biz = new DwNumberBiz(category.DbName); //select MAX(seq) seq from DwNumber where P < p; int seq = biz.DataAccessor.SelectMaxWithCondition(DwNumber.C_Seq, 10, "where P <" + p); DwNumber number = biz.Create(p, n, no, dateint, sdate); number.Seq = seq + 1; //UPDATE DwNumber set Seq=seq+ 1 where P > p; biz.Add(number); biz.DataAccessor.UpdateSeq(1, p); }
private Dictionary<string, int> GetPeroidSpanDict(Dictionary<string, Dictionary<string, int>> numberTypeLastSpanDict, string[] numberTypes, DwNumber number) { Dictionary<string, int> pSpanDict = new Dictionary<string, int>(numberTypes.Length); foreach (string numberType in numberTypes) { if (!numberTypeLastSpanDict.ContainsKey(numberType)) numberTypeLastSpanDict.Add(numberType, new Dictionary<string, int>(1000)); int spans = number.Seq - 1; string numTypeValue = number[numberType].ToString(); if (numberTypeLastSpanDict[numberType].ContainsKey(numTypeValue)) { spans = number.Seq - numberTypeLastSpanDict[numberType][numTypeValue] - 1; numberTypeLastSpanDict[numberType][numTypeValue] = number.Seq; } else { numberTypeLastSpanDict[numberType].Add(numTypeValue, number.Seq); } pSpanDict.Add(numberType, spans); } return pSpanDict; }
private Dictionary <string, int> GetSpanDict(Dictionary <string, Dictionary <string, int> > numberTypeLastSpanDict, string dmName, string[] numberTypes, DwNumber number) { if (dmName.Equals("Peroid")) { return(this.GetPeroidSpanDict(numberTypeLastSpanDict, numberTypes, number)); } Dictionary <string, int> pSpanDict = new Dictionary <string, int>(numberTypes.Length); foreach (string numberType in numberTypes) { if (!numberTypeLastSpanDict.ContainsKey(numberType)) { numberTypeLastSpanDict.Add(numberType, new Dictionary <string, int>(1000)); } int spans = number.Seq - 1; string dmValue = number[numberType].GetDmValue(1, dmName, 4); if (numberTypeLastSpanDict[numberType].ContainsKey(dmValue)) { spans = number.Seq - numberTypeLastSpanDict[numberType][dmValue] - 1; numberTypeLastSpanDict[numberType][dmValue] = number.Seq; } else { numberTypeLastSpanDict[numberType].Add(dmValue, number.Seq); } pSpanDict.Add(numberType, spans); } return(pSpanDict); }