protected void Page_Load(object sender, EventArgs e) { GoodsPreviewLastAdded.repeater.ItemCommand += new RepeaterCommandEventHandler(LastAddedNext_ItemCommand); GoodsPreviewDiscount.repeater.ItemCommand += new RepeaterCommandEventHandler(DiscountNext_ItemCommand); GoodsPreviewMostSold.repeater.ItemCommand += new RepeaterCommandEventHandler(MostSoldNext_ItemCommand); //if (Cache["LastAdded"] != null) //{ // GoodsPreviewLastAdded.DataSource = (IList<DataSourceAdapter>)Cache["LastAdded"]; //} //else //{ // GoodsActions goodsActions = new GoodsActions(); // IList<Goods> listGoods = goodsActions.LastAddedGoods(0, 10); // DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding(); // GoodsPreviewLastAdded.DataSource = dataSourceAdapterBinding.AdapterFill(listGoods); // Cache.Insert("LastAdded", GoodsPreviewLastAdded.DataSource, null, // DateTime.Now.AddMinutes(60), TimeSpan.Zero); //} if (!Page.IsPostBack) { GoodsActions goodsActions = new GoodsActions(); IList <Goods> listGoods = goodsActions.LastAddedGoods(0, 10); DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding(); GoodsPreviewLastAdded.DataSource = dataSourceAdapterBinding.AdapterFill(listGoods); ViewState["LastAdded"] = GoodsPreviewLastAdded.DataSource; listGoods.Clear(); listGoods = goodsActions.HaveDiscountGoods(0, 10); GoodsPreviewDiscount.DataSource = dataSourceAdapterBinding.AdapterFill(listGoods); ViewState["Discount"] = GoodsPreviewDiscount.DataSource; listGoods.Clear(); listGoods = goodsActions.GetGoodsMostSold(); GoodsPreviewMostSold.DataSource = dataSourceAdapterBinding.AdapterFill(listGoods); ViewState["MostSold"] = GoodsPreviewMostSold.DataSource; } else { if (ViewState["LastAdded"] != null) { GoodsPreviewLastAdded.DataSource = (IList <DataSourceAdapter>)ViewState["LastAdded"]; } if (ViewState["Discount"] != null) { GoodsPreviewDiscount.DataSource = (IList <DataSourceAdapter>)ViewState["Discount"]; } if (ViewState["MostSold"] != null) { GoodsPreviewMostSold.DataSource = (IList <DataSourceAdapter>)ViewState["MostSold"]; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["selectedID"] != null) { int selectedID = (int)Session["selectedID"]; goods = new Goods(); GoodsActions goodsActions = new GoodsActions(); goods = goodsActions.FindSelectedGoods(selectedID); DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding(); GoodsPreview1.DataSource = dataSourceAdapterBinding.AdapterFill(goods); } }
protected void Page_Init(object sender, EventArgs e) { if (Session["SelectedGoodsID"] != null) { selectedGoodsID = int.Parse(Session["SelectedGoodsID"].ToString()); GoodsEditControl1.GoodsID = selectedGoodsID; GoodsActions goodsActions = new GoodsActions(); var goods = goodsActions.FindSelectedGoods(selectedGoodsID); DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding(); GoodsPreviewControl1.DataSource = dataSourceAdapterBinding.AdapterFill(goods); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ProfileControl1.TableRow_Pay.Visible = true; ProfileControl1.Button_Save.Text = "To order"; ProfileControl1.TableRow_Language.Visible = false; var userInfo = new UserInfo(); ProfileActions profileActions = new ProfileActions(); UsersActions usersActions = new UsersActions(); userID = usersActions.FindUserGuid(User.Identity.Name); userInfo = profileActions.GetUserInfo(userID); ProfileControl1.DataSource = userInfo; } ProfileControl1.Button_Save.Click += new EventHandler(Button_Save_Click); if (Session["OrderList"] != null) { Label1.Visible = false; List <Goods> orderList = new List <Goods>(); orderList = (List <Goods>)Session["OrderList"]; if (Roles.IsUserInRole(User.Identity.Name, premiumUser)) { discount = 10; } else { if (Roles.IsUserInRole(User.Identity.Name, registerUser)) { discount = 5; } else { discount = 0; } } DataSourceAdapterBinding dataSourceAdapterBinding = new DataSourceAdapterBinding(); OrderPreview1.DataSource = dataSourceAdapterBinding .AdapterFillPriceCalculate(orderList, discount); } else { Label1.Visible = true; } }