private void ShowVote(int voteId)
        {
            NetShop.Vote.BLL.VoteTopic vbll = new NoName.NetShop.Vote.BLL.VoteTopic();
            vmodel = vbll.GetModel(voteId);
            this.litContent.Text = vmodel.Remark;
            this.litTitle.Text = vmodel.Topic;

            NetShop.Vote.BLL.VoteItemGroup gbll = new NoName.NetShop.Vote.BLL.VoteItemGroup();

            rpList.DataSource = gbll.GetModelList(voteId);
            rpList.DataBind();
        }
Ejemplo n.º 2
0
        private void ShowVote(int voteId)
        {
            NetShop.Vote.BLL.VoteTopic vbll = new NoName.NetShop.Vote.BLL.VoteTopic();
            vmodel = vbll.GetModel(voteId);
            this.litContent.Text = vmodel.Remark;
            this.litTitle.Text   = vmodel.Topic;

            NetShop.Vote.BLL.VoteItemGroup gbll = new NoName.NetShop.Vote.BLL.VoteItemGroup();

            rpList.DataSource = gbll.GetModelList(voteId);
            rpList.DataBind();
        }
Ejemplo n.º 3
0
 private void ShowInfo(int voteId)
 {
     Vote.BLL.VoteTopic     vbll   = new NoName.NetShop.Vote.BLL.VoteTopic();
     Vote.BLL.VoteItemGroup gbll   = new NoName.NetShop.Vote.BLL.VoteItemGroup();
     Vote.BLL.VoteItem      ibll   = new NoName.NetShop.Vote.BLL.VoteItem();
     Vote.Model.VoteTopic   vmodel = vbll.GetModel(voteId);
     if (vmodel != null)
     {
         this.lblEndDate.Text      = vmodel.EndTime == null ? "" : (vmodel.EndTime ?? DateTime.MaxValue).ToShortDateString();
         this.lblStartDate.Text    = vmodel.StartTime == null ? "" : (vmodel.StartTime ?? DateTime.MaxValue).ToShortDateString();
         this.chkIsMulti.Checked   = vmodel.IsMulti;
         this.chkIsRegUser.Checked = vmodel.IsRegUser;
         this.chkStatus.Checked    = vmodel.Status;
         this.lblRemark.Text       = vmodel.Remark;
         this.lblTopic.Text        = vmodel.Topic;
         this.lblVoteId.Text       = vmodel.VoteId.ToString();
         this.lblVoteUserNum.Text  = vmodel.VoteUserNum.ToString();
     }
     rpGroups.DataSource = gbll.GetModelList(voteId);
     rpGroups.DataBind();
 }
 private void ShowInfo(int voteId)
 {
     Vote.BLL.VoteTopic vbll = new NoName.NetShop.Vote.BLL.VoteTopic();
     Vote.BLL.VoteItemGroup gbll = new NoName.NetShop.Vote.BLL.VoteItemGroup();
     Vote.BLL.VoteItem ibll = new NoName.NetShop.Vote.BLL.VoteItem();
     Vote.Model.VoteTopic vmodel = vbll.GetModel(voteId);
     if (vmodel != null)
     {
         this.lblEndDate.Text = vmodel.EndTime == null ? "" : (vmodel.EndTime ?? DateTime.MaxValue).ToShortDateString();
         this.lblStartDate.Text = vmodel.StartTime == null ? "" : (vmodel.StartTime ?? DateTime.MaxValue).ToShortDateString();
         this.chkIsMulti.Checked = vmodel.IsMulti;
         this.chkIsRegUser.Checked = vmodel.IsRegUser;
         this.chkStatus.Checked = vmodel.Status;
         this.lblRemark.Text = vmodel.Remark;
         this.lblTopic.Text = vmodel.Topic;
         this.lblVoteId.Text = vmodel.VoteId.ToString();
         this.lblVoteUserNum.Text = vmodel.VoteUserNum.ToString();
     }
     rpGroups.DataSource = gbll.GetModelList(voteId);
     rpGroups.DataBind();
 }
        private string GetVoteInfo(HttpContext context)
        {
            NameValueCollection nv = GetParas(context);
            int voiteId            = int.Parse(nv["voteid"]);

            Vote.BLL.VoteTopic     vtbll = new NoName.NetShop.Vote.BLL.VoteTopic();
            Vote.BLL.VoteItemGroup vgbll = new NoName.NetShop.Vote.BLL.VoteItemGroup();
            Vote.BLL.VoteItem      vibll = new NoName.NetShop.Vote.BLL.VoteItem();

            StringBuilder sb = new StringBuilder(200);
            JsonWriter    jw = new JsonWriter(new StringWriter(sb));

            Vote.Model.VoteTopic            vtmodel  = vtbll.GetModel(voiteId);
            List <Vote.Model.VoteItemGroup> vgmodels = vgbll.GetModelList(voiteId);
            List <Vote.Model.VoteItem>      vimodels = vibll.GetItemsOfVote(voiteId);

            if (vtmodel != null && vtmodel.StartTime < DateTime.Now && vtmodel.EndTime > DateTime.Now &&
                vtmodel.Status == true)
            {
                jw.WriteStartObject();
                jw.WritePropertyName("voteid");
                jw.WriteValue(vtmodel.VoteId);
                jw.WritePropertyName("topic");
                jw.WriteValue(vtmodel.Topic);
                jw.WritePropertyName("votenum");
                jw.WriteValue(vtmodel.VoteUserNum);
                jw.WritePropertyName("ismulti");
                jw.WriteValue(vtmodel.IsMulti);
                jw.WritePropertyName("groupcount");
                jw.WriteValue(vgmodels.Count);
                if (vgmodels.Count > 0)
                {
                    jw.WritePropertyName("groups");
                    jw.WriteStartArray();
                    foreach (Vote.Model.VoteItemGroup vgmodel in vgmodels)
                    {
                        jw.WriteStartObject();
                        jw.WritePropertyName("subject");
                        jw.WriteValue(vgmodel.Subject);
                        jw.WritePropertyName("groupid");
                        jw.WriteValue(vgmodel.ItemGroupId);
                        jw.WritePropertyName("items");
                        jw.WriteStartArray();
                        foreach (Vote.Model.VoteItem vitem in vimodels.Where(s => s.ItemGroupId == vgmodel.ItemGroupId))
                        {
                            jw.WriteStartObject();
                            jw.WritePropertyName("itemid");
                            jw.WriteValue(vitem.ItemId);
                            jw.WritePropertyName("subject");
                            jw.WriteValue(vitem.ItemContent);
                            jw.WritePropertyName("count");
                            jw.WriteValue(vitem.VoteCount);
                            jw.WritePropertyName("percent");
                            jw.WriteValue(vitem.Percent);
                            jw.WriteEndObject();
                        }

                        jw.WriteEndArray();

                        jw.WriteEndObject();
                    }
                    jw.WriteEndArray();
                }
                jw.WriteEndObject();
                jw.Close();
            }
            return(sb.ToString());
        }