Пример #1
0
        //初始化界面
        public void InitData()
        {
            List <FutherStudy> list = futherstudy.FindPaged(Convert.ToInt32(Session["SecrecyLevel"]));

            Grid_FurtherStudy.RecordCount = list.Count;
            page = 0;
            Grid_FurtherStudy.DataSource = list.Skip(Grid_FurtherStudy.PageIndex * Grid_FurtherStudy.PageSize).Take(Grid_FurtherStudy.PageSize);
            Grid_FurtherStudy.DataBind();
        }
Пример #2
0
        //根据人员姓名查询
        private void FindByName()
        {
            ViewState["page"]           = 2;
            Grid_FurtherStudy.PageIndex = 0;
            List <FutherStudy> list = futherstudy.FindByName(tb_content.Text.Trim(), Convert.ToInt32(Session["SecrecyLevel"]));

            Grid_FurtherStudy.RecordCount = list.Count;
            Grid_FurtherStudy.DataSource  = list.Skip(Grid_FurtherStudy.PageIndex * Grid_FurtherStudy.PageSize).Take(Grid_FurtherStudy.PageSize);
            Grid_FurtherStudy.DataBind();
            btnDelete.Enabled = false;
        }
Пример #3
0
 //根据人员姓名查询
 private void FindByName()
 {
     try{
         ViewState["page"]           = 2;
         Grid_FurtherStudy.PageIndex = 0;
         int userid = user.FindID(tb_content.Text.Trim());
         List <DFurtherStudy> list = df.FindByName(userid, Convert.ToInt32(Session["SecrecyLevel"]));
         Grid_FurtherStudy.RecordCount = list.Count;
         Grid_FurtherStudy.DataSource  = list.Skip(Grid_FurtherStudy.PageIndex * Grid_FurtherStudy.PageSize).Take(Grid_FurtherStudy.PageSize);
         Grid_FurtherStudy.DataBind();
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
Пример #4
0
        //全选按钮
        protected void btnSelect_All_Click(object sender, EventArgs e)
        {
            Grid_FurtherStudy.SelectAllRows();
            int[] select = Grid_FurtherStudy.SelectedRowIndexArray;
            int   m;
            //取整数(不是四舍五入,全舍)
            int Pages = (int)Math.Floor(Convert.ToDouble(Grid_FurtherStudy.RecordCount / this.Grid_FurtherStudy.PageSize));

            if (Grid_FurtherStudy.PageIndex == Pages)
            {
                m = (Grid_FurtherStudy.RecordCount - this.Grid_FurtherStudy.PageSize * Grid_FurtherStudy.PageIndex);
            }
            else
            {
                m = this.Grid_FurtherStudy.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 = "全    选";
            }
        }
Пример #5
0
 //按年份搜索
 public void FindByYear()
 {
     try
     {
         ViewState["page"] = 1;
         List <DFurtherStudy> list = df.FindByYear(Convert.ToInt32(dCondition.SelectedText.Trim()), Convert.ToInt32(Session["SecrecyLevel"]));
         Grid_FurtherStudy.RecordCount = list.Count();
         if (list != null)
         {
             Grid_FurtherStudy.DataSource = list.Skip(Grid_FurtherStudy.PageIndex * Grid_FurtherStudy.PageSize).Take(Grid_FurtherStudy.PageSize);
             Grid_FurtherStudy.DataBind();
         }
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
     }
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     page = ViewState["page"] == null ? 0 : (int)ViewState["page"];
     btnSelect_All.Text = "全选";
     if (!IsPostBack)
     {
         InitData();
         for (int i = 1960; i < 2060; i++)
         {
             ddl_PeopleName.Items.Add(i.ToString(), (i - 1960).ToString());
         }
         ddl_PeopleName.Items[45].Selected = true;
         btnDelete.Enabled = false;
         //删除数据
         btnDelete.OnClientClick         = Grid_FurtherStudy.GetNoSelectionAlertReference("请至少选择一项!");
         btnDelete.ConfirmText           = String.Format("你确定要删除该行数据吗?", Grid_FurtherStudy.GetSelectedCellReference());
         btnAddFutherStudy.OnClientClick = Window_addFutherStudy.GetShowReference("Add_FutherStudy.aspx", "新增进修学习信息");
     }
 }
Пример #7
0
        //导出
        protected void btn_Get_Click(object sender, EventArgs e)
        {
            try
            {
                if (page == 0)
                {
                    List <DFurtherStudy> list = df.FindPaged(Convert.ToInt32(Session["SecrecyLevel"]));
                    if (list != null)
                    {
                        Grid_FurtherStudy.DataSource = list;
                        Grid_FurtherStudy.DataBind();
                    }
                }

                if (page == 1)
                {
                    List <DFurtherStudy> list = new List <DFurtherStudy>();
                    if (dCondition.SelectedText.Trim() == "全部")
                    {
                        list = df.FindPaged(Convert.ToInt32(Session["SecrecyLevel"]));
                    }
                    else
                    {
                        list = df.FindByYear(Convert.ToInt32(dCondition.SelectedText.Trim()), Convert.ToInt32(Session["SecrecyLevel"]));
                    }
                    if (list != null)
                    {
                        Grid_FurtherStudy.DataSource = list;
                        Grid_FurtherStudy.DataBind();
                    }
                }

                pm.ExportExcel(3, Grid_FurtherStudy, 0);
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }
Пример #8
0
        //初始化
        public void InitData()
        {
            try
            {
                ViewState["page"] = 0;

                List <DFurtherStudy> list = df.FindPaged(Convert.ToInt32(Session["SecrecyLevel"]));
                Grid_FurtherStudy.RecordCount = list.Count();
                if (list != null)
                {
                    Grid_FurtherStudy.DataSource = list.Skip(Grid_FurtherStudy.PageIndex * Grid_FurtherStudy.PageSize).Take(Grid_FurtherStudy.PageSize);
                    Grid_FurtherStudy.DataBind();
                }
                else
                {
                    return;
                }
                btnDelete.Enabled = false;
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }