Exemplo n.º 1
0
 //单位讲学信息绑定
 public void BindData()
 {
     try
     {
         ViewState["page"] = 0;
         List <Common.Entities.UnitLectures> list = BLLUL.FindPaged(Convert.ToInt32(Session["SecrecyLevel"]));
         var res = list.Skip(Grid_Lectures.PageIndex * Grid_Lectures.PageSize).Take(Grid_Lectures.PageSize).ToList();
         Grid_Lectures.RecordCount = list.Count();
         Grid_Lectures.DataSource  = res;
         Grid_Lectures.DataBind();
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         publicMethod.SaveError(ex, this.Request);
     }
 }
Exemplo n.º 2
0
        //全选按钮
        protected void btnSelect_All_Click(object sender, EventArgs e)
        {
            Grid_Lectures.SelectAllRows();
            int[] select = Grid_Lectures.SelectedRowIndexArray;
            int   m;
            //取整数(不是四舍五入,全舍)
            int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Lectures.RecordCount / this.Grid_Lectures.PageSize));

            if (Grid_Lectures.PageIndex == Pages)
            {
                m = (Grid_Lectures.RecordCount - this.Grid_Lectures.PageSize * Grid_Lectures.PageIndex);
            }
            else
            {
                m = this.Grid_Lectures.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 = "全选";
            }
        }
Exemplo n.º 3
0
 public void FindByAgency()
 {
     try
     {
         ViewState["page"]       = 1;
         Grid_Lectures.PageIndex = 0;
         //根据所属机构查询
         //string AgencyName = DropDownList_Agency.SelectedText;
         int agencyID = BLLAgency.SelectAgencyID(DropDownList_Agency.SelectedText);
         List <Common.Entities.UnitLectures> list = BLLUL.FindLectures(agencyID, Convert.ToInt32(Session["SecrecyLevel"]));
         var res = list.Skip(Grid_Lectures.PageIndex * Grid_Lectures.PageSize).Take(Grid_Lectures.PageSize).ToList();
         Grid_Lectures.RecordCount = list.Count();
         Grid_Lectures.DataSource  = res;
         Grid_Lectures.DataBind();
         btnDelete.Enabled = false;
     }
     catch (Exception ex)
     {
         publicMethod.SaveError(ex, this.Request);
     }
 }