Beispiel #1
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public void getdata(String strWhere)
        {
            string where = "";
            Teacher teacher     = new Teacher();
            string  currentPage = Request.QueryString["currentPage"];

            if (currentPage == null || currentPage.Length <= 0)
            {
                currentPage = "1";
            }
            if (state == "0")
            {
                where  = "";
                dsColl = colbll.Select();
                dsPro  = probll.SelectByCollegeId(Convert.ToInt32(Session["collegeId"]));
                dsPlan = plabll.getPlanByCid(Convert.ToInt32(Session["collegeId"]));
            }
            else if (state == "1")
            {
                teacher = (Teacher)Session["loginuser"];
                where   = "collegeId = '" + teacher.college.ColID + "'";
                dsPro   = probll.SelectByCollegeId(teacher.college.ColID);
                dsPlan  = plabll.getPlanByCid(teacher.college.ColID);
            }
            else if (state == "2")
            {
                teacher = (Teacher)Session["user"];
                where   = "collegeId = '" + teacher.college.ColID + "'";
                dsPro   = probll.SelectByCollegeId(teacher.college.ColID);
                dsPlan  = plabll.getPlanByCid(teacher.college.ColID);
            }
            TitleBll     titbll    = new TitleBll();
            TableBuilder tabuilder = new TableBuilder();

            tabuilder.StrTable      = "V_Title";
            tabuilder.StrWhere      = (strWhere == null || strWhere == "" ? where : strWhere);
            tabuilder.IntColType    = 0;
            tabuilder.IntOrder      = 1;
            tabuilder.IntPageNum    = int.Parse(currentPage);
            tabuilder.IntPageSize   = pagesize;
            tabuilder.StrColumn     = "titleId";
            tabuilder.StrColumnlist = "*";
            getCurrentPage          = int.Parse(currentPage);
            ds = titbll.SelectBypage(tabuilder, out count);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string op = Request.QueryString["op"];

            //获取数据
            state = Convert.ToInt32(Session["state"]);
            if (state == 1)
            {
                teacher = (Teacher)Session["loginuser"];
            }
            else if (state == 2)
            {
                teacher = (Teacher)Session["user"];
            }
            dsPlan = planBll.getPlanByCid(teacher.college.ColID);
            dsPro  = proBll.SelectByCollegeId(teacher.college.ColID);
            //展示数据
            string type = Request.QueryString["type"];

            order = Request.QueryString["order"];
            if (!IsPostBack)
            {
                if (order == "up")
                {
                    Search();
                    getdata(Search(), 0);
                }
                else
                {
                    Search();
                    getdata(Search(), 1);
                }
            }
            //导出列表
            if (op == "export")
            {
                try
                {
                    //获取成绩占比
                    Score  scoreRatio = scoreBll.getRatio();
                    double guide = scoreRatio.guideRatio, cross = scoreRatio.crossRatio, defen = scoreRatio.defenceRatio;
                    //分院id
                    int collegeId = teacher.college.ColID;
                    //专业id
                    string pro = Request.QueryString["dropstrWherepro"];
                    //批次Id
                    string batch = Request.QueryString["dropstrWhereplan"];
                    //输入框条件
                    string input    = Request.QueryString["search"];
                    string strWhere = "";

                    if (state == 2)
                    {
                        if (input == null)
                        {
                            if ((pro == null || pro == "0") && batch == null || pro == "0")
                            {
                                strWhere = string.Format(" where collegeId = {0}", collegeId);
                            }
                            else if (pro != "null" && batch == "null")
                            {
                                strWhere = string.Format(" where proId = {0} and collegeId = {1}", "'" + pro + "'", collegeId);
                            }
                            else if ((pro == "null" || pro == "0") && batch != "null")
                            {
                                strWhere = string.Format(" where planId = {0} and collegeId = {1}", "'" + batch + "'", collegeId);
                            }
                            else
                            {
                                strWhere = string.Format(" where planId = {0} and proId = {1} and collegeId = {2}", "'" + batch + "'", "'" + pro + "'", collegeId);
                            }
                        }
                        //如果不为空传 input里的值
                        else
                        {
                            strWhere = string.Format(" where (teaName {0} or title {0} or realName {0} or planName {0} or proName {0}) and collegeId = {1}", "like '%" + input + "%'", collegeId);
                        }
                    }
                    else
                    {
                        if (input == null)
                        {
                            strWhere = string.Format(" where collegeId = {0}", collegeId);
                        }
                        //如果不为空传 input里的值
                        else
                        {
                            strWhere = string.Format(" where (teaName {0} or title {0} or realName {0} or planName {0} or proName {0}) and collegeId = {1}", "like '%" + input + "%'", collegeId);
                        }
                    }

                    var       name = "学生成绩" + DateTime.Now.ToString("yyyyMMddhhmmss") + new Random(DateTime.Now.Second).Next(10000);
                    DataTable dt   = scoreBll.ExportExcel(strWhere, scoreRatio);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        var path = Server.MapPath("~/download/学生成绩导出/" + name + ".xls");
                        ExcelHelper.x2007.TableToExcelForXLSX(dt, path);
                        downloadfile(path);
                    }
                    else
                    {
                        Response.Write("<script language='javascript'>alert('查询不到数据,不能执行导出操作!')</script>");
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Error(this.GetType(), ex);
                }
            }
            if (order == "down")
            {
                //批次下拉菜单
                if (type == "plandrop")
                {
                    planId = Request.QueryString["dropstrWhereplan"].ToString();
                    if (planId == "0")
                    {
                        getdata("", 1);
                    }
                    string strWhere = string.Format(" planId = {0}", planId);
                    getdata(strWhere, 1);
                }
                //专业下拉菜单
                if (type == "prodrop")
                {
                    proId = Request.QueryString["dropstrWherepro"].ToString();
                    if (proId == "0")
                    {
                        getdata("", 1);
                    }
                    string strWhere = string.Format(" proId = {0}", proId);
                    getdata(strWhere, 1);
                }
                //所有下拉菜单
                if (type == "alldrop")
                {
                    planId = Request.QueryString["dropstrWhereplan"].ToString();
                    proId  = Request.QueryString["dropstrWherepro"].ToString();
                    string strWhere = string.Format(" proId = {0} and planId = {1}", proId, planId);
                    getdata(strWhere, 1);
                }
            }
            else if (order == "up")
            {
                //批次下拉菜单、升序
                if (type == "plandropUp")
                {
                    planId = Request.QueryString["dropstrWhereplan"].ToString();
                    if (planId == "0")
                    {
                        getdata("", 0);
                    }
                    string strWhere = string.Format(" planId = {0}", planId);
                    getdata(strWhere, 0);
                }
                //专业下拉菜单、升序
                if (type == "prodropUp")
                {
                    proId = Request.QueryString["dropstrWherepro"].ToString();
                    if (proId == "0")
                    {
                        getdata("", 0);
                    }
                    string strWhere = string.Format(" proId = {0}", proId);
                    getdata(strWhere, 0);
                }
                //所有下拉菜单、升序
                if (type == "alldropUp")
                {
                    planId = Request.QueryString["dropstrWhereplan"].ToString();
                    proId  = Request.QueryString["dropstrWherepro"].ToString();
                    string strWhere = string.Format(" proId = {0} and planId = {1}", proId, planId);
                    getdata(strWhere, 0);
                }
                //仅升序
                if (type == "up")
                {
                    getdata("", 0);
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     string op = Context.Request["op"];
     //下拉专业id
     planId = Request.QueryString["planId"];
     //下拉学院id
     collegeid = Request.QueryString["collegeId"];
     //输入框信息
     string strsearch = Request.QueryString["search"];
     teacher = (Teacher)Session["user"];
     userType = Session["state"].ToString();
     state = Convert.ToInt32(Session["state"]);
     if (state==0)
     {
         //超管
         getColl = collBll.Select();
         dsPlan = null;
         if (collegeid == null || collegeid == "0" || collegeid == "null")
         {
             //学院为空,专业为空
             dsPlan = null;
             getdata("");
         }
         else
         {
             dsPlan = planBll.getPlanByCid(int.Parse(collegeid));
             if (planId == "null" || planId == "0" || planId == null)
             {
                 //学院不为空,专业为空
                 getdata(SearchCollege());
             }
             else if (planId != null && planId != "null" && planId != "0")
             {
                 //两个都不为空
                 getdata(SearchCollAndPlan());
             }
             else if (strsearch != null)
             {
                 getdata(Search());
             }
         }
     }
     else if(state==2)
     {
         //分管
         collegeId = teacher.college.ColID;
         planId = Request.QueryString["planId"];
         dsPlan = planBll.getPlanByCid(collegeId);
         leader = Request.QueryString["leader"];
         member = Request.QueryString["member"];
         record = Request.QueryString["record"];
         _planId = Request.QueryString["planId"];
         getPlan = planBll.getPlanByCid(collegeId);
         op = Request.QueryString["op"];
         string submit = Request["submit"];
         try
         {
             if (submit == "submit")
             {
                 insert();
             }
             if (op == "" || op == null)
             {
                 getLeader = teacherBll.getLeaderByColl(collegeId, "", "");
                 getMember = teacherBll.getMemberByColl(collegeId, "", "");
                 getRecord = teacherBll.getRecordByColl(collegeId, "", "");
             }
             else
             {
                 if (op == "change1")
                 {
                     getLeader = teacherBll.getLeaderByColl(collegeId, member, record);
                     getMember = teacherBll.getMemberByColl(collegeId, leader, record);
                     getRecord = teacherBll.getRecordByColl(collegeId, leader, member);
                 }
                 else if (op == "change2")
                 {
                     getLeader = teacherBll.getLeaderByColl(collegeId, member, record);
                     getMember = teacherBll.getMemberByColl(collegeId, leader, record);
                     getRecord = teacherBll.getRecordByColl(collegeId, leader, member);
                 }
                 else if (op == "change3")
                 {
                     getLeader = teacherBll.getLeaderByColl(collegeId, member, record);
                     getMember = teacherBll.getMemberByColl(collegeId, leader, record);
                     getRecord = teacherBll.getRecordByColl(collegeId, leader, member); ;
                 }
             }
             getColl = collBll.Select();
             dsPlan = planBll.getPlanByCid(collegeId);
             if (strsearch != null)
             {
                 getdata(Search());
             }
             else if (planId != null && planId != "null")
             {
                 getdata(SearchPlan());
             }
             else
             {
                 getdata("");
             }
         }
         catch (Exception ex)
         {
             LogHelper.Error(this.GetType(), ex);
         }
     }
 }