/*private void getMonthDate() * { * string startDateMonth= (string)Session["startDate"]; * string sDate = startDateMonth.Substring(3, 2); * string sMonth = startDateMonth.Substring(0, 2); //start month in numbers.. eg 01 * * IDictionary<int, string> monthDict = new Dictionary<int, string>() * { * {1, "Jan" }, {2, "Feb" }, {3, "Mar" }, {4, "Apr" }, {5, "May" }, {6, "Jun" }, * {7, "Jul" }, {8, "Aug" }, {9, "Sep" }, {10, "Oct" }, {11, "Nov" }, {12, "Dec" } * }; * * string strMonth; //start month in string.. eg Jan * if (monthDict.TryGetValue(int.Parse(sMonth), out strMonth)) * { * lbMonth.Text = strMonth; //set <asp:label> start date * } * * string endDateMonth = (string)Session["endDate"]; * string eDate = endDateMonth.Substring(3, 2); * string eMonth = endDateMonth.Substring(0, 2); //end month in numbers.. eg 01 * * List<int> daysList = new List<int>(); * for(var i = int.Parse(sDate) + 1; i < int.Parse(eDate); i++) * { * daysList.Add(i); * } * string dayStr = String.Join(",", daysList); * * //noOfDate.Value = dayStr; //hidden field to contain dates in-between start and end date * aStartDate.InnerHtml = sDate; //set <a> start * aEndDate.InnerHtml = eDate; //set <a> end * dayStr1 = dayStr; //public var dayStr1 accessed by javascript directly * * string erMonth; //end month in string.. eg Jan * if (monthDict.TryGetValue(int.Parse(eMonth), out erMonth)) * { * //lbMonth.Text = strMonth; * } * } */ #endregion private void GetExisting() { //lbPlannerName.Text = Request.QueryString["Id"]; //rpItinerary.DataSource = itineraryList; //rpItinerary.DataBind(); //create dates in .aspx from db DayByDay getByTag = new DayByDay(); daybydayList = getByTag.RetrieveByItinerary(Id); rpDates.DataSource = daybydayList; rpDates.DataBind(); rpParentDates.DataSource = daybydayList; rpParentDates.DataBind(); //set dates with locations //GetPlanDetails(); }
protected void Page_Load(object sender, EventArgs e) { int Id = Convert.ToInt32(Request.QueryString["Id"]); //lbPlannerName.Text = Session["itineraryName"].ToString(); DayByDay getByTag = new DayByDay(); List <DayByDay> daybydayList = new List <DayByDay>(); daybydayList = getByTag.RetrieveByItinerary(Id); //rpDates.DataSource = daybydayList; //rpDates.DataBind(); List <Idk> idkList = new List <Idk>(); foreach (DayByDay dayByDay in daybydayList) { Idk oneDay = new Idk(); oneDay.dayByDayId = dayByDay.dayBydayId; oneDay.date = dayByDay.date; List <Location> locations = new List <Location>(); foreach (DayLocation day in Day.GetDayAllDayLocation(dayByDay.dayBydayId)) { Location location = new Location(); location.locaLatitude = day.locaLatitude; location.locaLongitude = day.locaLongitude; locations.Add(location); } oneDay.locations = JsonConvert.SerializeObject(locations); idkList.Add(oneDay); } rpDates.DataSource = idkList; rpDates.DataBind(); string url = HttpContext.Current.Request.Url.AbsoluteUri; try { //have to get daybydayId thru href; int daybydayId = int.Parse(Request.QueryString["daybydayId"]); daysList = DayDAO.GetAllDayLocation(daybydayId); var date = ""; var count = 0; foreach (var i in daysList) { count += 1; if (count == 1) { url += "?lat=" + count + i.locaLatitude + "?lon=" + count + i.locaLongitude; } else if (i.date.ToString() == date) { url += "?lat=" + count + i.locaLatitude + "?lon=" + count + i.locaLongitude; } else { date = i.date.ToString(); url += "?date=" + date + "?lat=" + count + i.locaLatitude + "?lon=" + count + i.locaLongitude; } } //rptLocationScript.DataSource = daysList; //rptLocationScript.DataBind(); } catch { } }