Ejemplo n.º 1
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            VoteItemInfo voteItem = new VoteItemInfo();

            voteItem.ID = RequestHelper.GetQueryString <int>("ID");

            voteItem.VoteID          = VoteBLL.ReadVoteFullFatherID(Convert.ToInt32(VoteType.Text));
            voteItem.ItemName        = ItemName.Text;
            voteItem.Department      = Department.Text;
            voteItem.Image           = Photo.Text;
            voteItem.Solution        = Solution.Text;
            voteItem.Point           = Point.Text;
            voteItem.CoverDepartment = CoverDepartment.Text;
            voteItem.Detail          = Content.Value;
            voteItem.Exp1            = MobileContent.Value;//手机站内容
            voteItem.OrderID         = Convert.ToInt32(OrderID.Text);
            voteItem.Exp2            = IsShow.Text;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (voteItem.ID == int.MinValue)
            {
                CheckAdminPower("AddVoteItem", PowerCheckType.Single);
                int id = VoteItemBLL.AddVoteItem(voteItem);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("VoteItem"), id);
            }
            else
            {
                CheckAdminPower("UpdateVoteItem", PowerCheckType.Single);
                VoteItemBLL.UpdateVoteItem(voteItem);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("VoteItem"), voteItem.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
        }
Ejemplo n.º 2
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            VoteInfo vote = new VoteInfo();

            vote.ID       = RequestHelper.GetQueryString <int>("ID");
            vote.VoteType = Convert.ToInt32(this.VoteType.Text);
            vote.Title    = this.Title.Text;
            vote.Note     = this.Note.Text;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (vote.ID == -2147483648)
            {
                base.CheckAdminPower("AddVote", PowerCheckType.Single);
                int id = VoteBLL.AddVote(vote);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Vote"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateVote", PowerCheckType.Single);
                VoteBLL.UpdateVote(vote);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Vote"), vote.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            VoteInfo vote = new VoteInfo();

            vote.ID       = RequestHelper.GetQueryString <int>("ID");
            vote.FatherID = Convert.ToInt32(FatherID.Text);
            //vote.VoteType = Convert.ToInt32(VoteType.Text);
            vote.Title   = Title.Text;
            vote.Note    = Note.Text;
            vote.OrderID = Convert.ToInt32(OrderID.Text.Trim());
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (vote.ID == int.MinValue)
            {
                CheckAdminPower("AddVote", PowerCheckType.Single);
                int id = VoteBLL.AddVote(vote);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Vote"), id);
            }
            else
            {
                CheckAdminPower("UpdateVote", PowerCheckType.Single);
                VoteBLL.UpdateVote(vote);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Vote"), vote.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(alertMessage, "Vote.aspx");
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadVote", PowerCheckType.Single);
         base.BindControl(VoteBLL.ReadVoteList(base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager);
     }
 }
Ejemplo n.º 5
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            base.CheckAdminPower("DeleteVote", PowerCheckType.Single);
            string intsForm = RequestHelper.GetIntsForm("SelectID");

            if (intsForm != string.Empty)
            {
                VoteBLL.DeleteVote(intsForm);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Vote"), intsForm);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 删除按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeleteVote", PowerCheckType.Single);
            string deleteID = RequestHelper.GetIntsForm("SelectID");

            if (deleteID != string.Empty)
            {
                int[] ids = Array.ConvertAll <string, int>(deleteID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                VoteBLL.DeleteVote(ids);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Vote"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), "Vote.aspx");
            }
        }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         int queryString = RequestHelper.GetQueryString <int>("ID");
         if (queryString != -2147483648)
         {
             base.CheckAdminPower("ReadVote", PowerCheckType.Single);
             VoteInfo info = VoteBLL.ReadVote(queryString);
             this.Title.Text    = info.Title;
             this.VoteType.Text = info.VoteType.ToString();
             this.Note.Text     = info.Note;
         }
     }
 }
Ejemplo n.º 8
0
        private bool VoteSong(Vote vote)
        {
            bool retorno = false;

            vote.Votes = 1;

            Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase();

            IRepository <IVote>    dal          = new VoteRepository(db);
            IRepositoryBLL <IVote> votelRepoBll = new VoteRepositoryBLL(dal);
            IVoteBLL voteBLL = new VoteBLL(votelRepoBll);

            retorno = (voteBLL.VoteOnArtist(vote).VoteId > 0);

            return(retorno);
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadVoteItem", PowerCheckType.Single);
                foreach (VoteInfo voteInfo in VoteBLL.ReadNamedList())
                {
                    VoteID.Items.Add(new ListItem(voteInfo.Title, "|" + voteInfo.ID + "|"));
                }
                VoteID.Items.Insert(0, new ListItem("所有类别", string.Empty));
                Title.Text  = RequestHelper.GetQueryString <string>("Title");
                VoteID.Text = RequestHelper.GetQueryString <string>("VoteID");
                IsShow.Text = RequestHelper.GetQueryString <string>("IsShow");


                VoteItemSearchInfo itemSearch = new VoteItemSearchInfo();
                itemSearch.ItemName = RequestHelper.GetQueryString <string>("Title");
                itemSearch.VoteID   = !string.IsNullOrEmpty(RequestHelper.GetQueryString <string>("VoteID")) ? "|" + RequestHelper.GetQueryString <string>("VoteID") + "|" : string.Empty;
                itemSearch.Exp2     = RequestHelper.GetQueryString <string>("IsShow");

                BindControl(VoteItemBLL.ReadVoteItemList(CurrentPage, PageSize, itemSearch, ref Count, string.Empty), RecordList, MyPager);
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int      voteID = RequestHelper.GetQueryString <int>("ID");
                VoteInfo vote   = VoteBLL.ReadVote(voteID);
                FatherID.DataSource     = VoteBLL.ReadNamedList().Where(k => k.ID != voteID);
                FatherID.DataTextField  = "Title";
                FatherID.DataValueField = "ID";
                FatherID.DataBind();
                FatherID.Items.Insert(0, new ListItem("作为最大类", "0"));

                if (voteID != int.MinValue)
                {
                    CheckAdminPower("ReadVote", PowerCheckType.Single);

                    FatherID.Text = vote.FatherID.ToString();
                    Title.Text    = vote.Title;
                    OrderID.Text  = vote.OrderID.ToString();
                    Note.Text     = vote.Note;
                }
            }
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                foreach (VoteInfo voteInfo in VoteBLL.ReadNamedList())
                {
                    VoteType.Items.Add(new ListItem(voteInfo.Title, voteInfo.ID.ToString()));
                }

                int itemID = RequestHelper.GetQueryString <int>("ID");
                if (itemID != int.MinValue)
                {
                    CheckAdminPower("ReadVoteItem", PowerCheckType.Single);
                    VoteItemInfo voteItem = VoteItemBLL.ReadVoteItem(itemID);
                    ItemName.Text        = voteItem.ItemName;
                    Department.Text      = voteItem.Department;
                    Photo.Text           = voteItem.Image;
                    Solution.Text        = voteItem.Solution;
                    Point.Text           = voteItem.Point;
                    CoverDepartment.Text = voteItem.CoverDepartment;
                    Content.Value        = voteItem.Detail;
                    MobileContent.Value  = voteItem.Exp1;//手机站内容
                    //修改时允许编辑排序号
                    OrderID.Enabled = true;
                    OrderID.Text    = voteItem.OrderID.ToString();
                    VoteType.Text   = VoteBLL.GetLastClassID(voteItem.VoteID).ToString();

                    IsShow.Text = string.IsNullOrEmpty(voteItem.Exp2) ? "0" : voteItem.Exp2.Trim().ToString();
                }
                else
                {
                    //添加时不允许编辑排序号
                    OrderID.Enabled = false;
                    OrderID.Text    = (VoteItemBLL.MaxOrderID() + 1).ToString();
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            int voteID = ShopConfig.ReadConfigInfo().VoteID;

            action = RequestHelper.GetQueryString <string>("Action");
            switch (action)
            {
            case "Vote":
                Vote(voteID);
                break;

            case "View":
                break;

            case "Prepare":
                break;

            default:
                break;
            }
            vote         = VoteBLL.ReadVote(voteID);
            voteItemList = VoteItemBLL.ReadVoteItemByVote(voteID);
        }
Ejemplo n.º 13
0
        protected override void PageLoad()
        {
            base.PageLoad();
            int voteID = ShopConfig.ReadConfigInfo().VoteID;

            this.action = RequestHelper.GetQueryString <string>("Action");
            string action = this.action;

            if (action != null)
            {
                if (!(action == "Vote"))
                {
                    if ((action == "View") || (action == "Prepare"))
                    {
                    }
                }
                else
                {
                    this.Vote(voteID);
                }
            }
            this.vote         = VoteBLL.ReadVote(voteID);
            this.voteItemList = VoteItemBLL.ReadVoteItemByVote(voteID);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 投票记录导出Excel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnTOExcel_Click(object sender, EventArgs e)
        {
            int count = 0;
            List <VoteItemInfo> voteItemList = VoteItemBLL.ReadVoteItemList(1, 500, ref count, "VoteCount");
            HSSFWorkbook        book         = new HSSFWorkbook();
            ISheet sheet = book.CreateSheet("投票结果统计");

            //列宽

            sheet.SetColumnWidth(0, 20 * 256);
            sheet.SetColumnWidth(1, 20 * 256);
            sheet.SetColumnWidth(2, 20 * 256);
            sheet.SetColumnWidth(3, 20 * 256);

            // 第一行
            IRow row = sheet.CreateRow(0);

            row.Height = 400;//行高

            row.CreateCell(0).SetCellValue("姓名");

            row.CreateCell(1).SetCellValue("得票数");
            row.CreateCell(2).SetCellValue("类型");
            row.CreateCell(3).SetCellValue("奖项名称");
            row.CreateCell(4).SetCellValue("个人宣言");

            ICellStyle style1 = book.CreateCellStyle();

            //背景色
            style1.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Grey25Percent.Index;
            style1.FillPattern         = FillPattern.SolidForeground;
            //水平对齐
            style1.Alignment = HorizontalAlignment.Center;
            //垂直对齐
            style1.VerticalAlignment = VerticalAlignment.Center;
            //字体加粗
            IFont f = book.CreateFont();

            f.Boldweight = (short)FontBoldWeight.Bold;
            style1.SetFont(f);
            for (int x = 0; x <= 4; x++)
            {
                row.Cells[x].CellStyle = style1;
            }


            //循环插入数据行
            ICellStyle style2 = book.CreateCellStyle();

            style2.Alignment         = HorizontalAlignment.Center;
            style2.VerticalAlignment = VerticalAlignment.Center;



            int rowNo = 1;

            foreach (VoteItemInfo tmpItem in voteItemList)
            {
                IRow TmpRow = sheet.CreateRow(rowNo);
                TmpRow.Height = 300;//行高
                //名称
                TmpRow.CreateCell(0).SetCellType(CellType.String);
                TmpRow.CreateCell(0).SetCellValue(tmpItem.ItemName);
                TmpRow.Cells[0].CellStyle = style2;

                //票数

                TmpRow.CreateCell(1).SetCellType(CellType.Numeric);
                TmpRow.CreateCell(1).SetCellValue(tmpItem.VoteCount);
                TmpRow.Cells[1].CellStyle = style2;
                //类型
                TmpRow.CreateCell(2).SetCellValue(VoteBLL.ReadVote(VoteBLL.GetTopClassID(tmpItem.VoteID)).Title);
                TmpRow.Cells[2].CellStyle = style2;
                //奖项名称
                TmpRow.CreateCell(3).SetCellValue(tmpItem.Solution);
                TmpRow.Cells[3].CellStyle = style2;
                //个人宣言
                TmpRow.CreateCell(4).SetCellValue(tmpItem.Department);
                TmpRow.Cells[4].CellStyle = style2;

                rowNo++;
            }

            //锁定
            sheet.CreateFreezePane(0, 1, 1, 1);

            // 写入到客户端
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            book.Write(ms);
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff")));
            Response.BinaryWrite(ms.ToArray());
            book = null;
            ms.Close();
            ms.Dispose();
        }
Ejemplo n.º 15
0
 public VoteController()
 {
     this.voteBLL = new VoteBLL();
 }