Esempio n. 1
0
 public void GetPublishedCategoriesFromDb()
 {
     SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["globaldb"].ConnectionString);
     string q1 = "SELECT * FROM f_category where Published=1 AND ForumId=" + this.ForumId;
     SqlCommand com1 = new SqlCommand(q1, con1);
     con1.Open();
     SqlDataReader rdr = com1.ExecuteReader();
     ForumCategory cat;
     while (rdr.Read())
     {
         cat = new ForumCategory();
         cat.CategoryId = Convert.ToInt32(rdr["CategoryId"]);
         cat.CategoryTitle = rdr["CategoryTitle"].ToString();
         cat.SectionCount = Convert.ToInt32(rdr["SectionCount"]);
         cat.CreatorId = Convert.ToInt32(rdr["CreatorId"]);
         if (!(rdr["DateCreated"] == DBNull.Value))
             cat.DateCreated = Convert.ToDateTime(rdr["DateCreated"]);
         if (!(rdr["DateModified"] == DBNull.Value))
             cat.DateModified = Convert.ToDateTime(rdr["DateModified"]);
         cat.ForumId = this.ForumId;
         cat.published = 1;
         if (!(rdr["DatePublished"] == DBNull.Value))
             cat.DatePublished = Convert.ToDateTime(rdr["DatePublished"]);
         cat.GetPublishedSectionsFromDb();
         CategoryList.Add(cat);
     }
     con1.Close();
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     thread = 1;//starting threads
     threads = new List<ForumThread>();
     category = Request.QueryString["category"].ToString();
     SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["globaldb"].ConnectionString);
     string q1 = "select * from f_category where CategoryTitle='" + category + "' and ForumId=" + Session["forumid"];
     SqlCommand com1 = new SqlCommand(q1, con1);
     SqlDataReader rdr;
     cat = new ForumCategory();
     con1.Open();
     rdr = com1.ExecuteReader();
     while (rdr.Read())
     {
         cat.CategoryId = Convert.ToInt32(rdr["CategoryId"]);
         cat.CategoryTitle = rdr["CategoryTitle"].ToString();
         cat.SectionCount = Convert.ToInt32(rdr["SectionCount"]);
         cat.CreatorId = Convert.ToInt32(rdr["CreatorId"]);
         if (!(rdr["DateCreated"] == DBNull.Value))
             cat.DateCreated = Convert.ToDateTime(rdr["DateCreated"]);
         if (!(rdr["DateModified"] == DBNull.Value))
             cat.DateModified = Convert.ToDateTime(rdr["DateModified"]);
         cat.ForumId = Convert.ToInt32(Session["forumid"]);
         cat.published = 1;
         if (!(rdr["DatePublished"] == DBNull.Value))
             cat.DatePublished = Convert.ToDateTime(rdr["DatePublished"]);
     }
     con1.Close();
     cat.GetPublishedSectionsFromDb();
 }
Esempio n. 3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     ForumCategory category;
     int published;
     if (drpPublish1.SelectedIndex == 0)
         published = 1;
     else
         published = 0;
     //Session["userid"] = 1;
     //Session["forumid"] = 1;
     if(!string.IsNullOrEmpty(txtDesc1.Text))
         category = new ForumCategory(txtTitle1.Text,Convert.ToInt32(Session["userid"]),published,Convert.ToInt32(Session["forumid"]),txtDesc1.Text);
     else
         category = new ForumCategory(txtTitle1.Text, Convert.ToInt32(Session["userid"]), published, Convert.ToInt32(Session["forumid"]));
     category.CreateCategoryintoDb();
 }
Esempio n. 4
0
        public void GetPublishedCategoriesFromDb()
        {
            SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["globaldb"].ConnectionString);
            string        q1   = "SELECT * FROM f_category where Published=1 AND ForumId=" + this.ForumId;
            SqlCommand    com1 = new SqlCommand(q1, con1);

            con1.Open();
            SqlDataReader rdr = com1.ExecuteReader();
            ForumCategory cat;

            while (rdr.Read())
            {
                cat               = new ForumCategory();
                cat.CategoryId    = Convert.ToInt32(rdr["CategoryId"]);
                cat.CategoryTitle = rdr["CategoryTitle"].ToString();
                cat.SectionCount  = Convert.ToInt32(rdr["SectionCount"]);
                cat.CreatorId     = Convert.ToInt32(rdr["CreatorId"]);
                if (!(rdr["DateCreated"] == DBNull.Value))
                {
                    cat.DateCreated = Convert.ToDateTime(rdr["DateCreated"]);
                }
                if (!(rdr["DateModified"] == DBNull.Value))
                {
                    cat.DateModified = Convert.ToDateTime(rdr["DateModified"]);
                }
                cat.ForumId   = this.ForumId;
                cat.published = 1;
                if (!(rdr["DatePublished"] == DBNull.Value))
                {
                    cat.DatePublished = Convert.ToDateTime(rdr["DatePublished"]);
                }
                cat.GetPublishedSectionsFromDb();
                CategoryList.Add(cat);
            }
            con1.Close();
        }