/*更新班级信息实现*/ public static bool EditClassInfo(ENTITY.ClassInfo classInfo) { string sql = "update ClassInfo set className=@className,classSpecialFieldNumber=@classSpecialFieldNumber,classBirthDate=@classBirthDate,classTeacherCharge=@classTeacherCharge,classTelephone=@classTelephone,classMemo=@classMemo where classNumber=@classNumber"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@className", SqlDbType.VarChar), new SqlParameter("@classSpecialFieldNumber", SqlDbType.VarChar), new SqlParameter("@classBirthDate", SqlDbType.DateTime), new SqlParameter("@classTeacherCharge", SqlDbType.VarChar), new SqlParameter("@classTelephone", SqlDbType.VarChar), new SqlParameter("@classMemo", SqlDbType.VarChar), new SqlParameter("@classNumber", SqlDbType.VarChar) }; /*为参数赋值*/ parm[0].Value = classInfo.className; parm[1].Value = classInfo.classSpecialFieldNumber; parm[2].Value = classInfo.classBirthDate; parm[3].Value = classInfo.classTeacherCharge; parm[4].Value = classInfo.classTelephone; parm[5].Value = classInfo.classMemo; parm[6].Value = classInfo.classNumber; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/// <summary> /// 更改密码 /// </summary> public bool UpdatePassword(string pwd, long key) { StringBuilder strSql = new StringBuilder(); strSql.Append("update U_UserInfo set "); strSql.Append(" U_PassWord = @U_PassWord "); strSql.Append(" where U_Id=@U_Id "); SqlParameter[] parameters = { new SqlParameter("@U_Id", SqlDbType.Int, 4), new SqlParameter("@U_PassWord", SqlDbType.VarChar, 50) }; parameters[0].Value = key; parameters[1].Value = pwd; int rows = DBHelp.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/*更新课程信息实现*/ public static bool EditCourseInfo(ENTITY.CourseInfo courseInfo) { string sql = "update CourseInfo set courseName=@courseName,courseTeacher=@courseTeacher,courseTime=@courseTime,coursePlace=@coursePlace,courseScore=@courseScore,courseMemo=@courseMemo where courseNumber=@courseNumber"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@courseName", SqlDbType.VarChar), new SqlParameter("@courseTeacher", SqlDbType.VarChar), new SqlParameter("@courseTime", SqlDbType.VarChar), new SqlParameter("@coursePlace", SqlDbType.VarChar), new SqlParameter("@courseScore", SqlDbType.Float), new SqlParameter("@courseMemo", SqlDbType.VarChar), new SqlParameter("@courseNumber", SqlDbType.VarChar) }; /*为参数赋值*/ parm[0].Value = courseInfo.courseName; parm[1].Value = courseInfo.courseTeacher; parm[2].Value = courseInfo.courseTime; parm[3].Value = courseInfo.coursePlace; parm[4].Value = courseInfo.courseScore; parm[5].Value = courseInfo.courseMemo; parm[6].Value = courseInfo.courseNumber; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加专业信息实现*/ public static bool AddSpecialFieldInfo(ENTITY.SpecialFieldInfo specialFieldInfo) { string sql = "insert into SpecialFieldInfo(specialFieldNumber,specialFieldName,specialCollegeNumber,specialBirthDate,specialMan,specialTelephone,specialMemo) values(@specialFieldNumber,@specialFieldName,@specialCollegeNumber,@specialBirthDate,@specialMan,@specialTelephone,@specialMemo)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@specialFieldNumber", SqlDbType.VarChar), new SqlParameter("@specialFieldName", SqlDbType.VarChar), new SqlParameter("@specialCollegeNumber", SqlDbType.VarChar), new SqlParameter("@specialBirthDate", SqlDbType.DateTime), new SqlParameter("@specialMan", SqlDbType.VarChar), new SqlParameter("@specialTelephone", SqlDbType.VarChar), new SqlParameter("@specialMemo", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = specialFieldInfo.specialFieldNumber; //专业编号 parm[1].Value = specialFieldInfo.specialFieldName; //专业名称 parm[2].Value = specialFieldInfo.specialCollegeNumber; //所在学院 parm[3].Value = specialFieldInfo.specialBirthDate; //成立日期 parm[4].Value = specialFieldInfo.specialMan; //联系人 parm[5].Value = specialFieldInfo.specialTelephone; //联系电话 parm[6].Value = specialFieldInfo.specialMemo; //附加信息 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加课程信息实现*/ public static bool AddCourseInfo(ENTITY.CourseInfo courseInfo) { string sql = "insert into CourseInfo(courseNumber,courseName,courseTeacher,courseTime,coursePlace,courseScore,courseMemo) values(@courseNumber,@courseName,@courseTeacher,@courseTime,@coursePlace,@courseScore,@courseMemo)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@courseNumber", SqlDbType.VarChar), new SqlParameter("@courseName", SqlDbType.VarChar), new SqlParameter("@courseTeacher", SqlDbType.VarChar), new SqlParameter("@courseTime", SqlDbType.VarChar), new SqlParameter("@coursePlace", SqlDbType.VarChar), new SqlParameter("@courseScore", SqlDbType.Float), new SqlParameter("@courseMemo", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = courseInfo.courseNumber; //课程编号 parm[1].Value = courseInfo.courseName; //课程名称 parm[2].Value = courseInfo.courseTeacher; //上课老师 parm[3].Value = courseInfo.courseTime; //上课时间 parm[4].Value = courseInfo.coursePlace; //上课地点 parm[5].Value = courseInfo.courseScore; //课程学分 parm[6].Value = courseInfo.courseMemo; //附加信息 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*更新专业信息实现*/ public static bool EditSpecialFieldInfo(ENTITY.SpecialFieldInfo specialFieldInfo) { string sql = "update SpecialFieldInfo set specialFieldName=@specialFieldName,specialCollegeNumber=@specialCollegeNumber,specialBirthDate=@specialBirthDate,specialMan=@specialMan,specialTelephone=@specialTelephone,specialMemo=@specialMemo where specialFieldNumber=@specialFieldNumber"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@specialFieldName", SqlDbType.VarChar), new SqlParameter("@specialCollegeNumber", SqlDbType.VarChar), new SqlParameter("@specialBirthDate", SqlDbType.DateTime), new SqlParameter("@specialMan", SqlDbType.VarChar), new SqlParameter("@specialTelephone", SqlDbType.VarChar), new SqlParameter("@specialMemo", SqlDbType.VarChar), new SqlParameter("@specialFieldNumber", SqlDbType.VarChar) }; /*为参数赋值*/ parm[0].Value = specialFieldInfo.specialFieldName; parm[1].Value = specialFieldInfo.specialCollegeNumber; parm[2].Value = specialFieldInfo.specialBirthDate; parm[3].Value = specialFieldInfo.specialMan; parm[4].Value = specialFieldInfo.specialTelephone; parm[5].Value = specialFieldInfo.specialMemo; parm[6].Value = specialFieldInfo.specialFieldNumber; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static bool AddRank(Model.BookType book) { string sql = "insert into CustomType(C_Number,C_Name,C_Amount,C_Rate) values(@U_Number,@U_Name,@U_Sex,@U_Tel)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Number", SqlDbType.VarChar), new SqlParameter("@U_Name", SqlDbType.VarChar, 50), new SqlParameter("@U_Sex", SqlDbType.Decimal), new SqlParameter("@U_Tel", SqlDbType.Decimal), }; /*给参数赋值*/ parm[0].Value = book.Number; parm[1].Value = book.Name; parm[2].Value = book.amount; parm[3].Value = book.rateA; foreach (SqlParameter p in parm) //没有对传入的数据作空值的处理 { if (p.Value == null) { p.Value = DBNull.Value; } } /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*更新学生信息实现*/ public static bool EditStudent_(ENTITY.Student_ student_) { string sql = "update Student_ set studentName=@studentName,sex=@sex,classInfo=@classInfo,birthday=@birthday,zhengzhimianmao=@zhengzhimianmao,telephone=@telephone,address=@address where studentNumber=@studentNumber"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@studentName", SqlDbType.VarChar), new SqlParameter("@sex", SqlDbType.VarChar), new SqlParameter("@classInfo", SqlDbType.VarChar), new SqlParameter("@birthday", SqlDbType.DateTime), new SqlParameter("@zhengzhimianmao", SqlDbType.VarChar), new SqlParameter("@telephone", SqlDbType.VarChar), new SqlParameter("@address", SqlDbType.VarChar), new SqlParameter("@studentNumber", SqlDbType.VarChar) }; /*为参数赋值*/ parm[0].Value = student_.studentName; parm[1].Value = student_.sex; parm[2].Value = student_.classInfo; parm[3].Value = student_.birthday; parm[4].Value = student_.zhengzhimianmao; parm[5].Value = student_.telephone; parm[6].Value = student_.address; parm[7].Value = student_.studentNumber; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static bool AddGrade2(int Grade, int Uid) //添加级别调整单 { string sql = "insert into U_Grade(U_No,U_Grade,U_Custom,U_Clerk,U_Note,U_LoginTime) values(@U_Number,@U_Adjust,@U_Custom,@U_ClerkType,@U_Note,getdate())"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Number", SqlDbType.Int), new SqlParameter("@U_Adjust", SqlDbType.Int), new SqlParameter("@U_Custom", SqlDbType.Int), new SqlParameter("@U_ClerkType", SqlDbType.Int), new SqlParameter("@U_Note", SqlDbType.NVarChar, 200) //new SqlParameter("@U_LoginTime",SqlDbType.DateTime) }; /*给参数赋值*/ parm[0].Value = 77; parm[1].Value = Grade; parm[2].Value = Uid; parm[3].Value = 1; parm[4].Value = "系统生成"; //parm[5].Value = DateTime.Now ; foreach (SqlParameter p in parm) //没有对传入的数据作空值的处理 { if (p.Value == null) { p.Value = DBNull.Value; } } /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/// <summary> /// 更改密保 /// </summary> /// <param name="type">密保类型</param> /// <param name="ask">密保回答</param> /// <param name="key">主键</param> /// <returns></returns> public bool UpdateU_PsdAnswer(int type, string ask, long key) { StringBuilder strSql = new StringBuilder(); strSql.Append("update U_UserInfo set "); strSql.Append(" U_PsdType= @U_PsdType,U_PsdAnswer=@U_PsdAnswer "); strSql.Append(" where U_Id=@U_Id "); SqlParameter[] parameters = { new SqlParameter("@U_Id", SqlDbType.Int, 4), new SqlParameter("@U_PsdType", SqlDbType.Int), new SqlParameter("@U_PsdAnswer", SqlDbType.VarChar, 50) }; parameters[0].Value = key; parameters[1].Value = type; parameters[2].Value = ask; int rows = DBHelp.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public static bool AddReward(Model.Reward book) //添加业绩核算单 { string sql = "insert into U_Reward(U_No,U_Count,U_Custom,U_Reward,U_Rate,U_LoginTime) values(@U_Number,@U_Adjust,@U_Custom,@U_Amount,@U_ClerkType,@U_LoginTime)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Number", SqlDbType.Int), new SqlParameter("@U_Adjust", SqlDbType.Decimal), new SqlParameter("@U_Custom", SqlDbType.Int), new SqlParameter("@U_Amount", SqlDbType.Decimal), new SqlParameter("@U_ClerkType", SqlDbType.NVarChar, 20), new SqlParameter("@U_LoginTime", SqlDbType.DateTime) }; /*给参数赋值*/ parm[0].Value = book.No; parm[1].Value = book.count; parm[2].Value = book.custom; parm[3].Value = book.reward; parm[4].Value = book.rate; parm[5].Value = book.publishDate; foreach (SqlParameter p in parm) //没有对传入的数据作空值的处理 { if (p.Value == null) { p.Value = DBNull.Value; } } /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static bool AddPerformance(Model.Adjust book) //添加业绩提交单 { string sql = "insert into U_Performance(U_No,U_Product,U_Custom,N_Number,U_Clerk,U_Note,U_LoginTime,U_Custom2) values(@U_Number,@U_Adjust,@U_Custom,@U_Amount,@U_ClerkType,@U_Note,@U_LoginTime,@U_Custom2)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Number", SqlDbType.Int), new SqlParameter("@U_Adjust", SqlDbType.Int), new SqlParameter("@U_Custom", SqlDbType.Int), new SqlParameter("@U_Amount", SqlDbType.Decimal), new SqlParameter("@U_ClerkType", SqlDbType.Int), new SqlParameter("@U_Note", SqlDbType.NVarChar, 200), new SqlParameter("@U_LoginTime", SqlDbType.DateTime), new SqlParameter("@U_Custom2", SqlDbType.NVarChar, 20) }; /*给参数赋值*/ parm[0].Value = book.No; parm[1].Value = book.product; parm[2].Value = book.custom; parm[3].Value = book.amount; parm[4].Value = book.clerk; parm[5].Value = book.note; parm[6].Value = book.publishDate; parm[7].Value = book.custom2; foreach (SqlParameter p in parm) //没有对传入的数据作空值的处理 { if (p.Value == null) { p.Value = DBNull.Value; } } /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*更新图书实现*/ public static bool EditBook(Model.Book book) { string sql = "update U_Custom set U_Name=@U_Name,U_Sex=@U_Sex,U_Tel=@U_Tel,U_Note=@U_Note,U_Bank=@U_Bank1,U_BankN=@U_Bank2,U_BankName=@U_Bank3 where U_Id=@U_Id"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Name", SqlDbType.VarChar), new SqlParameter("@U_Sex", SqlDbType.VarChar), new SqlParameter("@U_Tel", SqlDbType.VarChar), new SqlParameter("@U_Id", SqlDbType.Int), new SqlParameter("@U_Note", SqlDbType.VarChar, 200), new SqlParameter("@U_Bank1", SqlDbType.VarChar, 50), new SqlParameter("@U_Bank2", SqlDbType.VarChar, 50), new SqlParameter("@U_Bank3", SqlDbType.VarChar, 50) }; /*给参数赋值*/ parm[0].Value = book.Name; parm[1].Value = book.area; parm[2].Value = book.tele; parm[3].Value = book.barcode; parm[4].Value = book.note; parm[5].Value = book.bank; parm[6].Value = book.bankn; parm[7].Value = book.bankname; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public bool JurisdictionUpdate(int Dep, string Pos, int U_Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("update U_UserInfo set "); strSql.Append(" U_Position = @U_Position , "); strSql.Append(" U_DepType = @U_DepType "); strSql.Append(" where U_Id=@U_Id "); SqlParameter[] parameters = { new SqlParameter("@U_Id", SqlDbType.Int, 4), new SqlParameter("@U_Position", SqlDbType.VarChar, 20), new SqlParameter("@U_DepType", SqlDbType.Int, 4) }; parameters[0].Value = U_Id; parameters[1].Value = Pos; parameters[2].Value = Dep; int rows = DBHelp.ExecuteNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/*添加教师信息实现*/ public static bool AddTeacher(ENTITY.Teacher teacher) { string sql = "insert into Teacher(teacherNumber,teacherName,teacherPassword,teacherSex,teacherBirthday,teacherArriveDate,teacherCardNumber,teacherPhone,teacherPhoto,teacherAddress,teacherMemo) values(@teacherNumber,@teacherName,@teacherPassword,@teacherSex,@teacherBirthday,@teacherArriveDate,@teacherCardNumber,@teacherPhone,@teacherPhoto,@teacherAddress,@teacherMemo)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@teacherNumber", SqlDbType.VarChar), new SqlParameter("@teacherName", SqlDbType.VarChar), new SqlParameter("@teacherPassword", SqlDbType.VarChar), new SqlParameter("@teacherSex", SqlDbType.VarChar), new SqlParameter("@teacherBirthday", SqlDbType.DateTime), new SqlParameter("@teacherArriveDate", SqlDbType.DateTime), new SqlParameter("@teacherCardNumber", SqlDbType.VarChar), new SqlParameter("@teacherPhone", SqlDbType.VarChar), new SqlParameter("@teacherPhoto", SqlDbType.VarChar), new SqlParameter("@teacherAddress", SqlDbType.VarChar), new SqlParameter("@teacherMemo", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = teacher.teacherNumber; //教师编号 parm[1].Value = teacher.teacherName; //教师姓名 parm[2].Value = teacher.teacherPassword; //登录密码 parm[3].Value = teacher.teacherSex; //性别 parm[4].Value = teacher.teacherBirthday; //出生日期 parm[5].Value = teacher.teacherArriveDate; //入职日期 parm[6].Value = teacher.teacherCardNumber; //身份证号 parm[7].Value = teacher.teacherPhone; //联系电话 parm[8].Value = teacher.teacherPhoto; //教师照片 parm[9].Value = teacher.teacherAddress; //家庭地址 parm[10].Value = teacher.teacherMemo; //附加信息 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加班级信息实现*/ public static bool AddClassInfo(ENTITY.ClassInfo classInfo) { string sql = "insert into ClassInfo(classNumber,className,classSpecialFieldNumber,classBirthDate,classTeacherCharge,classTelephone,classMemo) values(@classNumber,@className,@classSpecialFieldNumber,@classBirthDate,@classTeacherCharge,@classTelephone,@classMemo)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@classNumber", SqlDbType.VarChar), new SqlParameter("@className", SqlDbType.VarChar), new SqlParameter("@classSpecialFieldNumber", SqlDbType.VarChar), new SqlParameter("@classBirthDate", SqlDbType.DateTime), new SqlParameter("@classTeacherCharge", SqlDbType.VarChar), new SqlParameter("@classTelephone", SqlDbType.VarChar), new SqlParameter("@classMemo", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = classInfo.classNumber; //班级编号 parm[1].Value = classInfo.className; //班级名称 parm[2].Value = classInfo.classSpecialFieldNumber; //所属专业 parm[3].Value = classInfo.classBirthDate; //成立日期 parm[4].Value = classInfo.classTeacherCharge; //班主任 parm[5].Value = classInfo.classTelephone; //联系电话 parm[6].Value = classInfo.classMemo; //附加信息 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*更新教师信息实现*/ public static bool EditTeacher(ENTITY.Teacher teacher) { string sql = "update Teacher set teacherName=@teacherName,teacherPassword=@teacherPassword,teacherSex=@teacherSex,teacherBirthday=@teacherBirthday,teacherArriveDate=@teacherArriveDate,teacherCardNumber=@teacherCardNumber,teacherPhone=@teacherPhone,teacherPhoto=@teacherPhoto,teacherAddress=@teacherAddress,teacherMemo=@teacherMemo where teacherNumber=@teacherNumber"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@teacherName", SqlDbType.VarChar), new SqlParameter("@teacherPassword", SqlDbType.VarChar), new SqlParameter("@teacherSex", SqlDbType.VarChar), new SqlParameter("@teacherBirthday", SqlDbType.DateTime), new SqlParameter("@teacherArriveDate", SqlDbType.DateTime), new SqlParameter("@teacherCardNumber", SqlDbType.VarChar), new SqlParameter("@teacherPhone", SqlDbType.VarChar), new SqlParameter("@teacherPhoto", SqlDbType.VarChar), new SqlParameter("@teacherAddress", SqlDbType.VarChar), new SqlParameter("@teacherMemo", SqlDbType.VarChar), new SqlParameter("@teacherNumber", SqlDbType.VarChar) }; /*为参数赋值*/ parm[0].Value = teacher.teacherName; parm[1].Value = teacher.teacherPassword; parm[2].Value = teacher.teacherSex; parm[3].Value = teacher.teacherBirthday; parm[4].Value = teacher.teacherArriveDate; parm[5].Value = teacher.teacherCardNumber; parm[6].Value = teacher.teacherPhone; parm[7].Value = teacher.teacherPhoto; parm[8].Value = teacher.teacherAddress; parm[9].Value = teacher.teacherMemo; parm[10].Value = teacher.teacherNumber; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加学生信息实现*/ public static bool AddStudent_(ENTITY.Student_ student_) { string sql = "insert into Student_(studentNumber,studentName,sex,classInfo,birthday,zhengzhimianmao,telephone,address) values(@studentNumber,@studentName,@sex,@classInfo,@birthday,@zhengzhimianmao,@telephone,@address)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@studentNumber", SqlDbType.VarChar), new SqlParameter("@studentName", SqlDbType.VarChar), new SqlParameter("@sex", SqlDbType.VarChar), new SqlParameter("@classInfo", SqlDbType.VarChar), new SqlParameter("@birthday", SqlDbType.DateTime), new SqlParameter("@zhengzhimianmao", SqlDbType.VarChar), new SqlParameter("@telephone", SqlDbType.VarChar), new SqlParameter("@address", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = student_.studentNumber; //学号 parm[1].Value = student_.studentName; //学生姓名 parm[2].Value = student_.sex; //性别 parm[3].Value = student_.classInfo; //所在班级 parm[4].Value = student_.birthday; //出生日期 parm[5].Value = student_.zhengzhimianmao; //政治面貌 parm[6].Value = student_.telephone; //联系电话 parm[7].Value = student_.address; //家庭地址 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static bool EditUsersInfo(ENTITY.CusUsers u1) { string sql = "update CusUsers set Customername=@Customername,customerpwd=@customerpwd,Realname=@Realname,CustomerSfz=@CustomerSfz,address=@address,telphone=@telphone,IsCusAdmin=@IsCusAdmin,CusType=@CusType where customerid=@customerid"; SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@customerid", SqlDbType.Int), new SqlParameter("@Customername", SqlDbType.VarChar), new SqlParameter("@customerpwd", SqlDbType.VarChar), new SqlParameter("@Realname", SqlDbType.VarChar), new SqlParameter("@CustomerSfz", SqlDbType.VarChar), new SqlParameter("@address", SqlDbType.NVarChar), new SqlParameter("@telphone", SqlDbType.VarChar), new SqlParameter("@IsCusAdmin", SqlDbType.Int), new SqlParameter("@CusType", SqlDbType.Int) }; parm[0].Value = u1.customerid; parm[1].Value = u1.Customername; parm[2].Value = u1.customerpwd; parm[3].Value = u1.Realname; parm[4].Value = u1.CustomerSfz; parm[5].Value = u1.address; parm[6].Value = u1.telphone; parm[7].Value = u1.IsCusAdmin; parm[8].Value = u1.CusType; return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static void CheckUserType(int id, int p) { string sql = "update CusUsers set CusType=" + p + " where customerid=@ID"; SqlParameter pa = new SqlParameter("@ID", SqlDbType.Int); pa.Value = id; DBHelp.ExecuteNonQuery(sql, pa); }
public static int Add(BookInfo book, int z) { if (z == 1) { cmdText = "insert into Cart(bookName,bookAuthor,ISBN,price,countIn,countOut,bookAbout,bookType,Image) select bookName,bookAuthor,ISBN,price,countIn,countOut,bookAbout,bookType,Image from BookInfo where bookName=N'" + book.BookName + "'"; } return(DBHelp.ExecuteNonQuery(cmdText)); }
///网站计数器 public static bool Counter(string tablename, string CNID) { string sql = "update TextNews set VisitedCount=VisitedCount+1 where TNID =" + Convert.ToInt32(CNID) + ""; if (tablename == "PicNews") { sql = "update PicNews set VisitedCount =VisitedCount+1 where PNID = " + Convert.ToInt32(CNID) + " "; } return((DBHelp.ExecuteNonQuery(sql, null) > 0) ? true : false); }
/*添加学期信息实现*/ public static bool AddTermInfo_(ENTITY.TermInfo_ termInfo_) { string sql = "insert into TermInfo_(termName) values(@termName)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@termName", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = termInfo_.termName; //学期名称 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static int Update(BookInfo book) { cmdText = "update BookInfo set bookName=@bookName,bookAuthor=@bookAuthor,price=@price,countIn=@countIn,countOut=@countOut,bookAbout=@bookAbout,bookType=@bookType where ISBN=@ISBN"; SqlParameter[] values = new SqlParameter[8]; values[0] = new SqlParameter("bookName", book.BookName); values[1] = new SqlParameter("bookAuthor", book.BookAuthor); values[2] = new SqlParameter("price", book.Price); values[3] = new SqlParameter("countIn", book.CountIn); values[4] = new SqlParameter("countOut", book.CountOut); values[5] = new SqlParameter("bookAbout", book.BookAbout); values[6] = new SqlParameter("bookType", book.BookType); values[7] = new SqlParameter("ISBN", book.isbn); return(DBHelp.ExecuteNonQuery(cmdText, values)); }
public static int Insert(UsrInfo user) { String cmdText = "insert into UsrInfo(usrName,usrPwd,usrEmail) values(@usrName,@usrPwd,@usrEmail)"; SqlParameter[] values = new SqlParameter[3]; values[0] = new SqlParameter("usrName", user.UsrName); values[1] = new SqlParameter("usrPwd", user.UsrPwd); values[2] = new SqlParameter("usrEmail", user.UsrEmail); int result = DBHelp.ExecuteNonQuery(cmdText, values); return(result); }
/*更新学期信息实现*/ public static bool EditTermInfo_(ENTITY.TermInfo_ termInfo_) { string sql = "update TermInfo_ set termName=@termName where termId=@termId"; /*构建sql参数信息*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@termName", SqlDbType.VarChar), new SqlParameter("@termId", SqlDbType.Int) }; /*为参数赋值*/ parm[0].Value = termInfo_.termName; parm[1].Value = termInfo_.termId; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加图书实现*/ public static bool AddBook(Model.Book book) { string sql = "insert into U_Custom(U_Name,U_RelName,U_Email,U_QQ,U_MoveTele,U_Telephone,U_WeiXin,U_PsdType,U_AreaType,U_ClerkType,U_Address,U_Position,U_Note,U_Image,U_LoginTime) values(@U_Name,@U_RelName,@U_Email,@U_QQ,@U_MoveTele,@U_Telephone,@U_WeiXin,@U_PsdType,@U_AreaType,@U_ClerkType,@U_Address,@U_Position,@U_Note,@U_Image,@U_LoginTime)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Name", SqlDbType.VarChar), new SqlParameter("@U_RelName", SqlDbType.VarChar, 50), new SqlParameter("@U_Email", SqlDbType.VarChar, 50), new SqlParameter("@U_QQ", SqlDbType.VarChar, 50), new SqlParameter("@U_MoveTele", SqlDbType.VarChar, 50), new SqlParameter("@U_Telephone", SqlDbType.VarChar, 50), new SqlParameter("@U_WeiXin", SqlDbType.VarChar, 50), new SqlParameter("@U_PsdType", SqlDbType.Int), new SqlParameter("@U_AreaType", SqlDbType.Int), new SqlParameter("@U_ClerkType", SqlDbType.Int), new SqlParameter("@U_Address", SqlDbType.VarChar, 50), new SqlParameter("@U_Position", SqlDbType.VarChar, 50), new SqlParameter("@U_Note", SqlDbType.NVarChar, 200), new SqlParameter("@U_Image", SqlDbType.Image), new SqlParameter("@U_LoginTime", SqlDbType.DateTime) }; /*给参数赋值*/ parm[0].Value = book.bookName; parm[1].Value = book.Name; parm[2].Value = book.email; parm[3].Value = book.qq; parm[4].Value = book.move; parm[5].Value = book.tele; parm[6].Value = book.weixin; parm[7].Value = book.bookType; parm[8].Value = book.area; parm[9].Value = book.clerk; parm[10].Value = book.address; parm[11].Value = book.www; parm[12].Value = book.note; parm[13].Value = book.bookPhoto; parm[14].Value = book.publishDate; foreach (SqlParameter p in parm) //没有对传入的数据作空值的处理 { if (p.Value == null) { p.Value = DBNull.Value; } } /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/*添加选课信息实现*/ public static bool AddStudentSelectCourseInfo(ENTITY.StudentSelectCourseInfo studentSelectCourseInfo) { string sql = "insert into StudentSelectCourseInfo(studentNumber,courseNumber) values(@studentNumber,@courseNumber)"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@studentNumber", SqlDbType.VarChar), new SqlParameter("@courseNumber", SqlDbType.VarChar) }; /*给参数赋值*/ parm[0].Value = studentSelectCourseInfo.studentNumber; //学生对象 parm[1].Value = studentSelectCourseInfo.courseNumber; //课程对象 /*执行sql进行添加*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
public static bool AddGrade2(Model.Adjust book) { string sql = "update U_Custom set U_Grade=@U_Adjust where U_Id=@U_Custom"; /*构建sql参数*/ SqlParameter[] parm = new SqlParameter[] { new SqlParameter("@U_Adjust", SqlDbType.Int), new SqlParameter("@U_Custom", SqlDbType.Int), }; /*给参数赋值*/ parm[0].Value = book.product; parm[1].Value = book.custom; /*执行更新*/ return((DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false); }
/// <summary> /// 删除一条数据 /// </summary> public bool DeleteList(string U_Idlist) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from U_UserInfo "); strSql.Append(" where U_Id in (" + U_Idlist + ") "); int rows = DBHelp.ExecuteNonQuery(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }