void AddNewMonthlyHistroy() { int MonthDifference = (Mathf.FloorToInt(TimeManagerCall.TimeValue / TimeManagerCall.Month) + 1) - HistoryList.Count; for (int i = 0; i < MonthDifference; i++) { MonthlyHistory newHistory = new MonthlyHistory(HistoryList.Count * TimeManagerCall.Month); HistoryList.Add(newHistory); } CurrentHistoryIndex = HistoryList.Count - 1; HistoryList[CurrentHistoryIndex].Balance = Balance; }
public string LoadSKUHistory(string sSKU, DateTime dtStart, DateTime dtEnd, string sSource, string sType, string sView, string sDWUpdate, long dADU, string sSessionID) { //don't allow iOS 6 (or any browsers) to cache responses System.Web.HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (!ValidateSession(sSessionID)) { return(sInvalidSession); } //Ensure our view string matches the case of the values we use to compare sView = sView.ToLower(); //don't allow iOS 6 (or any browsers) to cache responses System.Web.HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); //Setup our view type objects List <WeeklyHistory> oWeeklyDataRows = new List <WeeklyHistory>(); WeeklyHistory oWeeklyData = null; List <MonthlyHistory> oMonthlyDataRows = new List <MonthlyHistory>(); MonthlyHistory oMonthlyData = null; using (SqlConnection oCN = new SqlConnection(ConfigurationManager.ConnectionStrings["CN_MAS_RDP"].ConnectionString)) { oCN.Open(); using (SqlCommand oCMD = new SqlCommand("", oCN)) { oCMD.CommandText = "EXEC prc_SKUP2 @dtStart, @dtEnd, @sSKU, @sSource, @sType, @sView, @sDWUpdate, @dADU"; oCMD.Parameters.Add("@sSKU", sSKU); oCMD.Parameters.Add("@dtStart", Convert.ToDateTime(dtStart)); oCMD.Parameters.Add("@dtEnd", Convert.ToDateTime(dtEnd)); oCMD.Parameters.Add("@sSource", sSource); oCMD.Parameters.Add("@sType", sType); oCMD.Parameters.Add("@sView", sView); oCMD.Parameters.Add("@sDWUpdate", sDWUpdate); oCMD.Parameters.Add("@dADU", dADU); using (SqlDataReader oDR = oCMD.ExecuteReader()) { while (oDR.Read()) { //Add the data to the list for the specified view type if (sView == "weekly") { oWeeklyData = new WeeklyHistory(); oWeeklyData.sData = oDR["sValName"].ToString(); oWeeklyData.s1 = oDR["1"].ToString(); oWeeklyData.s2 = oDR["2"].ToString(); oWeeklyData.s3 = oDR["3"].ToString(); oWeeklyData.s4 = oDR["4"].ToString(); oWeeklyData.s5 = oDR["5"].ToString(); oWeeklyData.s6 = oDR["6"].ToString(); oWeeklyData.s7 = oDR["7"].ToString(); oWeeklyData.s8 = oDR["8"].ToString(); oWeeklyData.s9 = oDR["9"].ToString(); oWeeklyData.s10 = oDR["10"].ToString(); oWeeklyData.s11 = oDR["11"].ToString(); oWeeklyData.s12 = oDR["12"].ToString(); oWeeklyData.s13 = oDR["13"].ToString(); oWeeklyData.s14 = oDR["14"].ToString(); oWeeklyData.s15 = oDR["15"].ToString(); oWeeklyData.s16 = oDR["16"].ToString(); oWeeklyData.s17 = oDR["17"].ToString(); oWeeklyData.s18 = oDR["18"].ToString(); oWeeklyData.s19 = oDR["19"].ToString(); oWeeklyData.s20 = oDR["20"].ToString(); oWeeklyData.s21 = oDR["21"].ToString(); oWeeklyData.s22 = oDR["22"].ToString(); oWeeklyData.s23 = oDR["23"].ToString(); oWeeklyData.s24 = oDR["24"].ToString(); oWeeklyData.s25 = oDR["25"].ToString(); oWeeklyData.s26 = oDR["26"].ToString(); oWeeklyData.s27 = oDR["27"].ToString(); oWeeklyData.s28 = oDR["28"].ToString(); oWeeklyData.s29 = oDR["29"].ToString(); oWeeklyData.s30 = oDR["30"].ToString(); oWeeklyData.s31 = oDR["31"].ToString(); oWeeklyData.s32 = oDR["32"].ToString(); oWeeklyData.s33 = oDR["33"].ToString(); oWeeklyData.s34 = oDR["34"].ToString(); oWeeklyData.s35 = oDR["35"].ToString(); oWeeklyData.s36 = oDR["36"].ToString(); oWeeklyData.s37 = oDR["37"].ToString(); oWeeklyData.s38 = oDR["38"].ToString(); oWeeklyData.s39 = oDR["39"].ToString(); oWeeklyData.s40 = oDR["40"].ToString(); oWeeklyData.s41 = oDR["41"].ToString(); oWeeklyData.s42 = oDR["42"].ToString(); oWeeklyData.s43 = oDR["43"].ToString(); oWeeklyData.s44 = oDR["44"].ToString(); oWeeklyData.s45 = oDR["45"].ToString(); oWeeklyData.s46 = oDR["46"].ToString(); oWeeklyData.s47 = oDR["47"].ToString(); oWeeklyData.s48 = oDR["48"].ToString(); oWeeklyData.s49 = oDR["49"].ToString(); oWeeklyData.s50 = oDR["50"].ToString(); oWeeklyData.s51 = oDR["51"].ToString(); oWeeklyData.s52 = oDR["52"].ToString(); oWeeklyData.s53 = oDR["53"].ToString(); oWeeklyDataRows.Add(oWeeklyData); } else { oMonthlyData = new MonthlyHistory(); oMonthlyData.sData = oDR["sValName"].ToString(); oMonthlyData.s1 = oDR["1"].ToString(); oMonthlyData.s2 = oDR["2"].ToString(); oMonthlyData.s3 = oDR["3"].ToString(); oMonthlyData.s4 = oDR["4"].ToString(); oMonthlyData.s5 = oDR["5"].ToString(); oMonthlyData.s6 = oDR["6"].ToString(); oMonthlyData.s7 = oDR["7"].ToString(); oMonthlyData.s8 = oDR["8"].ToString(); oMonthlyData.s9 = oDR["9"].ToString(); oMonthlyData.s10 = oDR["10"].ToString(); oMonthlyData.s11 = oDR["11"].ToString(); oMonthlyData.s12 = oDR["12"].ToString(); oMonthlyDataRows.Add(oMonthlyData); } } } } } //Return the requested data view object if (sView == "weekly") { return(new JavaScriptSerializer().Serialize(oWeeklyDataRows)); } else { return(new JavaScriptSerializer().Serialize(oMonthlyDataRows)); } }