コード例 #1
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);
        }
コード例 #2
0
ファイル: UserOperateImpl.cs プロジェクト: war11393/WdjNote
        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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }