/*根据barcode获取某条图书记录*/ public static Model.Book getSomeBook(string barcode) { /*构建查询sql*/ string sql = "select * from U_Custom where U_id=" + barcode; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.Book book = new Model.Book(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.barcode = Convert.ToInt32(DataRead["U_Id"]); book.bookName = DataRead["U_Name"].ToString(); book.Name = DataRead["U_RelName"].ToString(); book.email = DataRead["U_Email"].ToString(); book.qq = DataRead["U_QQ"].ToString(); book.move = DataRead["U_MoveTele"].ToString(); book.tele = DataRead["U_Telephone"].ToString(); book.weixin = DataRead["U_Weixin"].ToString(); book.bookType = Convert.ToInt32(DataRead["U_PsdType"]); book.area = Convert.ToInt32(DataRead["U_areaType"]); book.clerk = Convert.ToInt32(DataRead["U_ClerkType"]); book.address = DataRead["U_Address"].ToString(); book.www = DataRead["U_Position"].ToString(); book.note = DataRead["U_Note"].ToString(); book.bookPhoto = (byte[])DataRead["U_Image"]; book.publishDate = Convert.ToDateTime(DataRead["U_LoginTime"].ToString()); } DataRead.Close(); return(book); }
/*根据studentNumber获取某条学生信息记录*/ public static ENTITY.Student getSomeStudent(string studentNumber) { /*构建查询sql*/ string sql = "select * from Student where studentNumber='" + studentNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Student student = new ENTITY.Student(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { student.studentNumber = DataRead["studentNumber"].ToString(); student.studentName = DataRead["studentName"].ToString(); student.studentPassword = DataRead["studentPassword"].ToString(); student.studentSex = DataRead["studentSex"].ToString(); student.studentClassNumber = DataRead["studentClassNumber"].ToString(); student.studentBirthday = Convert.ToDateTime(DataRead["studentBirthday"].ToString()); student.studentState = DataRead["studentState"].ToString(); student.studentPhoto = DataRead["studentPhoto"].ToString(); student.studentTelephone = DataRead["studentTelephone"].ToString(); student.studentEmail = DataRead["studentEmail"].ToString(); student.studentQQ = DataRead["studentQQ"].ToString(); student.studentAddress = DataRead["studentAddress"].ToString(); student.studentMemo = DataRead["studentMemo"].ToString(); } return(student); }
/*根据barcode获取某条图书记录*/ public static Model.Book getSomeBook(string barcode) { /*构建查询sql*/ string sql = "select * from U_Custom where U_id=" + barcode; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.Book book = new Model.Book(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.barcode = Convert.ToInt32(DataRead["U_Id"]); book.bookType = Convert.ToInt32(DataRead["U_Grade"]); book.bookName = DataRead["U_Number"].ToString(); book.Name = DataRead["U_Name"].ToString(); book.email = double.Parse(DataRead["U_Pay"].ToString()); book.qq = double.Parse(DataRead["U_Total"].ToString()); book.move = double.Parse(DataRead["U_TeamSum"].ToString()); book.tele = DataRead["U_Tel"].ToString(); book.weixin = double.Parse(DataRead["U_Count"].ToString()); book.recommend = Convert.ToInt32(DataRead["U_Introduce"]); book.area = DataRead["U_Sex"].ToString(); book.clerk = Convert.ToInt32(DataRead["U_ClerkType"]); book.address = DataRead["U_Lower"].ToString(); book.www = double.Parse(DataRead["U_Sum"].ToString()); book.note = DataRead["U_Note"].ToString(); book.publishDate = Convert.ToDateTime(DataRead["U_LoginDate"].ToString()); book.team = (bool)DataRead["U_Team"]; book.bank = DataRead["U_Bank"].ToString(); book.bankn = DataRead["U_BankN"].ToString(); book.bankname = DataRead["U_BankName"].ToString(); } DataRead.Close(); return(book); }
public static Model.Book getSomePhoto(string barcode) { /*构建查询sql*/ string sql = "select Photo from Product where u_Code='" + barcode + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.Book book = new Model.Book(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.bookPhoto = (byte[])DataRead["Photo"]; } DataRead.Close(); return(book); }
/*根据termId获取某条学期信息记录*/ public static ENTITY.TermInfo_ getSomeTermInfo_(int termId) { /*构建查询sql*/ string sql = "select * from TermInfo_ where termId=" + termId; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.TermInfo_ termInfo_ = new ENTITY.TermInfo_(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { termInfo_.termId = Convert.ToInt32(DataRead["termId"]); termInfo_.termName = DataRead["termName"].ToString(); } return(termInfo_); }
/*根据selectId获取某条选课信息记录*/ public static ENTITY.StudentSelectCourseInfo getSomeStudentSelectCourseInfo(int selectId) { /*构建查询sql*/ string sql = "select * from StudentSelectCourseInfo where selectId=" + selectId; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.StudentSelectCourseInfo studentSelectCourseInfo = new ENTITY.StudentSelectCourseInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { studentSelectCourseInfo.selectId = Convert.ToInt32(DataRead["selectId"]); studentSelectCourseInfo.studentNumber = DataRead["studentNumber"].ToString(); studentSelectCourseInfo.courseNumber = DataRead["courseNumber"].ToString(); } return(studentSelectCourseInfo); }
/*根据classNo获取某条班级信息记录*/ public static ENTITY.Class_ getSomeClass_(string classNo) { /*构建查询sql*/ string sql = "select * from Class_ where classNo='" + classNo + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Class_ class_ = new ENTITY.Class_(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { class_.classNo = DataRead["classNo"].ToString(); class_.className = DataRead["className"].ToString(); class_.banzhuren = DataRead["banzhuren"].ToString(); class_.beginTime = Convert.ToDateTime(DataRead["beginTime"].ToString()); } return(class_); }
/*根据courseNo获取某条课程信息记录*/ public static ENTITY.Course_ getSomeCourse_(string courseNo) { /*构建查询sql*/ string sql = "select * from Course_ where courseNo='" + courseNo + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Course_ course_ = new ENTITY.Course_(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { course_.courseNo = DataRead["courseNo"].ToString(); course_.courseName = DataRead["courseName"].ToString(); course_.teacherName = DataRead["teacherName"].ToString(); course_.courseCount = Convert.ToInt32(DataRead["courseCount"]); course_.courseScore = float.Parse(DataRead["courseScore"].ToString()); } return(course_); }
/*根据newsId获取某条新闻信息记录*/ public static ENTITY.News getSomeNews(int newsId) { /*构建查询sql*/ string sql = "select * from News where newsId=" + newsId; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.News news = new ENTITY.News(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { news.newsId = Convert.ToInt32(DataRead["newsId"]); news.newsTitle = DataRead["newsTitle"].ToString(); news.newsContent = DataRead["newsContent"].ToString(); news.newsDate = Convert.ToDateTime(DataRead["newsDate"].ToString()); news.newsPhoto = DataRead["newsPhoto"].ToString(); } return(news); }
/*根据scoreId获取某条成绩信息记录*/ public static ENTITY.ScoreInfo getSomeScoreInfo(int scoreId) { /*构建查询sql*/ string sql = "select * from ScoreInfo where scoreId=" + scoreId; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.ScoreInfo scoreInfo = new ENTITY.ScoreInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { scoreInfo.scoreId = Convert.ToInt32(DataRead["scoreId"]); scoreInfo.studentNumber = DataRead["studentNumber"].ToString(); scoreInfo.courseNumber = DataRead["courseNumber"].ToString(); scoreInfo.scoreValue = float.Parse(DataRead["scoreValue"].ToString()); scoreInfo.studentEvaluate = DataRead["studentEvaluate"].ToString(); } return(scoreInfo); }
/*根据scoreId获取某条成绩信息记录*/ public static ENTITY.Score_ getSomeScore_(int scoreId) { /*构建查询sql*/ string sql = "select * from Score_ where scoreId=" + scoreId; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Score_ score_ = new ENTITY.Score_(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { score_.scoreId = Convert.ToInt32(DataRead["scoreId"]); score_.studentNo = DataRead["studentNo"].ToString(); score_.courseNo = DataRead["courseNo"].ToString(); score_.termId = Convert.ToInt32(DataRead["termId"]); score_.score = float.Parse(DataRead["score"].ToString()); } return(score_); }
public static Model.BookType getSomeRank(string barcode) { /*构建查询sql*/ string sql = "select * from CustomType where C_id=" + barcode; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.BookType book = new Model.BookType(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.Id = Convert.ToInt32(DataRead["C_Id"]); book.Number = DataRead["C_Number"].ToString(); book.Name = DataRead["C_Name"].ToString(); book.amount = double.Parse(DataRead["C_Amount"].ToString()); book.rateA = double.Parse(DataRead["C_Rate"].ToString()); } DataRead.Close(); return(book); }
public static Model.Book getSomeWord(string barcode) { /*构建查询sql*/ string sql = "select * from U_Word where U_id='" + barcode + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.Book book = new Model.Book(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.barcode = Convert.ToInt32(DataRead["U_Id"]); book.bookName = DataRead["U_Word"].ToString(); book.Name = DataRead["U_Chinese"].ToString(); book.move = DataRead["U_Pronounce"].ToString(); book.address = DataRead["U_Note"].ToString(); } DataRead.Close(); return(book); }
/*根据collegeNumber获取某条学院信息记录*/ public static ENTITY.CollegeInfo getSomeCollegeInfo(string collegeNumber) { /*构建查询sql*/ string sql = "select * from CollegeInfo where collegeNumber='" + collegeNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.CollegeInfo collegeInfo = new ENTITY.CollegeInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { collegeInfo.collegeNumber = DataRead["collegeNumber"].ToString(); collegeInfo.collegeName = DataRead["collegeName"].ToString(); collegeInfo.collegeBirthDate = Convert.ToDateTime(DataRead["collegeBirthDate"].ToString()); collegeInfo.collegeMan = DataRead["collegeMan"].ToString(); collegeInfo.collegeTelephone = DataRead["collegeTelephone"].ToString(); collegeInfo.collegeMemo = DataRead["collegeMemo"].ToString(); } return(collegeInfo); }
public static List <CusUsers> getUserId(string username) { string sql = "select customerid from CusUsers where Customername =@Customername"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@Customername", SqlDbType.VarChar) }; para[0].Value = username; List <CusUsers> liks = new List <CusUsers>(); SqlDataReader sdr = DBHelp.ExecuteReader(sql, para); while (sdr.Read()) { CusUsers l1 = new CusUsers(); l1.customerid = Convert.ToInt32(sdr["customerid"].ToString()); liks.Add(l1); } return(liks); }
/*根据courseNumber获取某条课程信息记录*/ public static ENTITY.CourseInfo getSomeCourseInfo(string courseNumber) { /*构建查询sql*/ string sql = "select * from CourseInfo where courseNumber='" + courseNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.CourseInfo courseInfo = new ENTITY.CourseInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { courseInfo.courseNumber = DataRead["courseNumber"].ToString(); courseInfo.courseName = DataRead["courseName"].ToString(); courseInfo.courseTeacher = DataRead["courseTeacher"].ToString(); courseInfo.courseTime = DataRead["courseTime"].ToString(); courseInfo.coursePlace = DataRead["coursePlace"].ToString(); courseInfo.courseScore = float.Parse(DataRead["courseScore"].ToString()); courseInfo.courseMemo = DataRead["courseMemo"].ToString(); } return(courseInfo); }
public static Model.Book getSomeFile(string barcode, string Sqlname) { /*构建查询sql*/ string sql = "select * from " + Sqlname + " where U_id='" + barcode + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); Model.Book book = new Model.Book(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { book.barcode = Convert.ToInt32(DataRead["U_Id"]); book.bookName = DataRead["U_Name"].ToString(); book.bookType = Convert.ToInt32(DataRead["U_PsdType"]); book.note = DataRead["U_Note"].ToString(); book.bookPhoto = (byte[])DataRead["U_Image"]; book.publishDate = Convert.ToDateTime(DataRead["U_LoginTime"].ToString()); } DataRead.Close(); return(book); }
/*根据specialFieldNumber获取某条专业信息记录*/ public static ENTITY.SpecialFieldInfo getSomeSpecialFieldInfo(string specialFieldNumber) { /*构建查询sql*/ string sql = "select * from SpecialFieldInfo where specialFieldNumber='" + specialFieldNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.SpecialFieldInfo specialFieldInfo = new ENTITY.SpecialFieldInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { specialFieldInfo.specialFieldNumber = DataRead["specialFieldNumber"].ToString(); specialFieldInfo.specialFieldName = DataRead["specialFieldName"].ToString(); specialFieldInfo.specialCollegeNumber = DataRead["specialCollegeNumber"].ToString(); specialFieldInfo.specialBirthDate = Convert.ToDateTime(DataRead["specialBirthDate"].ToString()); specialFieldInfo.specialMan = DataRead["specialMan"].ToString(); specialFieldInfo.specialTelephone = DataRead["specialTelephone"].ToString(); specialFieldInfo.specialMemo = DataRead["specialMemo"].ToString(); } return(specialFieldInfo); }
/*根据classNumber获取某条班级信息记录*/ public static ENTITY.ClassInfo getSomeClassInfo(string classNumber) { /*构建查询sql*/ string sql = "select * from ClassInfo where classNumber='" + classNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.ClassInfo classInfo = new ENTITY.ClassInfo(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { classInfo.classNumber = DataRead["classNumber"].ToString(); classInfo.className = DataRead["className"].ToString(); classInfo.classSpecialFieldNumber = DataRead["classSpecialFieldNumber"].ToString(); classInfo.classBirthDate = Convert.ToDateTime(DataRead["classBirthDate"].ToString()); classInfo.classTeacherCharge = DataRead["classTeacherCharge"].ToString(); classInfo.classTelephone = DataRead["classTelephone"].ToString(); classInfo.classMemo = DataRead["classMemo"].ToString(); } return(classInfo); }
public static ENTITY.CusUsers getSomeUserInfo(int userid) { string sql = "select * from CusUsers where customerid=" + userid; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.CusUsers tempUser = new ENTITY.CusUsers(); while (DataRead.Read()) { tempUser.customerid = Convert.ToInt32(DataRead["customerid"]); tempUser.Customername = DataRead["Customername"].ToString(); tempUser.customerpwd = DataRead["customerpwd"].ToString(); tempUser.Realname = DataRead["Realname"].ToString(); tempUser.CustomerSfz = DataRead["CustomerSfz"].ToString(); tempUser.address = DataRead["address"].ToString(); tempUser.telphone = DataRead["telphone"].ToString(); tempUser.IsCusAdmin = Convert.ToInt32(DataRead["IsCusAdmin"]); tempUser.CusType = Convert.ToInt32(DataRead["CusType"]); } return(tempUser); }
/*根据studentNumber获取某条学生信息记录*/ public static ENTITY.Student_ getSomeStudent_(string studentNumber) { /*构建查询sql*/ string sql = "select * from Student_ where studentNumber='" + studentNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Student_ student_ = new ENTITY.Student_(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { student_.studentNumber = DataRead["studentNumber"].ToString(); student_.studentName = DataRead["studentName"].ToString(); student_.sex = DataRead["sex"].ToString(); student_.classInfo = DataRead["classInfo"].ToString(); student_.birthday = Convert.ToDateTime(DataRead["birthday"].ToString()); student_.zhengzhimianmao = DataRead["zhengzhimianmao"].ToString(); student_.telephone = DataRead["telephone"].ToString(); student_.address = DataRead["address"].ToString(); } return(student_); }
/*根据teacherNumber获取某条教师信息记录*/ public static ENTITY.Teacher getSomeTeacher(string teacherNumber) { /*构建查询sql*/ string sql = "select * from Teacher where teacherNumber='" + teacherNumber + "'"; SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null); ENTITY.Teacher teacher = new ENTITY.Teacher(); /*如果查询存在记录,就包装到对象中返回*/ if (DataRead.Read()) { teacher.teacherNumber = DataRead["teacherNumber"].ToString(); teacher.teacherName = DataRead["teacherName"].ToString(); teacher.teacherPassword = DataRead["teacherPassword"].ToString(); teacher.teacherSex = DataRead["teacherSex"].ToString(); teacher.teacherBirthday = Convert.ToDateTime(DataRead["teacherBirthday"].ToString()); teacher.teacherArriveDate = Convert.ToDateTime(DataRead["teacherArriveDate"].ToString()); teacher.teacherCardNumber = DataRead["teacherCardNumber"].ToString(); teacher.teacherPhone = DataRead["teacherPhone"].ToString(); teacher.teacherPhoto = DataRead["teacherPhoto"].ToString(); teacher.teacherAddress = DataRead["teacherAddress"].ToString(); teacher.teacherMemo = DataRead["teacherMemo"].ToString(); } return(teacher); }