protected void Page_Load(object sender, EventArgs e) { using (TravelDAL.TravelDBEntities context = new TravelDAL.TravelDBEntities()) { TravelDAL.Tour tour = (from item in context.Tour where item.SpecialOfferFlag == true select item).First(); #region Main specialid = tour.IDTour; Image.ImageUrl = "flash/images/" + tour.IDTour.ToString() + "/logo.jpg"; Info.Text = tour.SpecialOfferInfo.ToString(); MinPrice.Text = "$" + tour.MinimalPrice.ToString(); AvgPrice.Text = "$" + tour.AveragePrice.ToString(); siButton.PostBackUrl = "TourPage.aspx?id=" + specialid.ToString(); #endregion #region Rating var list = (from item in context.Tour orderby item.AverageMark descending select new { ID = item.IDTour }).Take(4); int i = 0; foreach (var id in list) { brview[i] = new BriefView(id.ID, false); i++; } first.Controls.Add(brview[0]); second.Controls.Add(brview[1]); third.Controls.Add(brview[2]); fourth.Controls.Add(brview[3]); #endregion #region Statistics #endregion } }
protected void Page_Load(object sender, EventArgs e) { CurrentTours = new List<int>(); Search.Refresh += new SearchParams.ListHandler(Search_Refresh); if (!IsPostBack) { if(Session["srequest"] != null && this.PreviousPage != null) { if(Session["srequest"].ToString() == "true") { string s = ((this.PreviousPage.FindControl("mainsearch") as SearchMainWeb).FindControl("searchbox") as TextBox).Text; CurrentTours = WorkWithDB.AnalyseSearchRequest(s); } } else { using (var context = new TravelDBEntities()) { var list = from item in context.Tour select new { ID = item.IDTour }; foreach (var a in list) { CurrentTours.Add(a.ID); } } Search.CurrentTours = this.CurrentTours; } } TravelDAL.Tour obj= new TravelDAL.Tour(); using (var context = new TravelDBEntities()) { foreach (int id in CurrentTours) { EntityKey k = new EntityKey("TravelDBEntities.Tour", "IDTour", id); obj = (TravelDAL.Tour)context.GetObjectByKey(k); if (obj != null) { BriefView brt = new BriefView(id, true); brt.BorderColor = System.Drawing.Color.Aquamarine; Panel.Controls.Add(brt); } } } }
protected void Page_Load(object sender, EventArgs e) { TravelDAL.Tour obj = new TravelDAL.Tour(); TravelDAL.Tour simt = new TravelDAL.Tour(); int id = Int32.Parse(Request.QueryString["id"]); //rateobj.IDToRate = id; int i = 0; using (var context = new TravelDBEntities()) { EntityKey key = new EntityKey("TravelDBEntities.Tour", "IDTour", id); obj = (TravelDAL.Tour)context.GetObjectByKey(key); Label1.Text = obj.Program; Label2.Text = obj.AdditionalInfo; Label3.Text = obj.Price; if (obj.SimilarTours.Length < 2) { Label ll = new Label(); ll.Text = "К сожалению, туров, похожих на этот, нет."; PanelForSimilar.Controls.Add(ll); } else { int[] mas = WorkWithDB.SearchNumbersInString(obj.SimilarTours); foreach(int m in mas) { EntityKey k = new EntityKey("TravelDBEntities.Tour", "IDTour", m); simt = (TravelDAL.Tour)context.GetObjectByKey(k); if (simt != null) { i++; BriefView brt = new BriefView(m, true); PanelForSimilar.Controls.Add(brt); } if (i == 2) break; } } //obj.SimilarTours } }