예제 #1
0
파일: Database.cs 프로젝트: higty/Takenoko
        private void SetProperty(DBlogRecord record, SqlDataReader reader)
        {
            var r  = record;
            var dr = reader;

            r.BlogCD     = (Guid)dr["BlogCD"];
            r.Title      = dr["Title"].ToString();
            r.CreateTime = (DateTimeOffset)dr["CreateTime"];
            r.UserCD     = (Guid)dr["UserCD"];
            r.BdoyText   = dr["BodyText"].ToString();
        }
예제 #2
0
파일: Database.cs 프로젝트: higty/Takenoko
        public List <DBlogRecord> DBlog_List_Get()
        {
            var l = new List <DBlogRecord>();

            using (var cn = new SqlConnection(this.ConnectionString))
            {
                var cm = new SqlCommand("select * from DBlog");
                cm.Connection = cn;

                cn.Open();
                var dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    var r = new DBlogRecord();
                    this.SetProperty(r, dr);
                    l.Add(r);
                }
            }
            return(l);
        }
예제 #3
0
파일: Database.cs 프로젝트: higty/Takenoko
        public List <DBlogRecord> DBlog_List_Get_By_Title(String title)
        {
            var l = new List <DBlogRecord>();

            using (var cn = new SqlConnection(this.ConnectionString))
            {
                var sql = String.Format("select * from DBlog where Title = '{0}'", title);
                var cm  = new SqlCommand(sql);
                cm.Connection = cn;

                cn.Open();
                var dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    var r = new DBlogRecord();
                    this.SetProperty(r, dr);
                    l.Add(r);
                }
            }
            return(l);
        }
예제 #4
0
파일: Database.cs 프로젝트: higty/Takenoko
        public List <DBlogRecord> DBlog_List_Get_By_Date(DateTime date)
        {
            var l = new List <DBlogRecord>();

            using (var cn = new SqlConnection(this.ConnectionString))
            {
                var sql = String.Format("select * from DBlog where '{0}' <= CreateTime and CreateTime < '{1}'"
                                        , date.ToString("yyyy/MM/dd 00:00"), date.AddDays(1).ToString("yyyy/MM/dd 00:00"));
                var cm = new SqlCommand(sql);
                cm.Connection = cn;

                cn.Open();
                var dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    var r = new DBlogRecord();
                    this.SetProperty(r, dr);
                    l.Add(r);
                }
            }
            return(l);
        }