Exemplo n.º 1
0
        void IniPage(string strYear, string strSemester)
        {
            List<LabMS.Model.Lab> listlab = new List<LabMS.Model.Lab>();
            LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
            try
            {
                listlab = blab.GetModelList("");
            }
            catch (Exception ex)
            {
                lbErr.Visible = true;
                lbErr.Text = ex.Message;
                return;
            }

            List<LabMS.Model.OpentProject> listopproject = new List<LabMS.Model.OpentProject>();
            LabMS.BLL.OpentProject bopproject = new LabMS.BLL.OpentProject();
            List<LabMS.Model.Teacher> listmteacher = new List<LabMS.Model.Teacher>();
            LabMS.BLL.Teacher bteacher = new LabMS.BLL.Teacher();
            List<LabMS.Model.ProjectAppointment> listprojectapp = new List<LabMS.Model.ProjectAppointment>();
            ExtendBLL.ProjectAppointment bprojectapp = new ExtendBLL.ProjectAppointment();

            string strtotalTable = "<table cellpadding='5' cellspacing='0' border='1' style='width: 100%; border-collapse: collapse;' class='infoTable'>";
            strtotalTable += "<thead>";
            strtotalTable += "<tr class='header'>";
            strtotalTable += "<th scope='col'>";
            strtotalTable += "实验室";
            strtotalTable += "</th>";
            strtotalTable += "<th scope='col'>";
            strtotalTable += "开放项目";
            strtotalTable += "</th>";
            strtotalTable += "</tr>";
            strtotalTable += "</thead>";

            strtotalTable += "<tbody>";

            foreach (LabMS.Model.Lab l in listlab)
            {
                strtotalTable += "<tr>";
                strtotalTable += "<td>";
                strtotalTable += l.Lab_Name;
                strtotalTable += "</td>";
                strtotalTable += "<td>";
                try
                {
                    listopproject = bopproject.GetModelList(" SYear=" + strYear + " and Semester = " + strSemester
                                                                            + "  and Project_Lab='" + l.Lab_Code + "' order by ID");
                }
                catch (Exception ex)
                {
                    lbErr.Visible = true;
                    lbErr.Text = ex.Message;
                    return;
                }

                if (listopproject.Count > 0)
                {
                    strtotalTable += "<table cellpadding='0' cellspacing='0' border='1' style='width: 100%; border-collapse: collapse;' class='infoTable'>";
                    strtotalTable += "<thead>";
                    strtotalTable += "<tr class='header'>";
                    strtotalTable += "<td scope='col'>";
                    strtotalTable += "实验项目";
                    strtotalTable += "</td>";
                    strtotalTable += "<td scope='col'>";
                    strtotalTable += "时间(周次)";
                    strtotalTable += "</td>";
                    strtotalTable += "<td scope='col'>";
                    strtotalTable += "指导老师";
                    strtotalTable += "</td>";
                    strtotalTable += "<td scope='col'>";
                    strtotalTable += "学生数";
                    strtotalTable += "</td>";
                    strtotalTable += "</tr>";
                    strtotalTable += "</thead>";
                    strtotalTable += "<tbody>";
                    foreach (LabMS.Model.OpentProject o in listopproject)
                    {
                        strtotalTable += "<tr>";
                        strtotalTable += "<td>";
                        strtotalTable += o.OP_ProjectName;
                        strtotalTable += "</td>";
                        strtotalTable += "<td>";
                        strtotalTable += o.Project_StartWeek.Value.ToString() + "--" + o.Project_EndWeek.Value.ToString();
                        strtotalTable += "</td>";
                        strtotalTable += "<td>";
                        try
                        {
                            listmteacher = bteacher.GetModelList(" Teacher_Code= '" + o.OP_Teacher + "'");
                        }
                        catch (Exception ex)
                        {
                            lbErr.Visible = true;
                            lbErr.Text = ex.Message;
                            return;
                        }

                        if (listmteacher.Count > 0)
                        {
                            o.OP_Teacher = listmteacher[0].Teacher_Name;
                        }
                        strtotalTable += o.OP_Teacher;
                        strtotalTable += "</td>";
                        strtotalTable += "<td>";
                        try
                        {
                            listprojectapp = bprojectapp.GetModelList(" OP_ProjectCode ='" + o.OP_ProjectCode + "'");
                        }
                        catch (Exception ex)
                        {
                            lbErr.Visible = true;
                            lbErr.Text = ex.Message;
                            return;
                        }

                        o.OP_OpenType = listprojectapp.Count.ToString();
                        strtotalTable += o.OP_OpenType;
                        strtotalTable += "</td>";
                        strtotalTable += "</tr>";
                    }
                    strtotalTable += "</tbody>";
                    strtotalTable += "</table>";
                }
                else
                {
                    strtotalTable += "无";
                }
                strtotalTable += "</td>";
                strtotalTable += "</tr>";
            }

            strtotalTable += "</tbody>";

            strtotalTable += "</table>";
            lbSituation.Text = strtotalTable;
        }
        void bind(string strwhere)
        {
            LabMS.Model.SysSetting msys = new LabMS.Model.SysSetting();
            ExtendBLL.SysSetting extendsys = new ExtendBLL.SysSetting();
            msys = extendsys.GetCurrentSetting();

            List<LabMS.Model.OpentProject> listmopproject = new List<LabMS.Model.OpentProject>();
            LabMS.BLL.OpentProject bopproject = new LabMS.BLL.OpentProject();

            if (strwhere.Equals(""))
            {
                strwhere += " 1=1 ";
            }

            strwhere += " and  SYear = " + msys.CurrentYear + " and Semester = " + msys.CurrentSemester;

            if (UserType == "teacher")
            {
                strwhere += " and  OP_Teacher = '" + UserCode + "'";
            }

            listmopproject = bopproject.GetModelList(strwhere + " order by ID desc ");

            foreach (LabMS.Model.OpentProject op in listmopproject)
            {
                List<LabMS.Model.Teacher> listmteacher = new List<LabMS.Model.Teacher>();
                LabMS.BLL.Teacher bteacher = new LabMS.BLL.Teacher();
                listmteacher = bteacher.GetModelList(" Teacher_Code= '" + op.OP_Teacher + "'");
                if (listmteacher.Count > 0)
                {
                    op.OP_Teacher = listmteacher[0].Teacher_Name;
                }

                LabMS.BLL.Lab blab = new LabMS.BLL.Lab();
                List<LabMS.Model.Lab> mLab = new List<LabMS.Model.Lab>();
                mLab = blab.GetModelList(" Lab_Code='"+ op.Project_Lab +"'");
                if (mLab.Count > 0)
                {
                    op.Project_Lab = mLab[0].Lab_Name;
                }
                ExtendBLL.Dictionary eDictionary = new ExtendBLL.Dictionary();
                List<Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>();
                listCClass = eDictionary.GetModelList("DClass = 'shiyanyaoqiu' and Code = '"+op.Project_Require+"'");
                if (listCClass.Count > 0)
                {
                    op.Project_Require = listCClass[0].Name;
                }
                op.OP_Phone = op.Project_StartWeek.ToString()+"--"+op.Project_EndWeek.ToString();
                List<LabMS.Model.ProjectAppointment>listprojectapp = new List<LabMS.Model.ProjectAppointment>();
                ExtendBLL.ProjectAppointment bprojectapp = new ExtendBLL.ProjectAppointment();
                listprojectapp = bprojectapp.GetModelList(" OP_ProjectCode ='"+op.OP_ProjectCode+"'");
                op.OP_OpenType = listprojectapp.Count.ToString();
                listCClass = eDictionary.GetModelList("DClass = 'shiyanleixing' and Code = '" + op.Project_Type + "'");
                if (listCClass.Count > 0)
                {
                    op.Project_Type = listCClass[0].Name;
                }
                if (op.OP_Audit == "0")
                {

                }
                op.OP_Audit = LabMS.Common.Status.GetOpenProjectStatus(op.OP_Audit);

            }

            gv_OpenProjectList.DataSource = listmopproject;
            gv_OpenProjectList.DataBind();
        }