예제 #1
0
    public void LoadThreadDetails(int threadID)
    {
        Thread thread = new Thread();

        using (ThreadDataContext tdc = new ThreadDataContext())
        {
            thread = (from t in tdc.Threads
                      where t.ThreadID == threadID
                      select t).SingleOrDefault();
        }

        if (thread == null)
        {
            Response.Redirect("Thread.aspx?threadid=" + threadID.ToString() + "&page=1");
        }
        else
        {
            lnkThreadList.NavigateUrl = "~/Threads/ThreadList.aspx?categoryid=" + thread.ThreadCategoryID.ToString();
            lnkThreadList.Text        = DALThread.GetCategoryName(thread.ThreadCategoryID.Value);
            lnkThread.NavigateUrl     = "~/Threads/Thread.aspx?threadid=" + threadID.ToString() + "&page=1";
            lnkThread.Text            = thread.Title;
            lnkThreadEdit.NavigateUrl = "~/Threads/ThreadEdit.aspx?threadid=" + threadID.ToString();

            txtTitle.Text               = thread.Title;
            txtDescription.Text         = thread.Description;
            ddlCategory.SelectedValue   = thread.ThreadCategoryID.Value.ToString();
            ddlType.SelectedValue       = thread.ThreadTypeID.Value.ToString();
            chkPostAnnouncement.Checked = thread.IsPosted.Value;
            chkIsAllowReply.Checked     = thread.IsAllowedReply.Value;
            chkHideThread.Checked       = !thread.IsActive.Value;
            ckeContents.Text            = thread.Contents;
            chkIsPrivate.Checked        = thread.IsPrivate.Value;
            divPrivateList.Visible      = chkIsPrivate.Checked;
        }
    }
예제 #2
0
 protected void LoadDDl()
 {
     ddlCategory.DataSource     = DALThread.GetThreadCategory();
     ddlCategory.DataValueField = "pValue";
     ddlCategory.DataTextField  = "pText";
     ddlCategory.DataBind();
 }
예제 #3
0
 protected void btnRemove_Click(object sender, EventArgs e)
 {
     foreach (ListItem itm in cblThreadMembers.Items)
     {
         if (itm.Selected)
         {
             DALThread.DeleteThreadPrivateUser(hdnThreadID.Value.ToInt(), itm.Value);
         }
     }
     this.LoadPrivateUsers(hdnThreadID.Value.ToInt());
 }
예제 #4
0
    private void InitializeFields()
    {
        int    threadCategoryID = Request.QueryString["categoryid"].ToInt();
        string username         = Request.Cookies["Speedo"]["UserName"];

        ckeContents.config.toolbar = new object[]
        {
            new object[] { "Cut", "Copy", "Paste", "PasteText", "-", "SpellChecker" },
            new object[] { "Undo", "Redo", "-", "-" },
            new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" },
            new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent", "Blockquote", "CreateDiv" },
            new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" },
            new object[] { "Link", "Unlink", "Anchor" },
            new object[] { "Image", "Table", "HorizontalRule", "Smiley", "SpecialChar" },
            new object[] { "Styles", "Format", "Font", "FontSize", "TextColor" }
        };

        trPostHome.Visible = DALThread.IsAllowedPostHome(username);

        using (ThreadDataContext tdc = new ThreadDataContext())
        {
            //var qCategory = (from tc in tdc.ThreadCategories
            //                 where tc.IsActive==true
            //                 orderby tc.Name
            //                 select new { ThreadCategoryID = tc.ThreadCategoryID, Name = tc.Name }).ToList();
            //ddlCategory.DataSource = qCategory;
            //ddlCategory.DataValueField = "ThreadCategoryID";
            //ddlCategory.DataTextField = "Name";
            //ddlCategory.DataBind();

            //ddlCategory.SelectedValue = threadCategoryID.ToString();

            ddlCategory.DataSource     = clsThreadCategoryUser.GetDSLThreadCategoryPerUser(Request.Cookies["Speedo"]["UserName"]);
            ddlCategory.DataValueField = "ThreadCategoryID";
            ddlCategory.DataTextField  = "Name";
            ddlCategory.DataBind();

            var qType = (from tt in tdc.ThreadTypes
                         where tt.IsPrivate == false ||
                         (from ttu in tdc.ThreadTypesUsers
                          where ttu.Username == username
                          select ttu.ThreadTypeUserID).Count() > 0
                         orderby tt.Title
                         select new { ThreadTypeID = tt.ThreadTypeID, Name = tt.Title }).ToList();
            ddlType.DataSource     = qType;
            ddlType.DataValueField = "ThreadTypeID";
            ddlType.DataTextField  = "Name";
            ddlType.DataBind();
        }
    }
예제 #5
0
    ////////////////////////////////
    ///////// Page Events  /////////
    ////////////////////////////////

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["categoryid"] == null)
        {
            Response.Redirect("~/Threads/Forums.aspx");
        }

        int threadCategoryID = Request.QueryString["categoryid"].ToInt();

        lnkThreadList.NavigateUrl = "~/Threads/ThreadList.aspx?categoryid=" + threadCategoryID.ToString();
        lnkThreadList.Text        = DALThread.GetCategoryName(threadCategoryID);
        lnkThreadNew.NavigateUrl  = "~/Threads/ThreadNew.aspx?categoryid=" + threadCategoryID.ToString();

        if (!Page.IsPostBack)
        {
            this.InitializeFields();
            this.LoadPrivateUsers();
        }
    }
예제 #6
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        Thread thread = new Thread()
        {
            ThreadID         = hdnThreadID.Value.ToInt(),
            ThreadCategoryID = ddlCategory.SelectedValue.ToInt(),
            ThreadTypeID     = ddlType.SelectedValue.ToInt(),
            Title            = txtTitle.Text,
            Description      = txtDescription.Text,
            Contents         = ckeContents.Text,
            IsAllowedReply   = chkIsAllowReply.Checked,
            IsPosted         = chkPostAnnouncement.Checked,
            IsActive         = !chkHideThread.Checked,
            IsSticky         = false
        };

        if (DALThread.UpdateThread(thread) > 0)
        {
            Response.Redirect("Thread.aspx?threadid=" + hdnThreadID.Value + "&page=1");
        }
    }
예제 #7
0
    protected void LoadFilter()
    {
        string strWrite = "";

        lblQueryResult.Visible = false;
        DateTime dtStartDate = new DateTime();
        DateTime dtEndDate   = new DateTime();
        string   strCategory = "";
        string   strKeyword  = "";

        if (!string.IsNullOrEmpty(Request.QueryString["DateStart"]))
        {
            dtStartDate = DateTime.ParseExact(Request.QueryString["DateStart"].ToString(), "MMMddyyyy", null);
        }
        else
        {
            dtStartDate = DateTime.Parse("1/1/1990");
        }

        if (!string.IsNullOrEmpty(Request.QueryString["DateEnd"]))
        {
            dtEndDate = DateTime.ParseExact(Request.QueryString["DateEnd"].ToString(), "MMMddyyyy", null);
        }
        else
        {
            dtEndDate = DateTime.Now;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["Category"]))
        {
            strCategory = Request.QueryString["Category"].ToString();
        }
        else
        {
            strCategory = "ALL";
        }

        if (!string.IsNullOrEmpty(Request.QueryString["Keyword"]))
        {
            strKeyword = Request.QueryString["Keyword"].ToString();
        }



        using (clsPagination objPagination = new clsPagination())
        {
            //objPagination.CurrentPage = string.IsNullOrEmpty(Request.QueryString["Page"]) == true ? 1 : Request.QueryString["Page"].ToInt();
            objPagination.CurrentPage = ddlPages.SelectedValue.ToInt();
            objPagination.PagePerForm = 10;
            objPagination.TotalCount  = DALThread.GetThreadArchiveCount(strCategory, DateTime.Parse(dtStartDate.ToShortDateString() + " 1:00 AM"), DateTime.Parse(dtEndDate.ToShortDateString() + " 11:59 PM"), strKeyword);

            DataTable tblResult = DALThread.GetThreadArchiveArchives(strCategory, DateTime.Parse(dtStartDate.ToShortDateString() + " 1:00 AM"), DateTime.Parse(dtEndDate.ToShortDateString() + " 11:59 PM"), objPagination.PagePerForm, objPagination.Offset(), strKeyword);

            if (tblResult.Rows.Count > 0)
            {
                lblQueryResult.Visible = true;
            }

            if (tblResult.Rows.Count == 0)
            {
                strWrite = strWrite + "<tr><td class='GridRows'>No record found</td></tr>";
            }
            else
            {
                strWrite = strWrite + "<tr><td class='GridRows'>[ About " + tblResult.Rows.Count + " results found ]</td></tr>";
            }

            foreach (DataRow drw in tblResult.Rows)
            {
                strWrite = strWrite + "<tr>" +
                           "<td class='GridRows'>" +
                           "<a href='Thread.aspx?threadid=" + drw["ThreadID"].ToString() + "&page=1'  style='font-size:medium;'>" + DALThread.GetTitle(drw["ThreadID"].ToString().ToInt()) + "</a><br/>" +
                           "<font style='font-size: x-small; font-weight: normal; font-style: italic'>Posted By:&nbsp;<a href='../../../Userpage/UserPage.aspx?username="******"PostedBy"] + "'>" + clsEmployee.GetName(drw["PostedBy"].ToString()) + "</a> (" + Convert.ToDateTime(drw["PostedDate"].ToString()).ToString("MMM dd, yyyy hh:mm tt") + ")<br/>" +
                           DALThread.GetDescription(drw["ThreadID"].ToString().ToInt()) +
                           "</td>" +
                           "</tr>";
            }
            lblQueryResult.Text = strWrite;
        }
    }
예제 #8
0
    protected void LoadPage()
    {
        string   strWrite    = "";
        DateTime dtStartDate = new DateTime();
        DateTime dtEndDate   = new DateTime();
        string   strCategory = "";
        string   strKeyword  = "";

        if (!string.IsNullOrEmpty(Request.QueryString["DateStart"]))
        {
            dtStartDate = DateTime.ParseExact(Request.QueryString["DateStart"].ToString(), "MMMddyyyy", null);
        }
        else
        {
            dtStartDate = DateTime.Parse("1/1/1990");
        }

        if (!string.IsNullOrEmpty(Request.QueryString["DateEnd"]))
        {
            dtEndDate = DateTime.ParseExact(Request.QueryString["DateEnd"].ToString(), "MMMddyyyy", null);
        }
        else
        {
            dtEndDate = DateTime.Now;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["Category"]))
        {
            strCategory = Request.QueryString["Category"].ToString();
        }
        else
        {
            strCategory = "ALL";
        }

        if (!string.IsNullOrEmpty(Request.QueryString["Keyword"]))
        {
            strKeyword = Request.QueryString["Keyword"].ToString();
        }

        using (clsPagination objPagination = new clsPagination())
        {
            objPagination.CurrentPage = string.IsNullOrEmpty(Request.QueryString["Page"]) == true ? 1 : Request.QueryString["Page"].ToInt();
            objPagination.PagePerForm = 10;
            objPagination.TotalCount  = DALThread.GetThreadArchiveCount(strCategory, DateTime.Parse(dtStartDate.ToShortDateString() + " 1:00 AM"), DateTime.Parse(dtEndDate.ToShortDateString() + " 11:59 PM"), strKeyword);
            string strDateStart = dtStartDate.ToString("MMMddyyyy");
            string strDateEnd   = dtEndDate.ToString("MMMddyyyy");

            //if (objPagination.TotalPage() > 1)
            //{
            //    if (objPagination.HasPreviousPage())
            //    {
            //        strWrite += "<a href='ThreadQueryResult.aspx?Page=" + objPagination.PreviousPage() + "&Category=" + strCategory + "&DateStart=" + strDateStart + "&DateEnd=" + strDateEnd + "'> &laquo;Previous</a>";
            //    }

            //    int i = 0;

            //    for (i = 1; i <= objPagination.TotalPage(); i++)
            //    {
            //            if (i == objPagination.CurrentPage)
            //            {
            //                strWrite += "<span><b>" + i + "</b></span>";
            //            }
            //            else
            //            {
            //                strWrite += "<a href='ThreadQueryResult.aspx?Page=" + i + "&Category=" + strCategory + "&DateStart=" + strDateStart + "&DateEnd=" + strDateEnd + "'>" + i + "</a> ";
            //            }

            //    }

            //    if (objPagination.HasNextPage())
            //    {
            //        strWrite += "<a href='ThreadQueryResult.aspx?Page=" + objPagination.NextPage() + "&Category=" + strCategory + "&DateStart=" + strDateStart + "&DateEnd=" + strDateEnd + "'> Next &raquo;</a>";
            //    }
            //}

            ddlPages.Items.Clear();
            for (int i = 1; i <= objPagination.TotalPage(); i++)
            {
                ListItem l = new ListItem(i.ToString(), i.ToString(), true);
                l.Selected = l.Value == objPagination.CurrentPage.ToString() ? true : false;
                ddlPages.Items.Add(l);
            }
        }

        //lblPage.Text = strWrite;
    }