Esempio n. 1
0
 //导出
 protected void btn_Get_Click(object sender, EventArgs e)
 {
     try
     {
         if (page == 0)
         {
             List <Common.Entities.AchieveAward> list = award.FindPaged(Convert.ToInt32(Session["secrecyLevel"]));
             if (list != null)
             {
                 Grid_AchieveAward.DataSource = list;
                 Grid_AchieveAward.DataBind();
             }
         }
         else if (page == 1)
         {
             List <Common.Entities.AchieveAward> list = award.FindByNameAndGrade(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"]));
             if (list != null)
             {
                 Grid_AchieveAward.DataSource = list;
                 Grid_AchieveAward.DataBind();
             }
         }
         else if (page == 2)
         {
             List <Common.Entities.AchieveAward> list = award.FindByAwardUnit(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"]));
             if (list != null)
             {
                 Grid_AchieveAward.DataSource = list;
                 Grid_AchieveAward.DataBind();
             }
         }
         else if (page == 3)
         {
             List <Common.Entities.AchieveAward> list = award.FindByMember(tAchieveName.Text.Trim(), Convert.ToInt32(Session["secrecyLevel"]));
             if (list != null)
             {
                 Grid_AchieveAward.DataSource = list;
                 Grid_AchieveAward.DataBind();
             }
         }
         else if (page == 4)
         {
             List <Common.Entities.AchieveAward> list = award.FindBySecrecyLevel(secrecyLevel.SelectedIndex + 1, Convert.ToInt32(Session["secrecyLevel"]));
             if (list != null)
             {
                 Grid_AchieveAward.DataSource = list;
                 Grid_AchieveAward.DataBind();
             }
         }
         else
         {
             return;
         }
         pm.ExportExcel(3, Grid_AchieveAward, 1);
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
Esempio n. 2
0
        //全选按钮
        protected void btnSelect_All_Click(object sender, EventArgs e)
        {
            Grid_AchieveAward.SelectAllRows();
            int[] select = Grid_AchieveAward.SelectedRowIndexArray;
            int   m;
            //取整数(不是四舍五入,全舍)
            int Pages = (int)Math.Floor(Convert.ToDouble(Grid_AchieveAward.RecordCount / this.Grid_AchieveAward.PageSize));

            if (Grid_AchieveAward.PageIndex == Pages)
            {
                m = (Grid_AchieveAward.RecordCount - this.Grid_AchieveAward.PageSize * Grid_AchieveAward.PageIndex);
            }
            else
            {
                m = this.Grid_AchieveAward.PageSize;
            }
            bool isCheck = false;

            for (int i = 0; i < m; i++)
            {
                if (CBoxSelect.GetCheckedState(i) == false)
                {
                    isCheck = true;
                }
            }
            if (isCheck)
            {
                foreach (int item in select)
                {
                    CBoxSelect.SetCheckedState(item, true);
                }
                btnDelete.Enabled  = true;
                btnSelect_All.Text = "取消全选";
            }
            else
            {
                foreach (int item in select)
                {
                    CBoxSelect.SetCheckedState(item, false);
                }
                btnDelete.Enabled  = false;
                btnSelect_All.Text = "全选";
            }
        }
Esempio n. 3
0
 //初始化界面
 public void InitData()
 {
     try
     {
         ViewState["page"] = 0;
         List <Common.Entities.AchieveAward> list = award.FindPaged(Convert.ToInt32(Session["secrecyLevel"]));
         Grid_AchieveAward.RecordCount = list.Count();
         if (list != null)
         {
             Grid_AchieveAward.DataSource = list.Skip(Grid_AchieveAward.PageIndex * Grid_AchieveAward.PageSize).Take(Grid_AchieveAward.PageSize);
             Grid_AchieveAward.DataBind();
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }