Beispiel #1
0
 //protected void btn_enable_Click(object sender, EventArgs e)
 //{
 //    if (NewsGroupID() != "")
 //    {
 //        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
 //        newsGroupBSO.UpdateNewsGroup(NewsGroupID(), "1");
 //    }
 //    ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));
 //    AspNetCache.Reset();
 //}
 //protected void btn_disable_Click(object sender, EventArgs e)
 //{
 //    if (NewsGroupID() != "")
 //    {
 //        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
 //        newsGroupBSO.UpdateNewsGroup(NewsGroupID(), "0");
 //    }
 //    ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));
 //    AspNetCache.Reset();
 //}
 //protected void btn_enable_approval_Click(object sender, EventArgs e)
 //{
 //    if (NewsGroupID() != "")
 //    {
 //        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
 //        newsGroupBSO.UpdateNewsGroupApproval(NewsGroupID(), "1", Session["Admin_UserName"].ToString(), DateTime.Now);
 //    }
 //    ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));
 //    AspNetCache.Reset();
 //}
 //protected void btn_disable_approval_Click(object sender, EventArgs e)
 //{
 //    if (NewsGroupID() != "")
 //    {
 //        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
 //        newsGroupBSO.UpdateNewsGroupApproval(NewsGroupID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now);
 //    }
 //    ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));
 //    AspNetCache.Reset();
 //}
 protected void btn_delall_Click(object sender, EventArgs e)
 {
     if (NewsGroupID() != "")
     {
         NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
         newsGroupBSO.DeleteNewsGroup(NewsGroupID());
         //newsGroupBSO.UpdateNewsGroupisDelete(NewsGroupID(), "1");
     }
     ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));
     AspNetCache.Reset();
 }
Beispiel #2
0
    protected void grvNewsGroup_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int          Id           = Convert.ToInt32(e.CommandArgument.ToString());
        NewsGroupBSO newsGroupBSO = new NewsGroupBSO();
        NewsGroup    newsgroup    = newsGroupBSO.GetNewsGroupById(Id);

        string   nName    = e.CommandName.ToLower();
        AdminBSO adminBSO = new AdminBSO();
        Admin    admin    = new Admin();

        switch (nName)
        {
        case "_listfiles":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());
            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                Response.Redirect("~/Admin/listnewsfiles/" + Id + "/Default.aspx");
            }
            break;

        case "_addfiles":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());
            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                Response.Redirect("~/Admin/editnewsfiles/" + Id + "/0/Default.aspx");
            }
            break;

        case "_relation":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());
            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                Response.Redirect("~/Admin/EditNewsRelation/" + Id + "/Default.aspx");
            }
            break;

        case "_view":
            break;

        case "_edit":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());
            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                Response.Redirect("~/Admin/editnews/" + Id + "/Default.aspx");
            }
            break;

        case "_delete":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
            {
                newsGroupBSO.DeleteNewsGroup(Id);
                //newsGroupBSO.UpdateNewsGroupisDelete(Id, "1");
                ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));

                NewsCateBSO newscateBSO = new NewsCateBSO();

                if (newscateBSO.GetNewsCateByNewsGroupID(Id).Rows.Count > 0)
                {
                    newscateBSO.DeleteNewsCatebyNewsID(Id);
                }

                AspNetCache.Reset();
            }
            break;

        case "_restore":
            //admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

            if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
            {
                newsGroupBSO.UpdateNewsGroupisDelete(Id, "0");
                ViewNewsGroup(Convert.ToInt32(ddlCateNewsGroup.SelectedValue));

                AspNetCache.Reset();
            }
            break;
        }
    }