Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadVoteItem", PowerCheckType.Single);
         string queryString = RequestHelper.GetQueryString <string>("Action");
         this.voteID = RequestHelper.GetQueryString <int>("VoteID");
         int id = RequestHelper.GetQueryString <int>("ItemID");
         if ((queryString != string.Empty) && (id != -2147483648))
         {
             string str2 = queryString;
             if (str2 != null)
             {
                 if (!(str2 == "Up"))
                 {
                     if (str2 == "Down")
                     {
                         VoteItemBLL.ChangeVoteItemOrder(ChangeAction.Down, id);
                     }
                 }
                 else
                 {
                     VoteItemBLL.ChangeVoteItemOrder(ChangeAction.Up, id);
                 }
             }
         }
         int num2 = RequestHelper.GetQueryString <int>("ID");
         if (num2 != -2147483648)
         {
             VoteItemInfo info = VoteItemBLL.ReadVoteItem(num2);
             this.ItemName.Text = info.ItemName;
         }
         base.BindControl(VoteItemBLL.ReadVoteItemByVote(this.voteID), this.RecordList);
     }
 }
Пример #2
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);
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CheckAdminPower("ReadVoteRecord", PowerCheckType.Single);
         int voteID     = RequestHelper.GetQueryString <int>("VoteID");
         int voteItemID = RequestHelper.GetQueryString <int>("VoteItemID");
         voteItemList = VoteItemBLL.ReadVoteItemAllList();
         if (voteID > 0)
         {
             voteItemList = voteItemList.Where(k => k.VoteID.IndexOf("|" + voteID + "|") >= 0).ToList();
         }
         VoteRecordSearchInfo searchInfo = new VoteRecordSearchInfo();
         if (voteID > 0)
         {
             searchInfo.VoteID = "|" + voteID + "|";
         }
         if (voteItemID > 0)
         {
             searchInfo.ItemID = voteItemID.ToString();
         }
         List <VoteRecordInfo> recordList = VoteRecordBLL.ReadVoteRecordList(CurrentPage, PageSize, searchInfo, ref Count);
         BindControl(recordList, RecordList, MyPager);
     }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadVoteRecord", PowerCheckType.Single);
         int queryString = RequestHelper.GetQueryString <int>("VoteID");
         this.voteItemList = VoteItemBLL.ReadVoteItemByVote(queryString);
         base.BindControl(VoteRecordBLL.ReadVoteRecordList(queryString, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager);
     }
 }
Пример #5
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            CheckAdminPower("DeleteArticle", PowerCheckType.Single);
            string deleteID = RequestHelper.GetIntsForm("SelectID");

            if (!string.IsNullOrEmpty(deleteID))
            {
                VoteItemBLL.DeleteVoteItem(deleteID);
                AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("VoteItem"), deleteID);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Пример #6
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            base.CheckAdminPower("DeleteVoteItem", PowerCheckType.Single);
            string intsForm = RequestHelper.GetIntsForm("SelectID");

            if (intsForm != string.Empty)
            {
                VoteItemBLL.DeleteVoteItem(intsForm);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("VoteItem"), intsForm);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Пример #7
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);
            }
        }
Пример #8
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();
                }
            }
        }
Пример #9
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);
        }
Пример #10
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            VoteItemInfo voteItem = new VoteItemInfo();

            voteItem.ID       = RequestHelper.GetQueryString <int>("ID");
            voteItem.VoteID   = RequestHelper.GetQueryString <int>("VoteID");
            voteItem.ItemName = this.ItemName.Text;
            string message = ShopLanguage.ReadLanguage("AddOK");

            if (voteItem.ID == -2147483648)
            {
                base.CheckAdminPower("AddVoteItem", PowerCheckType.Single);
                int id = VoteItemBLL.AddVoteItem(voteItem);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("VoteItem"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateVoteItem", PowerCheckType.Single);
                VoteItemBLL.UpdateVoteItem(voteItem);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("VoteItem"), voteItem.ID);
                message = ShopLanguage.ReadLanguage("UpdateOK");
            }
            ScriptHelper.Alert(message, RequestHelper.RawUrl);
        }
Пример #11
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);
        }
Пример #12
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();
        }