public string[] getListOfItemsForTomorrow() { string tx = GlobalHandlers.DatabaseHandler.getFeatureValue("lunchmenu"); if (tx != null) { List<LunchDay> days = new List<LunchDay>(); tx = tx.Replace("{", ""); tx = tx.Replace("}", ""); string[] res = tx.Split(new string[] { ":::" }, StringSplitOptions.None); foreach (string stt in res) { LunchDay newDay = new LunchDay(); // if ((stt == "") || (stt == " ") || (stt == null)) // return; //ok now we should be seperated by 1,items/items/items/items/items //we need to insert into the mysql DATABASE!!! TODO // Debug.WriteLine("Stt: " + stt); string[] xxx = stt.Split(new string[] { "," }, StringSplitOptions.None); //first should date. then we can remove date and , for y: results // Response.Write("Day: " + xxx[0]); // Debug.WriteLine("Day: " + xxx[0]); newDay.Day = xxx[0]; // Response.Write(Environment.NewLine); string items = stt.Replace(xxx[0] + ",", ""); // Debug.WriteLine("Items: " + items); newDay.Items = items; days.Add(newDay); } foreach (LunchDay day in days) { string today = DateTime.Now.AddDays(1).Day.ToString(); if (day.Day == today) { List<String> str = new List<string>(); string[] list = day.Items.Split(Char.Parse("/")); // Debug.WriteLine("Found tomorrow: " + day.Day + " Items: " + day.Items); return list; } } return null; } return null; }
public string[] getListOfItemsForADay(string loadDate) { string tx = GlobalHandlers.DatabaseHandler.getFeatureValue("lunchmenu"); if (tx != null) { List<LunchDay> days = new List<LunchDay>(); tx = tx.Replace("{", ""); tx = tx.Replace("}", ""); string[] res = tx.Split(new string[] { ":::" }, StringSplitOptions.None); foreach (string stt in res) { LunchDay newDay = new LunchDay(); string[] xxx = stt.Split(new string[] { "," }, StringSplitOptions.None); newDay.Day = xxx[0]; string items = stt.Replace(xxx[0] + ",", ""); newDay.Items = items; days.Add(newDay); } foreach (LunchDay day in days) { string today = loadDate; if (day.Day == today) { List<String> str = new List<string>(); string[] list = day.Items.Split(Char.Parse("/")); return list; } } return null; } return null; }