Example #1
0
        public int SaveFile(SFile f)
        {
            string sql = "insert into userfile(fname,fcontent,fcno,funo) values('" + f.Fname + "','" + f.Fcontent
                         + "','" + f.Fcno + "','" + f.Funo + "')";

            return(SQLOperate.ExecuteSql(sql));
        }
Example #2
0
        public int UpdateInfo(User u)
        {
            string sql = "update wdjuser set upass='******',unikename='" + u.Unikename + "'";

            return(SQLOperate.ExecuteSql(sql));
        }
Example #3
0
        public MyFile SFileToMyFile(SFile sf, string username)
        {
            string sql      = "select * from cate where cno = '" + sf.Fcno + "'";
            string cateName = SQLOperate.QueryTable(sql).Rows[0][2].ToString().Trim();

            MyFile mf = new MyFile();

            mf.Path    = "D:\\WdjNote\\" + username + "\\" + cateName;
            mf.Name    = sf.Fname.Trim() + ".txt";
            mf.Content = sf.Fcontent.Trim();
            return(mf);
        }
Example #4
0
        public User FindUserByUsername(string name)
        {
            string    sql = "select * from wdjuser where uname = '" + name + "'";
            DataTable dt  = SQLOperate.QueryTable(sql);

            User u = null;

            if (dt.Rows.Count > 0)
            {
                u = new User(Convert.ToInt32(dt.Rows[0][0].ToString()),
                             dt.Rows[0][1].ToString(), dt.Rows[0][3].ToString());
                u.Upass = dt.Rows[0][2].ToString();
            }

            return(u);
        }
Example #5
0
        public List <Category> GetCategory(int uno)
        {
            string    sql = "select * from cate where cuno = " + uno;
            DataTable dt  = SQLOperate.QueryTable(sql);

            List <Category> clist = new List <Category>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Category c = new Category(Convert.ToInt32(dt.Rows[i][0].ToString()),
                                          Convert.ToInt32(dt.Rows[i][1].ToString()),
                                          dt.Rows[i][2].ToString().Trim());
                clist.Add(c);
            }

            return(clist);
        }
Example #6
0
        public SFile OpenFile(int fno)
        {
            string    sql = "select * from userfile where fno = " + fno;
            DataTable dt  = SQLOperate.QueryTable(sql);

            SFile sf = null;

            if (dt.Rows.Count > 0)
            {
                sf = new SFile(Convert.ToInt32(dt.Rows[0][0].ToString()),
                               dt.Rows[0][1].ToString().Trim(), dt.Rows[0][2].ToString().Trim(),
                               Convert.ToInt32(dt.Rows[0][3].ToString()),
                               Convert.ToInt32(dt.Rows[0][4].ToString()));
            }

            return(sf);
        }
Example #7
0
        public List <SFile> ReadFileByCno(int cno, int uno)
        {
            string    sql = "select * from userfile where fcno='" + cno + "'and funo='" + uno + "'";
            DataTable dt  = SQLOperate.QueryTable(sql);

            List <SFile> sfList = new List <SFile>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                SFile sf = new SFile(Convert.ToInt32(dt.Rows[i][0].ToString()),
                                     dt.Rows[i][1].ToString().Trim(), dt.Rows[i][2].ToString().Trim(),
                                     Convert.ToInt32(dt.Rows[i][3].ToString()),
                                     Convert.ToInt32(dt.Rows[i][4].ToString()));
                sfList.Add(sf);
            }

            return(sfList);
        }
Example #8
0
        public User Regist(string username, string password, string nickname)
        {
            User u = FindUserByUsername(username);

            if (u != null)//用户名已被使用
            {
                return(null);
            }
            else
            {
                string sql = "insert into wdjuser(uname,upass,unikename) values('" + username + "','" + password
                             + "','" + nickname + "')";
                SQLOperate.ExecuteSql(sql);
                u = FindUserByUsername(username);
                if (u != null)
                {
                    u.Upass = "";
                }
                return(u);
            }
        }
Example #9
0
        public void DeleteCategory(int cno)
        {
            string sql = "delete cate where cno = " + cno;

            SQLOperate.ExecuteSql(sql);
        }
Example #10
0
        public void AddCategory(int uno, string name)
        {
            string sql = "insert into cate(cuno,cname) values('" + uno + "','" + name + "')";

            SQLOperate.ExecuteSql(sql);
        }
Example #11
0
        public int DeleteFile(int fno)
        {
            string sql = "delete userfile where fno = '" + fno + "'";

            return(SQLOperate.ExecuteSql(sql));
        }