Exemplo n.º 1
0
        public bool GetAllAdmin(Admin admin)
        {
            bool         flag     = false;
            string       pwd      = string.Empty;
            string       sql      = "select * from Admin where LoginID=@LoginID";
            SqlParameter parament = new SqlParameter("@LoginID", admin.LoginID);

            try
            {
                using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parament))
                {
                    while (sdr.Read())
                    {
                        pwd = sdr["LoginPwd"].ToString();
                    }
                }
                if (pwd == admin.LoginPwd)
                {
                    flag = true;
                }
            }
            catch (Exception)
            {
                //throw;
            }
            return(flag);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 描述:获取所有学生信息
        /// </summary>
        /// <returns></returns>
        public IList <StudentExpense> GetAllStudentExpense()
        {
            IList <StudentExpense> liststudnetExpense = new List <StudentExpense>();
            string sql = "SELECT  CollegeInfo.CollegeName, MajorInfo.MajorName, StudentClass.ClassName, StudentInfo.StudentName, StudentInfo.StudentNumber, StudentInfo.StudentSex, SchoolTerm.TermName, PlanBook.BookName, PlanBook.ISBN, PlanBook.Author, PlanBook.Publish, PlanBook.Price, BookStock.Discount, BookStock.NetPrice, GrantBook.GetBookNum FROM  BookStock INNER JOIN SchoolTerm INNER JOIN GrantBook INNER JOIN StudentInfo INNER JOIN CollegeInfo INNER JOIN StudentClass ON CollegeInfo.CollegeID = StudentClass.CollegeID INNER JOIN  MajorInfo ON StudentClass.MajorInfoID = MajorInfo.MajorInfoID ON StudentInfo.StudentClassID = StudentClass.StudentClassID ON  GrantBook.StudentInfoID = StudentInfo.StudentInfoID ON SchoolTerm.SchoolTermID = GrantBook.SchoolTermID INNER JOIN PlanBook ON GrantBook.PlanBookID = PlanBook.PlanBookID ON BookStock.PlanBookID = PlanBook.PlanBookID";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    StudentExpense studentExpense = new StudentExpense();
                    studentExpense.ClassName     = sdr["ClassName"].ToString();
                    studentExpense.CollegeName   = sdr["CollegeName"].ToString();
                    studentExpense.MajorName     = sdr["MajorName"].ToString();
                    studentExpense.StudentName   = sdr["StudentName"].ToString();
                    studentExpense.StudentNumber = sdr["StudentNumber"].ToString();
                    studentExpense.StudentSex    = sdr["StudentSex"].ToString();
                    studentExpense.GetBookNum    = Convert.ToInt32(sdr["GetBookNum"]);
                    studentExpense.BookName      = sdr["BookName"].ToString();
                    studentExpense.Author        = sdr["Author"].ToString();
                    studentExpense.Publish       = sdr["Publish"].ToString();
                    studentExpense.Price         = float.Parse(sdr["Price"].ToString());
                    studentExpense.TermName      = sdr["TermName"].ToString();
                    studentExpense.Discount      = float.Parse(sdr["Discount"].ToString());
                    studentExpense.ISBN          = sdr["ISBN"].ToString();
                    studentExpense.NetPrice      = float.Parse(sdr["NetPrice"].ToString());
                    liststudnetExpense.Add(studentExpense);
                }
            }
            return(liststudnetExpense);
        }
Exemplo n.º 3
0
        public List <StudentInfoBusiness> GetAllStudentInfo(string Guanjianzi, string txt)
        {
            List <StudentInfoBusiness> list = new List <StudentInfoBusiness>();
            StringBuilder sql = new StringBuilder("SELECT CollegeInfo.CollegeName, MajorInfo.MajorSimple, GradeInfo.GradeName, StudentClass.ClassName, StudentInfo.* FROM StudentInfo INNER JOIN StudentClass ON StudentInfo.StudentClassID = StudentClass.StudentClassID INNER JOIN MajorInfo ON StudentClass.MajorInfoID = MajorInfo.MajorInfoID INNER JOIN GradeInfo ON StudentClass.GradeInfoID = GradeInfo.GradeInfoID INNER JOIN CollegeInfo ON StudentClass.CollegeID = CollegeInfo.CollegeID where 1=1");

            switch (Guanjianzi)
            {
            case "学生姓名":
                sql.Append(string.Format(" and StudentInfo.StudentName like '{0}'", txt));
                break;

            case "学生学号":
                sql.Append(string.Format(" and StudentInfo.StudentNumber like '{0}'", txt));
                break;

            case "班级名称":
                sql.Append(string.Format(" and StudentClass.ClassName like '{0}'", txt));
                break;

            case "专业名称":
                sql.Append(string.Format(" and MajorInfo.MajorSimple like '{0}'", txt));
                break;

            case "学院名称":
                sql.Append(string.Format(" and CollegeInfo.CollegeName like '{0}'", txt));
                break;

            case "年级名称":
                sql.Append(string.Format(" and GradeInfo.GradeName like '{0}'", txt));
                break;

            default:
                break;
            }
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sdr.Read())
                {
                    StudentInfoBusiness studentinfo = new StudentInfoBusiness();
                    studentinfo.StudentName    = sdr["StudentName"].ToString();
                    studentinfo.StudentNumber  = sdr["StudentNumber"].ToString();
                    studentinfo.StudentMarket  = sdr["StudentMarket"].ToString();
                    studentinfo.StudentSex     = sdr["StudentSex"].ToString();
                    studentinfo.CollegeName    = sdr["CollegeName"].ToString();
                    studentinfo.ClassName      = sdr["ClassName"].ToString();
                    studentinfo.GradeName      = sdr["GradeName"].ToString();
                    studentinfo.MajorSimple    = sdr["MajorSimple"].ToString();
                    studentinfo.StudentClassID = Convert.ToInt32(sdr["StudentClassID"]);
                    studentinfo.StudentInfoID  = Convert.ToInt32(sdr["StudentInfoID"]);
                    list.Add(studentinfo);
                }
            }
            return(list);
        }
Exemplo n.º 4
0
        public int GetAllMajorInfo_Class(int StudentClassID) //以班级编号获取专业信息的方法
        {
            string sql = "select * from StudentClass where StudentClassID=@StudentClassID";

            SqlParameter[] parameter = { new SqlParameter("@StudentClassID", SqlDbType.Int) };
            parameter[0].Value = StudentClassID;
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parameter))
            {
                while (sdr.Read())
                {
                    MajorInfoID = int.Parse(sdr["MajorInfoID"].ToString());
                }
            }
            return(MajorInfoID);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 通过条件获取学生费用明细
        /// </summary>
        /// <param name="studentexpense">实体类StudentExpense</param>
        /// <returns></returns>
        public IList <StudentExpense> GetAllStudentExpensebyStudentExpense(StudentExpense studentexpense)
        {
            IList <StudentExpense> liststudnetExpense = new List <StudentExpense>();
            StringBuilder          sql = new StringBuilder("SELECT  CollegeInfo.CollegeName, MajorInfo.MajorName, StudentClass.ClassName, StudentInfo.StudentName, StudentInfo.StudentNumber, StudentInfo.StudentSex, SchoolTerm.TermName, PlanBook.BookName, PlanBook.ISBN, PlanBook.Author, PlanBook.Publish, PlanBook.Price, BookStock.Discount, BookStock.NetPrice, GrantBook.GetBookNum FROM  BookStock INNER JOIN SchoolTerm INNER JOIN GrantBook INNER JOIN StudentInfo INNER JOIN CollegeInfo INNER JOIN StudentClass ON CollegeInfo.CollegeID = StudentClass.CollegeID INNER JOIN  MajorInfo ON StudentClass.MajorInfoID = MajorInfo.MajorInfoID ON StudentInfo.StudentClassID = StudentClass.StudentClassID ON  GrantBook.StudentInfoID = StudentInfo.StudentInfoID ON SchoolTerm.SchoolTermID = GrantBook.SchoolTermID INNER JOIN PlanBook ON GrantBook.PlanBookID = PlanBook.PlanBookID ON BookStock.PlanBookID = PlanBook.PlanBookID where 1=1");

            if (studentexpense.CollegeID > 0)                                                                       //判断获取的学院编号是否大于0
            {
                sql.Append(string.Format(" and CollegeInfo.CollegeID = {0}", studentexpense.CollegeID));            //增加sql语句的where条件
            }
            if (studentexpense.MajorInfoID > 0)                                                                     //判断获取的专业编号是否大于0
            {
                sql.Append(string.Format(" and MajorInfo.MajorInfoID = {0}", studentexpense.MajorInfoID));          //增加sql语句的where条件
            }
            if (studentexpense.StudentClassID > 0)                                                                  //判断获取的班级编号是否大于0
            {
                sql.Append(string.Format(" and StudentClass.StudentClassID = {0}", studentexpense.StudentClassID)); //增加sql语句的where条件
            }
            if (studentexpense.SchoolTermID > 0)                                                                    //判断获取的学年学期编号是否大于0
            {
                sql.Append(string.Format(" and SchoolTerm.SchoolTermID = {0}", studentexpense.SchoolTermID));       //增加sql语句的where条件
            }
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sdr.Read())
                {
                    StudentExpense studentExpense = new StudentExpense();
                    studentExpense.ClassName     = sdr["ClassName"].ToString();
                    studentExpense.CollegeName   = sdr["CollegeName"].ToString();
                    studentExpense.MajorName     = sdr["MajorName"].ToString();
                    studentExpense.StudentName   = sdr["StudentName"].ToString();
                    studentExpense.StudentNumber = sdr["StudentNumber"].ToString();
                    studentExpense.StudentSex    = sdr["StudentSex"].ToString();
                    studentExpense.GetBookNum    = Convert.ToInt32(sdr["GetBookNum"]);
                    studentExpense.BookName      = sdr["BookName"].ToString();
                    studentExpense.Author        = sdr["Author"].ToString();
                    studentExpense.Publish       = sdr["Publish"].ToString();
                    studentExpense.Price         = float.Parse(sdr["Price"].ToString());
                    studentExpense.TermName      = sdr["TermName"].ToString();
                    studentExpense.Discount      = float.Parse(sdr["Discount"].ToString());
                    studentExpense.ISBN          = sdr["ISBN"].ToString();
                    studentExpense.NetPrice      = float.Parse(sdr["NetPrice"].ToString());
                    liststudnetExpense.Add(studentExpense);
                }
            }
            return(liststudnetExpense);
        }
Exemplo n.º 6
0
        public List <SchoolTerm> GetAllSchoolTerm() //获取学年学期的方法
        {
            SchoolTerm        school;
            List <SchoolTerm> list = new List <SchoolTerm>();
            string            sql  = "select * from SchoolTerm";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    school = new SchoolTerm();
                    school.SchoolTermID = int.Parse(sdr["SchoolTermID"].ToString());
                    school.TermName     = sdr["TermName"].ToString();
                    list.Add(school);
                }
            }
            return(list);
        }
Exemplo n.º 7
0
        // public
        public StudentClass GetAllCollegeInfo_Class(string ClassName)  //以班级名称获取学院信息和专业信息的方法
        {
            StudentClass student = new StudentClass();
            string       sql     = "select * from StudentClass where ClassName=@ClassName";

            SqlParameter[] parameter = { new SqlParameter("@ClassName", SqlDbType.VarChar, 50) };
            parameter[0].Value = ClassName;
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parameter))
            {
                while (sdr.Read())
                {
                    student.CollegeID      = int.Parse(sdr["CollegeID"].ToString());
                    student.MajorInfoID    = int.Parse(sdr["MajorInfoID"].ToString());
                    student.StudentClassID = int.Parse(sdr["StudentClassID"].ToString());
                }
            }
            return(student);
        }
Exemplo n.º 8
0
        public List <GradeInfo> GetAllGradeInfo()
        {
            List <GradeInfo> list = new List <GradeInfo>();
            string           sql  = "select * from GradeInfo";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    GradeInfo grade = new GradeInfo();
                    grade.GradeInfoID = Convert.ToInt32(sdr["GradeInfoID"]);
                    grade.GradeName   = sdr["GradeName"].ToString();
                    grade.GradeSimple = sdr["GradeSimple"].ToString();
                    list.Add(grade);
                }
            }
            return(list);
        }
Exemplo n.º 9
0
        public List <Course> GetAllCourse() //获取教材类型的方法
        {
            Course        course;
            List <Course> list = new List <Course>();
            string        sql  = "select * from Course";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    course            = new Course();
                    course.CourseID   = int.Parse(sdr["CourseID"].ToString());
                    course.CourseType = sdr["CourseType"].ToString();
                    list.Add(course);
                }
            }
            return(list);
        }
Exemplo n.º 10
0
        public List <NoArriveBook> GetAllInfo(int index, string txt)
        {
            List <NoArriveBook> list = new List <NoArriveBook>();
            StringBuilder       sql  = new StringBuilder("SELECT BookStock.StockBookID,PlanBook.BookName, PlanBook.ISBN, PlanBook.Author, PlanBook.Publish, PlanBook.Price, PlanBook.BookTotalNum, BookStock.ArriveQuantity ,BookStock.NoArriveQuantity  FROM PlanBook INNER JOIN BookStock ON PlanBook.PlanBookID = BookStock.PlanBookID where BookStock.NoArriveQuantity>0 ");

            if (index == 0)
            {
                sql.ToString(); //当index==0时必须指定cmd.CommandText的值,否则cmd.CommandText的值为空的时候系统会出现异常
            }
            if (index == 1)
            {
                sql.Append(string.Format(" and PlanBook.BookName like {0}", txt));
            }
            if (index == 2)
            {
                sql.Append(string.Format(" and PlanBook.ISBN like {0}", txt));
            }
            if (index == 3)
            {
                sql.Append(string.Format(" and PlanBook.Author like {0}", txt));
            }
            if (index == 4)
            {
                sql.Append(string.Format(" and PlanBook.Publish like {0}", txt));
            }
            using (SqlDataReader sqldata = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sqldata.Read())
                {
                    NoArriveBook no = new NoArriveBook();
                    no.BookName         = sqldata["BookName"].ToString();
                    no.ISBN             = sqldata["ISBN"].ToString();
                    no.Author           = sqldata["Author"].ToString();
                    no.Publish          = sqldata["Publish"].ToString();
                    no.Price            = float.Parse(sqldata["Price"].ToString());
                    no.BookTotalNum     = Convert.ToInt32(sqldata["BookTotalNum"]);
                    no.StockBookID      = Convert.ToInt32(sqldata["StockBookID"]);
                    no.NoArriveQuantity = Convert.ToInt32(sqldata["NoArriveQuantity"]);
                    no.ArriveQuantity   = Convert.ToInt32(sqldata["ArriveQuantity"]);
                    list.Add(no);
                }
            }
            return(list);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取教材发放明细的方法
        /// </summary>
        /// <param name="TypeID">可以选择sql语句的调用</param>
        /// <param name="ID">ID可以表示学院信息ID   也可以表示班级信息ID</param>
        /// <returns></returns>
        public List <GrantBookBusiness> GetAllGrantBookInfo(int TypeID, int ID)
        {
            List <GrantBookBusiness> list = new List <GrantBookBusiness>();
            StringBuilder            sql  = new StringBuilder("SELECT  CollegeInfo.CollegeName,Course.CourseType, MajorInfo.MajorSimple, GradeInfo.GradeSimple, SchoolTerm.TermName, StudentInfo.StudentName,StudentInfo.StudentNumber, StudentInfo.StudentSex, StudentClass.ClassName,GrantBook.GrantID, GrantBook.GetBookNum, PlanBook.CourseName, PlanBook.BookName,PlanBook.CourseName, PlanBook.ISBN, PlanBook.Author, PlanBook.Publish FROM GradeInfo INNER JOIN StudentClass ON GradeInfo.GradeInfoID = StudentClass.GradeInfoID INNER JOIN CollegeInfo ON StudentClass.CollegeID = CollegeInfo.CollegeID INNER JOIN MajorInfo ON StudentClass.MajorInfoID = MajorInfo.MajorInfoID INNER JOIN PlanBook INNER JOIN GrantBook ON PlanBook.PlanBookID = GrantBook.PlanBookID INNER JOIN StudentInfo ON GrantBook.StudentInfoID = StudentInfo.StudentInfoID ON StudentClass.StudentClassID = StudentInfo.StudentClassID INNER JOIN Course on Course.CourseID=PlanBook.CourseID INNER JOIN SchoolTerm ON GrantBook.SchoolTermID = SchoolTerm.SchoolTermID where 1=1 ");

            if (TypeID == 0)
            {
                sql.ToString();
            }
            if (TypeID == 1)
            {
                sql.Append(string.Format(" and CollegeInfo.CollegeID ={0}", ID));
            }
            if (TypeID == 2)
            {
                sql.Append(string.Format(" and StudentClass.StudentClassID ={0}", ID));
            }
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sdr.Read())
                {
                    GrantBookBusiness grant = new GrantBookBusiness();
                    grant.GrantID     = Convert.ToInt32(sdr["GrantID"]);
                    grant.CollegeName = sdr["CollegeName"].ToString();
                    grant.MajorSimple = sdr["MajorSimple"].ToString();
                    //grant.GradeSimple = sdr["GradeSimple"].ToString();
                    grant.TermName      = sdr["TermName"].ToString();
                    grant.ClassName     = sdr["ClassName"].ToString();
                    grant.StudentName   = sdr["StudentName"].ToString();
                    grant.StudentNumber = sdr["StudentNumber"].ToString();
                    grant.StudentSex    = sdr["StudentSex"].ToString();
                    grant.BookName      = sdr["BookName"].ToString();
                    grant.Author        = sdr["Author"].ToString();
                    grant.Publish       = sdr["Publish"].ToString();
                    grant.ISBN          = sdr["ISBN"].ToString();
                    grant.GetBookNum    = sdr["GetBookNum"].ToString();
                    grant.CourseName    = sdr["CourseName"].ToString();
                    grant.CourseType    = sdr["CourseType"].ToString();
                    list.Add(grant);
                }
            }
            return(list);
        }
Exemplo n.º 12
0
        public List <StudentClass> GetAllStudentClassbyMajorId(int MajorInfoID)
        {
            StudentClass        student;
            List <StudentClass> list = new List <StudentClass>();
            string sql = "select * from StudentClass where MajorInfoID=@MajorInfoID";

            SqlParameter[] parameter = { new SqlParameter("@MajorInfoID", SqlDbType.Int) };
            parameter[0].Value = MajorInfoID;
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parameter))
            {
                while (sdr.Read())
                {
                    student = new StudentClass();
                    student.StudentClassID = int.Parse(sdr["StudentClassID"].ToString());
                    student.ClassName      = sdr["ClassName"].ToString();
                    list.Add(student);
                }
            }
            return(list);
        }
Exemplo n.º 13
0
        public List <StudentClass> GetAllStudentClass(int majorInfoID, int gradeInfoID) //以专业编号和年级编号获取班级信息的方法
        {
            StudentClass        student;
            List <StudentClass> list = new List <StudentClass>();
            string sql = "select * from StudentClass where MajorInfoID=@majorInfoID and GradeInfoID=@gradeInfoID";

            SqlParameter[] parameter = { new SqlParameter("@majorInfoID", majorInfoID),
                                         new SqlParameter("@gradeInfoID", gradeInfoID) };
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parameter))
            {
                while (sdr.Read())
                {
                    student = new StudentClass();
                    student.StudentClassID = int.Parse(sdr["StudentClassID"].ToString());
                    student.ClassName      = sdr["ClassName"].ToString();
                    list.Add(student);
                }
            }
            return(list);
        }
Exemplo n.º 14
0
        public List <MajorInfo> GetAllMajorInfo(int collegeID) //以学院编号获取专业信息的方法
        {
            MajorInfo        major;
            List <MajorInfo> list = new List <MajorInfo>();
            string           sql  = "select * from MajorInfo where CollegeID=@CollegeID";

            SqlParameter[] parameter = { new SqlParameter("@CollegeID", collegeID) };
            //parameter[0].Value = collegeID;
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql, parameter))
            {
                while (sdr.Read())
                {
                    major             = new MajorInfo();
                    major.MajorInfoID = int.Parse(sdr["MajorInfoID"].ToString());
                    major.MajorSimple = sdr["MajorSimple"].ToString();
                    list.Add(major);
                }
            }
            return(list);
        }
Exemplo n.º 15
0
        public List <CollegeInfo> GetAllCollegeInfo() //获取学院信息的方法
        {
            CollegeInfo        co;
            List <CollegeInfo> list = new List <CollegeInfo>();
            string             sql  = "select * from CollegeInfo";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    co           = new CollegeInfo();
                    co.CollegeID = int.Parse(sdr["CollegeID"].ToString());
                    //co.CollegeSimple = sdr["CollegeSimple"].ToString();
                    co.CollegeName = sdr["CollegeName"].ToString();
                    list.Add(co);
                }
            }

            return(list);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 获取库存信息的方法
        /// </summary>
        /// <param name="TypeID">可以选择sql语句的调用</param>
        /// <param name="ID">ID可以表示学院信息ID   也可以表示班级信息ID</param>
        /// <returns></returns>
        public List <BookStockBusiness> GetAllBookStock(int TypeID, int ID)
        {
            List <BookStockBusiness> list = new List <BookStockBusiness>();
            StringBuilder            sql  = new StringBuilder("SELECT PlanBook.PlanBookID, StudentClass.ClassName, SchoolTerm.TermSimple, Course.CourseType,PlanBook.CourseName, PlanBook.BookName, PlanBook.ISBN as 'ISBN', PlanBook.Author,PlanBook.SchoolTermID, PlanBook.Publish,PlanBook.BookTotalNum FROM  BookStock INNER JOIN PlanBook ON BookStock.PlanBookID = PlanBook.PlanBookID INNER JOIN SchoolTerm ON PlanBook.SchoolTermID = SchoolTerm.SchoolTermID INNER JOIN StudentClass ON PlanBook.StudentClassID = StudentClass.StudentClassID INNER JOIN CollegeInfo on CollegeInfo.CollegeID=StudentClass.CollegeID INNER JOIN Course ON PlanBook.CourseID = Course.CourseID where PlanBook.isBookStock=1 ");

            if (TypeID == 0)
            {
                sql.ToString();
            }
            if (TypeID == 1)
            {
                sql.Append(string.Format(" and CollegeInfo.CollegeID ={0}", ID));
            }
            if (TypeID == 2)
            {
                sql.Append(string.Format(" and StudentClass.StudentClassID ={0}", ID));
            }
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sdr.Read())
                {
                    BookStockBusiness book = new BookStockBusiness();
                    book.PlanBookID   = Convert.ToInt32(sdr["PlanBookID"]);
                    book.SchoolTermID = Convert.ToInt32(sdr["SchoolTermID"]);
                    book.ClassName    = sdr["ClassName"].ToString();
                    book.TermSimple   = sdr["TermSimple"].ToString();
                    book.CourseType   = sdr["CourseType"].ToString();
                    book.CourseName   = sdr["CourseName"].ToString();
                    book.BookName     = sdr["BookName"].ToString();
                    book.Author       = sdr["Author"].ToString();
                    book.Publish      = sdr["Publish"].ToString();
                    book.ISBN         = sdr["ISBN"].ToString();
                    book.BookTotalNum = Convert.ToInt32(sdr["BookTotalNum"]);
                    list.Add(book);
                }
            }
            return(list);
        }
Exemplo n.º 17
0
        public List <GetBookBusiness> GetAllGetBook()  //获取所有库存信息的方法
        {
            List <GetBookBusiness> list = new List <GetBookBusiness>();
            string sql = "SELECT GetBook.GetBookID, GetBook.GetBookNum, GetBook.Signer, StudentClass.ClassName, PlanBook.BookName, PlanBook.ISBN, PlanBook.Publish, PlanBook.Author,Course.CourseType FROM  GetBook INNER JOIN PlanBook ON GetBook.PlanBookID = PlanBook.PlanBookID INNER JOIN StudentClass ON GetBook.StudentClassID = StudentClass.StudentClassID INNER JOIN CollegeInfo on CollegeInfo.CollegeID=StudentClass.CollegeID INNER JOIN Course ON PlanBook.CourseID = Course.CourseID where 1=1";

            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql))
            {
                while (sdr.Read())
                {
                    GetBookBusiness getbook = new GetBookBusiness();
                    getbook.BookName   = sdr["BookName"].ToString();
                    getbook.Author     = sdr["Author"].ToString();
                    getbook.ClassName  = sdr["ClassName"].ToString();
                    getbook.CourseType = sdr["CourseType"].ToString();
                    getbook.GetBookID  = Convert.ToInt32(sdr["GetBookID"].ToString());
                    getbook.GetBookNum = Convert.ToInt32(sdr["GetBookNum"].ToString());
                    getbook.ISBN       = sdr["ISBN"].ToString();
                    getbook.Publish    = sdr["Publish"].ToString();
                    getbook.Signer     = sdr["Signer"].ToString();
                    list.Add(getbook);
                }
            }
            return(list);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获取学生信息的方法
        /// </summary>
        /// <param name="TypeID">可以选择sql语句的调用</param>
        /// <param name="ID">ID可以表示学院信息ID   也可以表示班级信息ID</param>
        /// <returns></returns>
        public List <StudentInfoBusiness> GetAllStudentInfo(int TypeID, int ID)
        {
            List <StudentInfoBusiness> list = new List <StudentInfoBusiness>();
            StringBuilder sql = new StringBuilder("SELECT  StudentInfo.StudentInfoID,StudentInfo.StudentMarket, StudentClass.ClassName, StudentInfo.StudentName, StudentInfo.StudentNumber, StudentInfo.StudentSex, CollegeInfo.CollegeName, GradeInfo.GradeName, MajorInfo.MajorSimple FROM StudentInfo INNER JOIN StudentClass ON StudentInfo.StudentClassID = StudentClass.StudentClassID INNER JOIN  CollegeInfo ON StudentClass.CollegeID = CollegeInfo.CollegeID INNER JOIN  MajorInfo ON StudentClass.MajorInfoID = MajorInfo.MajorInfoID INNER JOIN GradeInfo ON StudentClass.GradeInfoID = GradeInfo.GradeInfoID where 1=1 ");

            if (TypeID == 0)
            {
                sql.ToString();
            }
            if (TypeID == 1)
            {
                sql.Append(string.Format(" and CollegeInfo.CollegeID ={0}", ID));
            }
            if (TypeID == 2)
            {
                sql.Append(string.Format(" and StudentClass.StudentClassID ={0}", ID));
            }
            using (SqlDataReader sdr = DBHelpers.GetAllInfo(sql.ToString()))
            {
                while (sdr.Read())
                {
                    StudentInfoBusiness student = new StudentInfoBusiness();
                    student.ClassName   = sdr["ClassName"].ToString();
                    student.CollegeName = sdr["CollegeName"].ToString();
                    //student.GradeName = sdr["GradeName"].ToString();
                    student.MajorSimple   = sdr["MajorSimple"].ToString();
                    student.StudentInfoID = Convert.ToInt32(sdr["StudentInfoID"]);
                    student.StudentName   = sdr["StudentName"].ToString();
                    student.StudentNumber = sdr["StudentNumber"].ToString();
                    student.StudentSex    = sdr["StudentSex"].ToString();
                    student.StudentMarket = sdr["StudentMarket"].ToString();
                    list.Add(student);
                }
            }
            return(list);
        }