Exemple #1
0
 public bool update <T>(T a)
 {
     try
     {
         str = DBOperate.sqlUpdtae(a);
         return(sql.ExecSql(str));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #2
0
 public bool delete(CourseDetail c)
 {
     try
     {
         str = DBOperate.sqlDelete(c);
         return(sql.ExecSql(str));
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public bool function(Functions f)
        {
            str = "select * from Functions where no='" + f.no + "' and [type]='" + f.type + "'";
            DataTable dd = sql.FillDt(str);

            if (dd != null)
            {
                if (dd.Rows.Count > 0)
                {
                    return(sql.ExecSql("delete from Functions where no='" + f.no + "' and [type]='" + f.type + "'"));
                }
            }
            return(c.insert(f));
        }
        public bool delete(string _classroom_id)//(string _build, string _name, string _people, string _manager, string _descride)
        {
            string str = "delete from classroom where classroom_id='" + _classroom_id + "'";
            SqlDB  db  = new SqlDB();

            db.ExecSql(str);
            return(true);
        }
Exemple #5
0
        public void delete(string whole)
        {
            string[] Sum = whole.Split('|');
            string   sql = "delete from CourseBuild where Building_Id='" + Sum[1] + "' AND Department='" + Sum[0] + "' AND Garde='" + Sum[6] + "' AND Name='" + Sum[2] + "' AND Week='" + Sum[5] + "' AND Weekday='" + Sum[8] + "' AND Section='" + Sum[9] + "' AND Teacher='" + Sum[4] + "' AND Course='" + Sum[3] + "' AND Class='" + Sum[7] + "' AND Year='" + Sum[10] + "' AND Term='" + Sum[11] + "'";
            SqlDB    db  = new SqlDB();

            db.ExecSql(sql);
        }
        public bool modify(string _build, string _name, string _classroom_id, string _people, string _manager, string _descride)
        {
            string str = "update Classroom set Building_id='" + _build + "',Name='" + _name + "',classroom_id='" + _classroom_id + "',People='" + _people + "',Manager='" + _manager + "',Descride='" + _descride + "'where classroom_id='" + _classroom_id + "'";
            SqlDB  db  = new SqlDB();

            db.ExecSql(str);
            return(true);
        }
        public bool add(string build, string name, string classroom_id, string people, string manager, string descride)
        {
            string str = "insert into classroom(classroom_id,building_id,name,people,manager,descride)values(" + "'" + classroom_id + "','" + build + "','" + name + "','" + people + "','" + manager + "','" + descride + "')";
            SqlDB  db  = new SqlDB();

            db.ExecSql(str);
            return(true);
        }
Exemple #8
0
        public bool Addteacher(string id, string name, string department, string major)
        {
            SqlDB db = new SqlDB();

            if (db.ExecSql("insert into teacher(id,TeacherName,Department,Major) values('" + id + "','" + name + "','" + department + "','" + major + "')"))
            {
                return(true);
            }
            return(false);
        }
Exemple #9
0
        public bool ChangeTea(int id, string Teachername, string department, string major)
        {
            SqlDB  db     = new SqlDB();
            string strsql = "update Teacher set TeacherName = '" + Teachername + "',Department = '" + department + "', Major ='" + major + "' where id = '" + id + "'";

            if (db.ExecSql(strsql))
            {
                return(true);
            }
            return(false);
        }
Exemple #10
0
        public bool Deleteteacher(string id)
        {
            SqlDB  db     = new SqlDB();
            string strsql = "delete from teacher where id='" + id + "'";

            if (db.ExecSql(strsql))
            {
                return(true);
            }
            return(false);
        }
Exemple #11
0
        public bool Deleteadmin(string name)
        {
            SqlDB  db     = new SqlDB();
            string strsql = "delete from Users where UsersName='" + name + "'";

            if (db.ExecSql(strsql))
            {
                return(true);
            }
            return(false);
        }
Exemple #12
0
        public bool Addadmin(string id, string name, string pwd, string role)
        {
            SqlDB  db     = new SqlDB();
            string Md5str = GetMd5Hash(pwd);
            string str    = "insert into Users(id,UsersName,PassWord,role) values('" + id + "','" + name + "','" + Md5str + "','" + role + "')";

            if (db.ExecSql(str))
            {
                return(true);
            }
            return(false);
        }
Exemple #13
0
        public bool ChangeAdmin(int id, string name, string pwd)
        {
            SqlDB  db     = new SqlDB();
            string Md5str = GetMd5Hash(pwd);
            string strsql = "update Users set UsersName = '" + name + "',PassWord = '******' where id = '" + id + "'";

            if (db.ExecSql(strsql))
            {
                return(true);
            }
            return(false);
        }
        public bool AddClass(Basic_Information basic)
        {
            string sql = "insert into Basic_Information(Garde,ClassId,Class,Department) values(" +
                         basic.Garde + ",'" + Convert.ToInt32(basic.ClassId) + "','" + basic.Class + "','" + basic.Department + "')";

            return(db.ExecSql(sql));
        }
Exemple #15
0
        public bool Insert(string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8, string s9, string s10, string s11, string s12)
        {
            string sql = "INSERT INTO CourseBuild(Building_Id,Department,Garde,Name,Week,Weekday,Section,Teacher,Course,Class,Year,Term,reason) values ('" + s1 + "','" + s2 + "','" + s3 + "','" + s4 + "','" + s5 + "','" + s6 + "','" + s7 + "','" + s8 + "','" + s9 + "','" + s10 + "','" + s11 + "','" + s12 + "' ,'" + " ')";
            SqlDB  db  = new SqlDB();

            if (db.ExecSql(sql))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #16
0
 //重置任务完成情况
 public bool reset()
 {
     try
     {
         str = "update Users set remark1='未完成'";
         return(sql.ExecSql(str));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #17
0
        /// <summary>
        /// 将课表数据插入数据库
        /// </summary>
        /// <param name="course"></param>
        /// <returns></returns>
        public bool Insert(List <CourseBuild> course)
        {
            string sql = "INSERT INTO CourseBuild(Building_Id,Department,Garde,Name,Week,Weekday,Section,Teacher,Course,Class,Year,Term,reason)";

            for (int i = 0; i < course.Count - 1; i++)
            {
                sql += "select " + course[i].Building_Id + ",'" + course[i].Department + "'," + "'" + course[i].Garde + "'," + "'" + course[i].Name + "'," + "'" + course[i].Week + "'," + "'" + course[i].Weekday + "'," + "'" + course[i].Section + "'," + "'" + course[i].Teacher + "'," + "'" + course[i].Course + "'," + "'" + course[i].Class + "'," + "'" + course[i].Year + "'," + "'" + course[i].Term + "'," + "'" + course[i].reason + "' union all ";
            }
            sql += "select " + course[course.Count - 1].Building_Id + ",'" + course[course.Count - 1].Department + "'," + "'" + course[course.Count - 1].Garde + "'," + "'" + course[course.Count - 1].Name + "'," + "'" + course[course.Count - 1].Week + "'," + "'" + course[course.Count - 1].Weekday + "'," + "'" + course[course.Count - 1].Section + "'," + "'" + course[course.Count - 1].Teacher + "'," + "'" + course[course.Count - 1].Course + "'," + "'" + course[course.Count - 1].Class + "'," + "'" + course[course.Count - 1].Year + "'," + "'" + course[course.Count - 1].Term + "'," + "'" + course[course.Count - 1].reason + "'";
            SqlDB db = new SqlDB();

            if (db.ExecSql(sql))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public bool InsertApply()
 {
     //插入活动
     try
     {
         string sqlit = "INSERT INTO CourseBuild(Building_Id,Department,Garde,Name,Week,Weekday,Section,Teacher,Course,Class,Year,Term,reason) Values ('" + B_ID + "','" + Department + "','" + Garde + "','" + CM + "','" + WK + "','" + WY + "','" + Section + "','" + Teacher + "','" + Course + "','" + Class + "','" + Year + "','" + Term + "','" + Reason + "')";
         if (db.ExecSql(sqlit))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemple #19
0
 /// <summary>
 /// 设置是否可用
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool state(string id)
 {
     try
     {
         str = "select remark1 from LabInfo where id=" + id + "";
         DataTable dt = sql.FillDt(str);
         if (dt.Rows[0][0].ToString() == "1")
         {
             str = "update LabInfo set remark1='0' where id=" + id + "";
         }
         else
         {
             str = "update LabInfo set remark1='1' where id=" + id + "";
         }
         return(sql.ExecSql(str));
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public bool BackPwd(UsersModel user)//修改密码 后更新
        {
            string sql = "update Users set PassWord='******' where id='" + user.id + "' and UsersName='" + user.UsersName + "'";

            return(sqlDB.ExecSql(sql));
        }