protected void btnAdd_Click(object sender, EventArgs e) { NoName.NetShop.Vote.BLL.VoteItemGroup gbll = new NoName.NetShop.Vote.BLL.VoteItemGroup(); NoName.NetShop.Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem(); NoName.NetShop.Vote.Model.VoteItemGroup gmodel = gbll.GetModel(int.Parse(lblGroupId.Text)); if (gmodel == null) { gmodel = new NoName.NetShop.Vote.Model.VoteItemGroup(); gmodel.ItemGroupId = 0; gmodel.VoteId = int.Parse(lblVoteId.Text); gmodel.Subject = txtSubject.Text.Trim(); gmodel.Content = txtContent.Text.Trim(); gbll.Save(gmodel); lblVoteId.Text = gmodel.VoteId.ToString(); lblGroupId.Text = gmodel.ItemGroupId.ToString(); } NoName.NetShop.Vote.Model.VoteItem imodel = new NoName.NetShop.Vote.Model.VoteItem(); imodel.ItemContent = String.Empty; imodel.ItemGroupId = gmodel.ItemGroupId; imodel.VoteId = gmodel.VoteId; imodel.ItemId = 0; ibll.Save(imodel); List <NoName.NetShop.Vote.Model.VoteItem> list = ibll.GetItemsOfGroup(int.Parse(lblGroupId.Text)); this.gvItems.DataSource = list; this.gvItems.DataBind(); }
protected void rpGroups_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Vote.Model.VoteItemGroup gmodel = e.Item.DataItem as Vote.Model.VoteItemGroup; Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem(); GridView gvItems = e.Item.FindControl("gvItems") as GridView; gvItems.DataSource = ibll.GetItemsOfGroup(gmodel.ItemGroupId); gvItems.DataBind(); } }
protected void rpList_ItemDataBound(object sender, RepeaterItemEventArgs e) { NetShop.Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem(); NetShop.Vote.Model.VoteItemGroup gmodel = e.Item.DataItem as NetShop.Vote.Model.VoteItemGroup; Repeater rpItem = e.Item.FindControl("rpItem") as Repeater; List<NetShop.Vote.Model.VoteItem> list = ibll.GetItemsOfGroup(gmodel.ItemGroupId); foreach (NetShop.Vote.Model.VoteItem item in list) { item.VoteTotalCount = vmodel.VoteUserNum; } rpItem.DataSource = list; rpItem.DataBind(); }
protected void rpList_ItemDataBound(object sender, RepeaterItemEventArgs e) { NetShop.Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem(); NetShop.Vote.Model.VoteItemGroup gmodel = e.Item.DataItem as NetShop.Vote.Model.VoteItemGroup; Repeater rpItem = e.Item.FindControl("rpItem") as Repeater; List <NetShop.Vote.Model.VoteItem> list = ibll.GetItemsOfGroup(gmodel.ItemGroupId); foreach (NetShop.Vote.Model.VoteItem item in list) { item.VoteTotalCount = vmodel.VoteUserNum; } rpItem.DataSource = list; rpItem.DataBind(); }
private void ShowVoteGroupInfo(int groupId, int voteId) { NoName.NetShop.Vote.BLL.VoteItemGroup gbll = new NoName.NetShop.Vote.BLL.VoteItemGroup(); NoName.NetShop.Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem(); NoName.NetShop.Vote.Model.VoteItemGroup gmodel = gbll.GetModel(groupId); if (gmodel != null) { this.txtContent.Text = gmodel.Content; this.txtSubject.Text = gmodel.Subject; this.lblGroupId.Text = gmodel.ItemGroupId.ToString(); this.lblVoteId.Text = gmodel.VoteId.ToString(); this.gvItems.DataSource = ibll.GetItemsOfGroup(groupId); this.gvItems.DataKeyNames = new string[] { "ItemId" }; this.gvItems.DataBind(); } else { this.lblVoteId.Text = voteId.ToString(); this.lblGroupId.Text = "0"; } }