protected void BindClassList(int ClassID) { string strWhere=""; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass(); model = bll.GetModel(ClassID); int parentid = model.ParentId; if (parentid != 0) { model= bll.GetModelByCache(parentid); parentid = model.ParentId; } strWhere = "parentid="+model.ClassId; DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataTable dt = ds.Tables[0]; this.ClassName.InnerHtml = model.ClassDesc; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string classname="nav_2"; // Ñ¡ÖÐ״̬Ñùʽ if (ClassID.ToString() == dt.Rows[i][0].ToString()) classname = "nav_2_on"; this.ClassList.InnerHtml += "<li class='" + classname + "'><img src='images/picto_feuilles.gif' align='absmiddle' /><a href='main.aspx?classid=" + dt.Rows[i][0].ToString() + "' >" + dt.Rows[i][1].ToString() + "</a></li>"; } } }
private void BiudTree() { if (Session["UserInfo"] == null) { return; } Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); DataTable dt; dt = bll.GetList("").Tables[0]; this.dropNewsClass.Items.Clear(); //加载树 DataRow[] drs = dt.Select("ParentId= 0"); foreach (DataRow r in drs) { string nodeid = r["ClassId"].ToString(); string text = r["ClassDesc"].ToString(); string parentid = r["ParentId"].ToString(); text = "╋" + text; this.dropNewsClass.Items.Add(new ListItem(text, nodeid)); int sonparentid = int.Parse(nodeid); string blank = "├"; BindNode(sonparentid, dt, blank); } this.dropNewsClass.DataBind(); }
protected void grid_ItemDataBound(object sender, DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { string Dormancy = (string)DataBinder.Eval(e.Item.DataItem, "Dormancy"); int ClassId = (int)DataBinder.Eval(e.Item.DataItem, "ClassId"); if (Dormancy.ToLower() == "true") { e.Item.Cells[4].Text = "<span style=\" color:Red\">休眠</span>"; } else { e.Item.Cells[4].Text = "<span style=\" color:Green\">发布</span>"; } Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModelByCache(ClassId); if (mod != null) { e.Item.Cells[5].Text = mod.ClassDesc; } else { e.Item.Cells[5].Text = "未知类别"; } } }
protected void btnAdd_Click(object sender, EventArgs e) { //string strErr = ""; string ClassDesc = this.txtClassDesc.Text; string ClassPicture = this.txtClassPicture.Text; int ParentId = 0; if (this.dropParent.SelectedIndex > 0) { ParentId = int.Parse(this.dropParent.SelectedValue); } Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass(); model.ClassDesc = ClassDesc; model.ClassPicture = ClassPicture; model.ParentId = ParentId; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); bll.Add(model); if (chkAddContinue.Checked) { Session["newsclass"] = model; Response.Redirect("Add.aspx"); } else { Session["newsclass"] = null; Response.Redirect("index.aspx"); } }
protected void grid_ItemDataBound(object sender, DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { string Dormancy = (string)DataBinder.Eval(e.Item.DataItem, "Dormancy"); int ClassId = (int)DataBinder.Eval(e.Item.DataItem, "ClassId"); if (Dormancy.ToLower() == "true") { e.Item.Cells[4].Text = "<span style=\" color:Red\">����</span>"; } else { e.Item.Cells[4].Text = "<span style=\" color:Green\">����</span>"; } Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModelByCache(ClassId); if (mod != null) { e.Item.Cells[5].Text = mod.ClassDesc; } else { e.Item.Cells[5].Text = "δ֪���"; } } }
private void ShowInfo(int Id) { Navigation011.Para_Str = "id=" + Id; Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModel(Id); this.lblNewsId.Text = model.NewsId.ToString(); this.lblHeading.Text = model.Heading; this.lblFocus.Text = model.Focus; this.lblFrequency.Text = model.Frequency.ToString(); if (model.Dormancy == "True") { this.lblDormancy.Text = "·¢²¼"; } else { this.lblDormancy.Text = "ÐÝÃß"; } lblistop.Text = model.IsTop == 1 ? "ÊÇ" : "·ñ"; this.lblIssueDate.Text = model.IssueDate.ToString(); this.lblContent.Text = model.Content; Maticsoft.BLL.NewsManage.NewsClass bllc = new Maticsoft.BLL.NewsManage.NewsClass(); this.lblClass.Text = bllc.GetModel(model.ClassId).ClassDesc; }
private void ShowInfo(int Id) { Navigation011.Para_Str = "id=" + Id; Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModel(Id); this.lblNewsId.Text = model.NewsId.ToString(); this.lblHeading.Text = model.Heading; this.lblFocus.Text = model.Focus; this.lblFrequency.Text = model.Frequency.ToString(); if (model.Dormancy == "True") { this.lblDormancy.Text = "ÐÝÃß"; } else { this.lblDormancy.Text = "·¢²¼"; } lblistop.Text = model.IsTop == 1 ? "ÊÇ" : "·ñ"; this.lblIssueDate.Text = model.IssueDate.ToString(); this.lblContent.Text = model.Content; Maticsoft.BLL.NewsManage.NewsClass bllc = new Maticsoft.BLL.NewsManage.NewsClass(); this.lblClass.Text = bllc.GetModel(model.ClassId).ClassDesc; }
private void BiudTree() { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); DataTable dt; dt = bll.GetList("").Tables[0]; this.dropParent.Items.Clear(); //加载树 this.dropParent.Items.Add(new ListItem("顶级目录", "0")); DataRow[] drs = dt.Select("ParentId= 0"); foreach (DataRow r in drs) { string nodeid = r["ClassId"].ToString(); string text = r["ClassDesc"].ToString(); string parentid = r["ParentId"].ToString(); // string permissionid=r["PermissionID"].ToString(); text = "╋" + text; this.dropParent.Items.Add(new ListItem(text, nodeid)); int sonparentid = int.Parse(nodeid); string blank = "├"; BindNode(sonparentid, dt, blank); } this.dropParent.DataBind(); }
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Dormancy = (string)DataBinder.Eval(e.Row.DataItem, "Dormancy"); int ClassId = (int)DataBinder.Eval(e.Row.DataItem, "ClassId"); int IsTop = (int)DataBinder.Eval(e.Row.DataItem, "IsTop"); if (Dormancy.ToLower() == "true") { e.Row.Cells[3].Text = "<span style=\" color:Red\">休眠</span>"; } else { e.Row.Cells[3].Text = "<span style=\" color:Green\">发布</span>"; } if (IsTop == 1) { e.Row.Cells[4].Text = "<span style=\" color:Green\">是</span>"; } else { e.Row.Cells[4].Text = "<span style=\" color:Red\">否</span>"; } Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModel(ClassId); if (mod != null) { e.Row.Cells[5].Text = mod.ClassDesc; } else { e.Row.Cells[5].Text = "未知类别"; } } }
//#region BiudTree //private void BiudTree() //{ // // if(Session["UserInfo"]==null) // // { // // return ; // // } // // MoviePrincipal user=new MoviePrincipal(Context.User.Identity.Name); // // PowerWeb.Web.Accounts.CS.Bus.User currentUser=(PowerWeb.Web.Accounts.CS.Bus.User)Session["UserInfo"];00 // Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); // DataTable dt; // // if(user.HasPermissionID(newsmanageid)) // // { // // dt=nc.GetNewsClassList("").Tables[0]; // // } // // else // // { // // dt=nc.GetNewsClassList(int.Parse(currentUser.DepartmentID)).Tables[0]; // dt = bll.GetList("").Tables[0]; // // } // this.dropParent.Items.Clear(); // //加载树 // this.dropParent.Items.Add(new ListItem("顶级目录", "0")); // DataRow[] drs = dt.Select("ParentId= 0"); // foreach (DataRow r in drs) // { // string nodeid = r["ClassId"].ToString(); // string text = r["ClassDesc"].ToString(); // string parentid = r["ParentId"].ToString(); // // string permissionid=r["PermissionID"].ToString(); // text = "╋" + text; // this.dropParent.Items.Add(new ListItem(text, nodeid)); // int sonparentid = int.Parse(nodeid); // string blank = "├"; // BindNode(sonparentid, dt, blank); // } // this.dropParent.DataBind(); //} //private void BindNode(int parentid, DataTable dt, string blank) //{ // DataRow[] drs = dt.Select("ParentID= " + parentid); // foreach (DataRow r in drs) // { // string nodeid = r["ClassId"].ToString(); // string text = r["ClassDesc"].ToString(); // //string permissionid=r["PermissionID"].ToString(); // text = blank + "『" + text + "』"; // this.dropParent.Items.Add(new ListItem(text, nodeid)); // int sonparentid = int.Parse(nodeid); // string blank2 = blank + "─"; // BindNode(sonparentid, dt, blank2); // } //} //#endregion private void ShowInfo(int id) { Navigation011.Para_Str = "id=" + id; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = bll.GetModel(id); this.lblClassId.Text = model.ClassId.ToString(); txtClassDesc.Text = model.ClassDesc; txtClassPicture.Text = model.ClassPicture; }
private void dataBind(int pageIndex) { //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (!user.HasPermissionID(PermId_Add)) //{ // this.Page011.Page_Add = ""; //} //if (!user.HasPermissionID(PermId_Search)) //{ // this.Page011.Page_Search = ""; //} //if (user.HasPermissionID(PermId_Modify)) //{ // grid.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // grid.Columns[7].Visible = true; //} pageIndex--; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); string strWhere = ""; if (Session["strWhereNewsClass"] != null && Session["strWhereNewsClass"].ToString() != "") { strWhere = Session["strWhereNewsClass"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); grid.DataSource = ds.Tables[0].DefaultView; int record_Count = ds.Tables[0].Rows.Count; int page_Size = grid.PageSize; int totalPages = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString()); if (totalPages > 0) { if ((pageIndex + 1) > totalPages) pageIndex = totalPages - 1; } else { pageIndex = 0; } grid.PageIndex = pageIndex; grid.DataBind(); int page_Count = grid.PageCount; int page_Current = pageIndex + 1; Page011.Record_Count = record_Count; Page011.Page_Count = page_Count; Page021.Page_Count = page_Count; Page011.Page_Size = page_Size; Page021.Page_Size = page_Size; Page011.Page_Current = page_Current; Page021.Page_Current = page_Current; }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); if (e.CommandName == "DeleteByClassId") { bll.DeleteByClassId(Convert.ToInt32(e.CommandArgument)); LTP.Common.MessageBox.Show(this, "删除成功"); Response.Redirect("Index.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); string id = Request.Params["id"]; bll.Delete(int.Parse(id)); Response.Redirect("index.aspx"); } }
private void ShowInfo(int Id) { Navigation011.Para_Str = "id=" + Id; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = bll.GetModel(Id); lblClassId.Text = model.ClassId.ToString(); lblClassDesc.Text = model.ClassDesc; lblClassPicture.Text = model.ClassPicture; lblParentId.Text = model.ParentId.ToString(); }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); if (e.CommandName == "DeleteByClassId") { bll.DeleteByClassId(Convert.ToInt32(e.CommandArgument)); LTP.Common.MessageBox.Show(this, "ɾ���ɹ�"); Response.Redirect("Index.aspx"); } }
protected void grid_RowDataBound(object sender, GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow) || (e.Row.RowType == DataControlRowType.EmptyDataRow)) { int parentId = (int)DataBinder.Eval(e.Row.DataItem, "ParentId"); Maticsoft.BLL.NewsManage.NewsClass bllNewClass = new Maticsoft.BLL.NewsManage.NewsClass(); string classDesc = bllNewClass.GetClassDescByParentID(parentId); if (classDesc == null) { e.Row.Cells[3].Text = "��Ŀ¼"; } else { e.Row.Cells[3].Text = classDesc; } } }
protected void grid_RowDataBound(object sender, GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow) || (e.Row.RowType == DataControlRowType.EmptyDataRow)) { int parentId = (int)DataBinder.Eval(e.Row.DataItem, "ParentId"); Maticsoft.BLL.NewsManage.NewsClass bllNewClass = new Maticsoft.BLL.NewsManage.NewsClass(); string classDesc = bllNewClass.GetClassDescByParentID(parentId); if (classDesc == null) { e.Row.Cells[3].Text = "根目录"; } else { e.Row.Cells[3].Text = classDesc; } } }
private void BiudTree() { // if(Session["UserInfo"]==null) // { // return ; // } // MoviePrincipal user=new MoviePrincipal(Context.User.Identity.Name); // PowerWeb.Web.Accounts.CS.Bus.User currentUser=(PowerWeb.Web.Accounts.CS.Bus.User)Session["UserInfo"];00 Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); DataTable dt; // if(user.HasPermissionID(newsmanageid)) // { // dt=nc.GetNewsClassList("").Tables[0]; // } // else // { // dt=nc.GetNewsClassList(int.Parse(currentUser.DepartmentID)).Tables[0]; dt = bll.GetList("").Tables[0]; // } this.dropParent.Items.Clear(); //¼ÓÔØÊ÷ this.dropParent.Items.Add(new ListItem("¶¥¼¶Ä¿Â¼", "0")); DataRow[] drs = dt.Select("ParentId= 0"); foreach (DataRow r in drs) { string nodeid = r["ClassId"].ToString(); string text = r["ClassDesc"].ToString(); string parentid = r["ParentId"].ToString(); // string permissionid=r["PermissionID"].ToString(); text = "©ï" + text; this.dropParent.Items.Add(new ListItem(text, nodeid)); int sonparentid = int.Parse(nodeid); string blank = "©À"; BindNode(sonparentid, dt, blank); } this.dropParent.DataBind(); }
//private void BiudPermTree() //{ // DataTable tabcategory = PowerWeb.Web.Accounts.CS.Bus.AccountsTool.GetAllCategories().Tables[0]; // int rc = tabcategory.Rows.Count; // for (int n = 0; n < rc; n++) // { // string CategoryID = tabcategory.Rows[n]["CategoryID"].ToString(); // string CategoryName = tabcategory.Rows[n]["Description"].ToString(); // CategoryName = "╋" + CategoryName; // this.listPermission.Items.Add(new ListItem(CategoryName, CategoryID)); // DataTable tabforums = PowerWeb.Web.Accounts.CS.Bus.AccountsTool.GetPermissionsByCategory(int.Parse(CategoryID)).Tables[0]; // int fc = tabforums.Rows.Count; // for (int m = 0; m < fc; m++) // { // string ForumID = tabforums.Rows[m]["PermissionID"].ToString(); // string ForumName = tabforums.Rows[m]["Description"].ToString(); // ForumName = " ├『" + ForumName + "』"; // this.listPermission.Items.Add(new ListItem(ForumName, ForumID)); // } // } // this.listPermission.DataBind(); // this.listPermission.Items.Insert(0, new ListItem("--请选择--", "-1")); //} #endregion #region BiudTree private void BiudTree() { // if(Session["UserInfo"]==null) // { // return ; // } // MoviePrincipal user=new MoviePrincipal(Context.User.Identity.Name); // PowerWeb.Web.Accounts.CS.Bus.User currentUser=(PowerWeb.Web.Accounts.CS.Bus.User)Session["UserInfo"];00 Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); DataTable dt; // if(user.HasPermissionID(newsmanageid)) // { // dt=nc.GetNewsClassList("").Tables[0]; // } // else // { // dt=nc.GetNewsClassList(int.Parse(currentUser.DepartmentID)).Tables[0]; dt = bll.GetList("").Tables[0]; // } this.dropParent.Items.Clear(); //加载树 this.dropParent.Items.Add(new ListItem("顶级目录", "0")); DataRow[] drs = dt.Select("ParentId= 0"); foreach (DataRow r in drs) { string nodeid = r["ClassId"].ToString(); string text = r["ClassDesc"].ToString(); string parentid = r["ParentId"].ToString(); // string permissionid=r["PermissionID"].ToString(); text = "╋" + text; this.dropParent.Items.Add(new ListItem(text, nodeid)); int sonparentid = int.Parse(nodeid); string blank = "├"; BindNode(sonparentid, dt, blank); } this.dropParent.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { int classid = int.Parse(lblClassId.Text); string ClassDesc = this.txtClassDesc.Text; string ClassPicture = this.txtClassPicture.Text; int ParentId = 0; if (this.dropParent.SelectedIndex > 0) { ParentId = int.Parse(this.dropParent.SelectedValue); } Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass(); model.ClassId = classid; model.ClassDesc = ClassDesc; model.ClassPicture = ClassPicture; model.ParentId = ParentId; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); bll.Update(model); Response.Redirect("show.aspx?id=" + classid); }
protected void BindClassList(int ClassID) { string strWhere = ""; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass(); model = bll.GetModel(ClassID); int parentid = model.ParentId; if (parentid != 0) { model = bll.GetModelByCache(parentid); parentid = model.ParentId; } strWhere = "parentid=" + model.ClassId; DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataTable dt = ds.Tables[0]; }
protected void BindClassList(int ClassID) { string strWhere = ""; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = new Maticsoft.Model.NewsManage.NewsClass(); model = bll.GetModel(ClassID); int parentid = model.ParentId; if (parentid != 0) { model = bll.GetModelByCache(parentid); parentid = model.ParentId; } strWhere = "parentid=" + model.ClassId; DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataTable dt = ds.Tables[0]; this.ClassName.InnerHtml = model.ClassDesc; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string classname = "nav_2"; // Ñ¡ÖÐ״̬Ñùʽ if (ClassID.ToString() == dt.Rows[i][0].ToString()) { classname = "nav_2_on"; } this.ClassList.InnerHtml += "<li class='" + classname + "'><img src='images/picto_feuilles.gif' align='absmiddle' /><a href='main.aspx?classid=" + dt.Rows[i][0].ToString() + "' >" + dt.Rows[i][1].ToString() + "</a></li>"; } } }
public string GenNavigate(int ClassId) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); string strWhere = ""; DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataTable dt = ds.Tables[0]; StringBuilder strNav = new StringBuilder(); strNav.Append("当前位置:<a href='index.aspx'>首页</a>"); ArrayList MyArray = new ArrayList(); //取父级栏目 string strparentNave = ""; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][0].ToString() == ClassId.ToString()) { string strParentId = dt.Rows[i][0].ToString(); while (strParentId != "0") { strParentId = GenNavigateGetParent(dt, ref strparentNave, strParentId); MyArray.Add(strparentNave); } } } ; //生成导航条 for (int i = MyArray.Count - 1; i >= 0; i--) { strNav.Append(MyArray[i].ToString()); } return(strNav.ToString()); }
public void GenNavigate(int ClassId) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); this.PagaNavi.InnerHtml = bll.GenNavigate(ClassId); }
private void ShowInfo(int id) { Navigation011.Para_Str = "id=" + id; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass model = bll.GetModel(id); this.lblClassId.Text = model.ClassId.ToString(); txtClassDesc.Text = model.ClassDesc; txtClassPicture.Text = model.ClassPicture; }
private void dataBind(int pageIndex) { //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (!user.HasPermissionID(PermId_Add)) //{ // this.Page011.Page_Add = ""; //} //if (!user.HasPermissionID(PermId_Search)) //{ // this.Page011.Page_Search = ""; //} //if (user.HasPermissionID(PermId_Modify)) //{ // grid.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // grid.Columns[7].Visible = true; //} pageIndex--; Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); string strWhere = ""; if (Session["strWhereNewsClass"] != null && Session["strWhereNewsClass"].ToString() != "") { strWhere = Session["strWhereNewsClass"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); grid.DataSource = ds.Tables[0].DefaultView; int record_Count = ds.Tables[0].Rows.Count; int page_Size = grid.PageSize; int totalPages = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString()); if (totalPages > 0) { if ((pageIndex + 1) > totalPages) { pageIndex = totalPages - 1; } } else { pageIndex = 0; } grid.PageIndex = pageIndex; grid.DataBind(); int page_Count = grid.PageCount; int page_Current = pageIndex + 1; Page011.Record_Count = record_Count; Page011.Page_Count = page_Count; Page021.Page_Count = page_Count; Page011.Page_Size = page_Size; Page021.Page_Size = page_Size; Page011.Page_Current = page_Current; Page021.Page_Current = page_Current; }
public string GenNavigate(int ClassId) { Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); string strWhere = ""; DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataTable dt = ds.Tables[0]; StringBuilder strNav = new StringBuilder(); strNav.Append("当前位置:<a href='index_12_5.html'>首页</a>"); ArrayList MyArray = new ArrayList(); //取父级栏目 string strparentNave = ""; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][0].ToString() == ClassId.ToString()) { string strParentId = dt.Rows[i][0].ToString(); while (strParentId != "0") { strParentId = GenNavigateGetParent(dt, ref strparentNave, strParentId); MyArray.Add(strparentNave); } } }; //生成导航条 for (int i = MyArray.Count - 1; i >= 0; i--) { strNav.Append(MyArray[i].ToString()); } return strNav.ToString(); }
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Dormancy = (string)DataBinder.Eval(e.Row.DataItem, "Dormancy"); int ClassId = (int)DataBinder.Eval(e.Row.DataItem, "ClassId"); int IsTop = (int)DataBinder.Eval(e.Row.DataItem, "IsTop"); if (Dormancy.ToLower() == "true") { e.Row.Cells[3].Text = "<span style=\" color:Red\">休眠</span>"; } else { e.Row.Cells[3].Text = "<span style=\" color:Green\">发布</span>"; } if (IsTop == 1) { e.Row.Cells[4].Text ="<span style=\" color:Green\">是</span>"; } else { e.Row.Cells[4].Text = "<span style=\" color:Red\">否</span>"; } Maticsoft.BLL.NewsManage.NewsClass bll = new Maticsoft.BLL.NewsManage.NewsClass(); Maticsoft.Model.NewsManage.NewsClass mod = bll.GetModel(ClassId); if (mod != null) { e.Row.Cells[5].Text = mod.ClassDesc; } else { e.Row.Cells[5].Text = "未知类别"; } } }