private void ShowNews(int NewsId)//显示新闻 { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModelByCache(NewsId); strHeading = model.Heading; strDate = model.IssueDate.ToString(); strContent = model.Content; strfrquency = model.Frequency.ToString(); if (model.IsLimited == 1) { string XmlPath=Server.MapPath("~/app_data/AllowIp.xml"); string thisIp = ""; thisIp = Page.Request.UserHostAddress; Maticsoft.BLL.NewsManage.NewsViewIpcontrol newsipcontrol= new Maticsoft.BLL.NewsManage.NewsViewIpcontrol(); if (!newsipcontrol.IpAllow(thisIp,XmlPath)) { strContent = "对不起,您的IP:" + thisIp + "不在本文允许的访问范围内,请联系管理员!"; return; } } //附件信息 this.newsimagescontent.InnerHtml = ShowNewsImage(NewsId).ToString(); this.newsaffixcontent.InnerHtml = ShowNewsAffix(NewsId).ToString(); GenNavigate(model.ClassId); //点击率增加 model.Frequency++; bll.FrequencyAdd(model); }
protected void Confirm_Click(object sender, EventArgs e) { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); string idlist = GetSelIDlist(); bll.DeleteList(idlist); Response.Redirect("Release.aspx"); }
protected void GetImagesInfo() { DataSet Ds = new DataSet(); Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Ds=bll.GetTopImgScroll(3); try { strid[0] = "news.aspx?id=" + Ds.Tables[0].Rows[0][0].ToString(); strid[1] = "news.aspx?id=" + Ds.Tables[0].Rows[1][0].ToString(); strid[2] = "news.aspx?id=" + Ds.Tables[0].Rows[2][0].ToString(); } catch { } try { strtitle[0] = Ds.Tables[0].Rows[0][1].ToString(); strtitle[1] = Ds.Tables[0].Rows[1][1].ToString(); strtitle[2] = Ds.Tables[0].Rows[2][1].ToString(); } catch { } try { strimg[0] = Ds.Tables[0].Rows[0][3].ToString(); strimg[1] = Ds.Tables[0].Rows[1][3].ToString(); strimg[2] = Ds.Tables[0].Rows[2][3].ToString(); } catch { } }
private void ShowNews(int NewsId)//显示新闻 { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModelByCache(NewsId); strHeading = model.Heading; strDate = model.IssueDate.ToString(); strContent = model.Content; strfrquency = model.Frequency.ToString(); if (model.IsLimited == 1) { string XmlPath = Server.MapPath("~/app_data/AllowIp.xml"); string thisIp = ""; thisIp = Page.Request.UserHostAddress; Maticsoft.BLL.NewsManage.NewsViewIpcontrol newsipcontrol = new Maticsoft.BLL.NewsManage.NewsViewIpcontrol(); if (!newsipcontrol.IpAllow(thisIp, XmlPath)) { strContent = "对不起,您的IP:" + thisIp + "不在本文允许的访问范围内,请联系管理员!"; return; } } //附件信息 this.newsimagescontent.InnerHtml = ShowNewsImage(NewsId).ToString(); this.newsaffixcontent.InnerHtml = ShowNewsAffix(NewsId).ToString(); GenNavigate(model.ClassId); //点击率增加 model.Frequency++; bll.FrequencyAdd(model); }
private void ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet Ds = bll.GetNewsList(MyintTop, MyClassId, false); //bll.GetTopScroll(4);// StringBuilder strList = new StringBuilder(); if (Ds != null && Ds.Tables.Count > 0) { for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { // <a href="content.htm" target="_blank">关于2010年度国家社会科学基金艺术学项目申报的通知</a><span class="date_time"> [2010-02-30]</span></li> strList.Append("<li><a href='news.aspx?id=" + Ds.Tables[0].Rows[i]["NewsId"] + "' target='_blank'>"); strList.Append(FormatString(Ds.Tables[0].Rows[i]["Heading"].ToString(), TitleLength)); strList.Append("</a>"); if (MyShowDate == 1) { strList.Append("<span class='date_time'>["); strList.Append(FormatsortDateString(Ds.Tables[0].Rows[i]["IssueDate"].ToString())); strList.Append("]</span>"); } strList.Append("</li>"); } } this.newsListDiv.InnerHtml = strList.ToString(); }
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 ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet Ds = bll.GetNewsList(MyintTop, MyClassId, false); //bll.GetTopScroll(4);// StringBuilder strList = new StringBuilder(); if (Ds != null && Ds.Tables.Count > 0) { for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { // <a href="content.htm" target="_blank">关于2010年度国家社会科学基金艺术学项目申报的通知</a><span class="date_time"> [2010-02-30]</span></li> strList.Append("<li><a href='news.aspx?id=" + Ds.Tables[0].Rows[i]["NewsId"] + "' target='_blank'>"); strList.Append(FormatString(Ds.Tables[0].Rows[i]["Heading"].ToString(), TitleLength)); strList.Append("</a>"); if (MyShowDate==1) { strList.Append("<span class='date_time'>["); strList.Append(FormatsortDateString(Ds.Tables[0].Rows[i]["IssueDate"].ToString())); strList.Append("]</span>"); } strList.Append("</li>"); } } this.newsListDiv.InnerHtml = strList.ToString(); }
protected void GetImagesInfo() { DataSet Ds = new DataSet(); Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Ds = bll.GetTopImgScroll(3); try { strid[0] = "news.aspx?id=" + Ds.Tables[0].Rows[0][0].ToString(); strid[1] = "news.aspx?id=" + Ds.Tables[0].Rows[1][0].ToString(); strid[2] = "news.aspx?id=" + Ds.Tables[0].Rows[2][0].ToString(); } catch { } try { strtitle[0] = Ds.Tables[0].Rows[0][1].ToString(); strtitle[1] = Ds.Tables[0].Rows[1][1].ToString(); strtitle[2] = Ds.Tables[0].Rows[2][1].ToString(); } catch { } try { strimg[0] = Ds.Tables[0].Rows[0][3].ToString(); strimg[1] = Ds.Tables[0].Rows[1][3].ToString(); strimg[2] = Ds.Tables[0].Rows[2][3].ToString(); } catch { } }
private void ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet Ds = bll.GetNewsList(MyintTop, MyClassId, false); //bll.GetTopScroll(4);// this.GridView1.DataSource = Ds; this.GridView1.DataBind(); //处理记录信息 try { this.lblRowsCount.Text = Ds.Tables[0].Rows.Count.ToString(); } catch { }; this.PageDrop.Items.Clear(); for (int i = 0; i < this.GridView1.PageCount; i++) { ListItem dropitem = new ListItem(); dropitem.Value = i.ToString(); dropitem.Text = (i + 1).ToString(); this.PageDrop.Items.Add(dropitem); } if(this.PageDrop.Items.Count>0) this.PageDrop.SelectedIndex = this.GridView1.PageIndex; }
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 ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet Ds = bll.GetNewsList(MyintTop, MyClassId, false); //bll.GetTopScroll(4);// this.GridView1.DataSource = Ds; this.GridView1.DataBind(); //处理记录信息 try { this.lblRowsCount.Text = Ds.Tables[0].Rows.Count.ToString(); } catch { }; this.PageDrop.Items.Clear(); for (int i = 0; i < this.GridView1.PageCount; i++) { ListItem dropitem = new ListItem(); dropitem.Value = i.ToString(); dropitem.Text = (i + 1).ToString(); this.PageDrop.Items.Add(dropitem); } if (this.PageDrop.Items.Count > 0) { this.PageDrop.SelectedIndex = this.GridView1.PageIndex; } }
protected void Confirm_Click(object sender, EventArgs e) { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); string idlist = GetSelIDlist(); bll.DeleteList(idlist); Response.Redirect("Release.aspx"); }
private void ShowNews(int NewsId)//显示新闻 { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModelByCache(NewsId); strHeading = model.Heading; strDate = model.IssueDate.ToString(); strContent = model.Content; }
//��ʾ���� private void ShowNews(int NewsId) { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModelByCache(NewsId); strHeading = model.Heading; strDate = model.IssueDate.ToString(); strContent = model.Content; }
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.News bll = new Maticsoft.BLL.NewsManage.News(); string strWhere = ""; if (Session["strWhereNewsRelea"] != null && Session["strWhereNewsRelea"].ToString() != "") { strWhere = Session["strWhereNewsRelea"].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.CurrentPageIndex = 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 Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); 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.News bll = new Maticsoft.BLL.NewsManage.News(); Maticsoft.Model.NewsManage.News model = bll.GetModel(Id); Session["news"] = model; lblNewsId.Text = model.NewsId.ToString(); this.txtHeading.Text = model.Heading; this.FreeTextBox1.Text = model.Content; }
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); Session["news"] = model; lblNewsId.Text = model.NewsId.ToString(); this.txtHeading.Text = model.Heading; this.FreeTextBox1.Text = model.Content; }
private void ShowNews()//显示新闻 { int cid = -1; if ((ViewState["cid"] != null) && (ViewState["cid"].ToString() != "")) { cid = int.Parse(ViewState["cid"].ToString()); } Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet ds = bll.GetNewsList(-1, cid, false);// gridView.DataSource = ds; gridView.DataBind(); //分页 int rows_Count = ds.Tables[0].Rows.Count; int page_Size = gridView.PageSize; int page_Count = gridView.PageCount; int page_Current = gridView.PageIndex + 1; lblRowsCount.Text = rows_Count.ToString(); lblPageCount.Text = page_Count.ToString(); lblCurrentPage.Text = page_Current.ToString(); #region 显示页导航 btnFirst.Enabled = true; btnPrev.Enabled = true; btnNext.Enabled = true; btnLast.Enabled = true; if (gridView.PageIndex == 0) { btnFirst.Enabled = false; btnPrev.Enabled = false; if (gridView.PageCount == 1) { btnLast.Enabled = false; btnNext.Enabled = false; } } else if (gridView.PageIndex == gridView.PageCount - 1) { btnLast.Enabled = false; btnNext.Enabled = false; } #endregion }
protected void newssearch() { string key = Request.Form[0].ToString(); int type = int.Parse(Request.Form[1]); string strType = ""; this.searchInfo.InnerHtml = key + type.ToString(); string strwhere = ""; switch (type) { case 1: strwhere = " ( heading like'%" + key + "%')"; strType = "标题"; break; case 2: strwhere = " ( content like'%" + key + "%')"; strType = "内容"; break; case 3: string strdate = "1900-01-01"; try { strdate = Convert.ToDateTime(key).ToShortDateString(); } catch { } strwhere = " issuedate>'" + strdate + "' and issuedate-1<'" + strdate + "'"; strType = "日期"; break; } Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet ds = new DataSet(); ds = bll.GetList(strwhere); this.GridView1.DataSource = ds.Tables[0].DefaultView; this.GridView1.DataBind(); int count = 0; try { count = ds.Tables[0].Rows.Count; } catch { } this.searchInfo.InnerHtml = "搜索关键字:<b>" + key + " </b>搜索方式:<b>" + strType; this.searchInfo.InnerHtml += "</b>共找到记录:<b>" + count.ToString() + "</b>"; }
protected void newssearch() { string key = Request.Form[0].ToString(); int type = int.Parse(Request.Form[1]); string strType = ""; this.searchInfo.InnerHtml = key + type.ToString(); string strwhere=""; switch (type) { case 1: strwhere = " ( heading like'%" + key + "%')"; strType = "标题"; break; case 2: strwhere = " ( content like'%" + key + "%')"; strType = "内容"; break; case 3: string strdate="1900-01-01"; try { strdate = Convert.ToDateTime(key).ToShortDateString(); } catch { } strwhere = " issuedate>'" + strdate + "' and issuedate-1<'" + strdate + "'"; strType = "日期"; break; } Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet ds = new DataSet(); ds = bll.GetList(strwhere); this.GridView1.DataSource = ds.Tables[0].DefaultView; this.GridView1.DataBind(); int count=0; try { count=ds.Tables[0].Rows.Count; } catch { } this.searchInfo.InnerHtml = "搜索关键字:<b>" + key + " </b>搜索方式:<b>" + strType; this.searchInfo.InnerHtml += "</b>共找到记录:<b>" +count.ToString() +"</b>"; }
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); Session["news"] = model; lblNewsId.Text = model.NewsId.ToString(); for (int i = 0; i < this.dropNewsClass.Items.Count; i++) { if (this.dropNewsClass.Items[i].Value == model.ClassId.ToString()) { this.dropNewsClass.Items[i].Selected = true; } } this.txtHeading.Text = model.Heading; this.txtFocus.Text = model.Focus; this.txtIssueDate.Text = model.IssueDate.ToString(); this.chkIsTop.Checked = (model.IsTop == 1); this.chkIsLimited.Checked = (model.IsLimited == 1); if (model.Dormancy.ToString().ToLower() == "true") { this.chkDormancy.Checked = false; } else { this.chkDormancy.Checked = true; } // if(news.Opened.ToString().ToLower()=="true") // { // this.radlistOpened.SelectedIndex=1; // } // else // { // this.radlistOpened.SelectedIndex=0; // } //this.FreeTextBox1.Text = model.Content; this.ck_modify.Text = model.Content; }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string content = FreeTextBox1.Text; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) { return; } LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = (Maticsoft.Model.NewsManage.News)Session["news"]; news.NewsId = newid; news.Heading = heading; news.Content = content; news.Frequency = 0; news.IssueDate = DateTime.Now; Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); Response.Redirect("show.aspx?id=" + newid); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string content = FreeTextBox1.Text; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) return; LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = (Maticsoft.Model.NewsManage.News)Session["news"]; news.NewsId = newid; news.Heading = heading; news.Content = content; news.Frequency = 0; news.IssueDate = DateTime.Now; Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); Response.Redirect("show.aspx?id=" + newid); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.FreeTextBox1.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; //bool opened = this.radlistOpened.SelectedValue == "1" ? true : false; bool dormancy = this.chkDormancy.Checked; if (heading == "") { strErr += "���ⲻ��Ϊ��\\n"; } if (content == "") { strErr += "���ݲ���Ϊ��\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "û�п���ѡ������\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) return; LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.NewsId = newid; news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; news.Frequency = 0; if (dormancy) { news.Dormancy = "True"; } else { news.Dormancy = "False"; } news.IssueDate = DateTime.Now; news.Priority = 0; news.UserId = currentUser.UserID; if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); Response.Redirect("show.aspx?id=" + newid); }
/// <summary> /// 显示新闻 /// </summary> private void ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); this.DataList1.DataSource = bll.GetTopScroll(4);// this.DataList1.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.FreeTextBox1.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; //bool opened = this.radlistOpened.SelectedValue == "1" ? true : false; bool dormancy = this.chkDormancy.Checked; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "没有可以选择的类别!\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) { return; } LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.NewsId = newid; news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; news.Frequency = 0; if (dormancy) { news.Dormancy = "True"; } else { news.Dormancy = "False"; } news.IssueDate = DateTime.Now; news.Priority = 0; news.UserId = currentUser.UserID; if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); Response.Redirect("show.aspx?id=" + newid); }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.FreeTextBox1.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; string strissuedate = this.txtIssueDate.Text; //bool opened = this.radlistOpened.SelectedValue == "1" ? true : false; bool dormancy = !this.chkDormancy.Checked; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "没有可以选择的类别!\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) { return; } DateTime issuedate = DateTime.Now; try { issuedate = Convert.ToDateTime(strissuedate); } catch { } LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.NewsId = newid; news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; news.IssueDate = issuedate; // news.Frequency = 0; if (dormancy) { news.Dormancy = "True"; } else { news.Dormancy = "False"; } news.IssueDate = issuedate;// DateTime.Now; news.Priority = 0; news.UserId = currentUser.UserID; if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } if (chkIsLimited.Checked) { news.IsLimited = 1; } else { news.IsLimited = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); //处理新闻图片 if (Session["NewsImages_tempId"] != null) { int NewsImages_tempId = (int)Session["NewsImages_tempId"]; Maticsoft.BLL.NewsManage.NewsImages bll = new Maticsoft.BLL.NewsManage.NewsImages(); DataSet Dset = (DataSet)Session["FileList"]; //bll.GetNewsImagesList(-1, NewsImages_tempId, false); if (Dset != null && Dset.Tables[0].Rows.Count > 0) { string Sourcepath = Server.MapPath("~/upload/Temp/"); string Despath = Server.MapPath("~/upload/img/"); for (int i = 0; i < Dset.Tables[0].Rows.Count; i++) { try { string FileName = Dset.Tables[0].Rows[i]["linkurl"].ToString(); if (File.Exists(Sourcepath + FileName)) { File.Copy(Sourcepath + FileName, Despath + FileName); } if (File.Exists(Sourcepath + FileName)) { File.Delete(Sourcepath + FileName); } } catch { //this.Label_Msg.Text = "文件复制出错:" + Ex.Message.ToString(); } } //修改图片 // string strupdatestring = "newsid=" + newsid.ToString(); // bll.Update(strupdatestring, NewsImages_tempId); } } //处理新闻附件 if (Session["NewsAffix_tempId"] != null) { int NewsAffix_tempId = (int)Session["NewsAffix_tempId"]; Maticsoft.BLL.NewsManage.NewsAffix bll = new Maticsoft.BLL.NewsManage.NewsAffix(); DataSet Dset = (DataSet)Session["FileList_Affix"]; //bll.GetNewsAffixList(-1, NewsAffix_tempId, false); if (Dset != null && Dset.Tables[0].Rows.Count > 0) { string Sourcepath = Server.MapPath("~/upload/Temp/"); string Despath = Server.MapPath("~/upload/affix"); for (int i = 0; i < Dset.Tables[0].Rows.Count; i++) { try { string FileName = Dset.Tables[0].Rows[i]["linkurl"].ToString(); if (File.Exists(Sourcepath + FileName)) { File.Copy(Sourcepath + FileName, Despath + FileName); } if (File.Exists(Sourcepath + FileName)) { File.Delete(Sourcepath + FileName); } } catch { //this.Label_Msg.Text = "文件复制出错:" + Ex.Message.ToString(); } } //修改附件 //string strupdatestring = "newsid=" + newsid.ToString(); //bll.Update(strupdatestring, NewsAffix_tempId); } } Response.Redirect("show.aspx?id=" + newid); }
/// <summary> /// ��ʾ���� /// </summary> private void ShowNews() { Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); this.DataList1.DataSource = bll.GetTopScroll(4);// this.DataList1.DataBind(); }
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); Session["news"] = model; lblNewsId.Text = model.NewsId.ToString(); for (int i = 0; i < this.dropNewsClass.Items.Count; i++) { if (this.dropNewsClass.Items[i].Value == model.ClassId.ToString()) { this.dropNewsClass.Items[i].Selected = true; } } this.txtHeading.Text = model.Heading; this.txtFocus.Text = model.Focus; this.txtIssueDate.Text = model.IssueDate.ToString(); this.chkIsTop.Checked = (model.IsTop == 1); this.chkIsLimited.Checked = (model.IsLimited == 1); if (model.Dormancy.ToString().ToLower() == "true") { this.chkDormancy.Checked = false; } else { this.chkDormancy.Checked = true; } // if(news.Opened.ToString().ToLower()=="true") // { // this.radlistOpened.SelectedIndex=1; // } // else // { // this.radlistOpened.SelectedIndex=0; // } //this.FreeTextBox1.Text = model.Content; this.ck_modify.Text = model.Content; }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; int newid = int.Parse(lblNewsId.Text); string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.ck_modify.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; string strissuedate = this.txtIssueDate.Text; //bool opened = this.radlistOpened.SelectedValue == "1" ? true : false; bool dormancy = !this.chkDormancy.Checked; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "没有可以选择的类别!\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) return; DateTime issuedate = DateTime.Now; try { issuedate = Convert.ToDateTime(strissuedate); } catch { } LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.NewsId = newid; news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; news.IssueDate = issuedate; // news.Frequency = 0; if (dormancy) { news.Dormancy = "True"; } else { news.Dormancy = "False"; } news.IssueDate = issuedate;// DateTime.Now; news.Priority = 0; news.UserId = currentUser.UserID; if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } if (chkIsLimited.Checked) { news.IsLimited = 1; } else { news.IsLimited = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Update(news); //处理新闻图片 if (Session["NewsImages_tempId"] != null) { int NewsImages_tempId = (int)Session["NewsImages_tempId"]; Maticsoft.BLL.NewsManage.NewsImages bll = new Maticsoft.BLL.NewsManage.NewsImages(); DataSet Dset = (DataSet)Session["FileList"]; //bll.GetNewsImagesList(-1, NewsImages_tempId, false); if (Dset != null && Dset.Tables[0].Rows.Count > 0) { string Sourcepath = Server.MapPath("~/upload/Temp/"); string Despath = Server.MapPath("~/upload/img/"); for (int i = 0; i < Dset.Tables[0].Rows.Count; i++) { try { string FileName = Dset.Tables[0].Rows[i]["linkurl"].ToString(); if (File.Exists(Sourcepath + FileName)) File.Copy(Sourcepath + FileName, Despath + FileName); if (File.Exists(Sourcepath + FileName)) File.Delete(Sourcepath + FileName); } catch { //this.Label_Msg.Text = "文件复制出错:" + Ex.Message.ToString(); } } //修改图片 // string strupdatestring = "newsid=" + newsid.ToString(); // bll.Update(strupdatestring, NewsImages_tempId); } } //处理新闻附件 if (Session["NewsAffix_tempId"] != null) { int NewsAffix_tempId = (int)Session["NewsAffix_tempId"]; Maticsoft.BLL.NewsManage.NewsAffix bll = new Maticsoft.BLL.NewsManage.NewsAffix(); DataSet Dset = (DataSet)Session["FileList_Affix"]; //bll.GetNewsAffixList(-1, NewsAffix_tempId, false); if (Dset != null && Dset.Tables[0].Rows.Count > 0) { string Sourcepath = Server.MapPath("~/upload/Temp/"); string Despath = Server.MapPath("~/upload/affix/"); for (int i = 0; i < Dset.Tables[0].Rows.Count; i++) { try { string FileName = Dset.Tables[0].Rows[i]["linkurl"].ToString(); if (File.Exists(Sourcepath + FileName)) File.Copy(Sourcepath + FileName, Despath + FileName); if (File.Exists(Sourcepath + FileName)) File.Delete(Sourcepath + FileName); } catch { //this.Label_Msg.Text = "文件复制出错:" + Ex.Message.ToString(); } } //修改附件 //string strupdatestring = "newsid=" + newsid.ToString(); //bll.Update(strupdatestring, NewsAffix_tempId); } } Response.Redirect("show.aspx?id=" + newid); }
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.News bll = new Maticsoft.BLL.NewsManage.News(); string strWhere = ""; if (Session["strWhereNewsRelea"] != null && Session["strWhereNewsRelea"].ToString() != "") { strWhere = Session["strWhereNewsRelea"].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.CurrentPageIndex = 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 btnAdd_Click(object sender, EventArgs e) { string strErr = ""; string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.FreeTextBox1.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; bool dormancy = this.chkDormancy.Checked; if (heading == "") { strErr += "���ⲻ��Ϊ��\\n"; } if (content == "") { strErr += "���ݲ���Ϊ��\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "û�п���ѡ������\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) return; LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; if (dormancy) { news.Dormancy = "False"; } else { news.Dormancy = "True"; } news.Dormancy = dormancy.ToString(); //news.Opened = opened; news.Frequency = 0; news.IssueDate = DateTime.Now; //news.ParentId = 0; news.Priority = 0; news.UserId = currentUser.UserID; //news.DepartmentID = int.Parse(currentUser.DepartmentID); if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Add(news); if (chkAddContinue.Checked) { Session["news"] = news; Response.Redirect("Add.aspx"); } else { Session["news"] = null; Response.Redirect("index.aspx"); } }
protected void btnAdd_Click(object sender, EventArgs e) { string strErr = ""; string heading = this.txtHeading.Text.Trim(); string focus = this.txtFocus.Text.Trim(); string content = this.FreeTextBox1.Text.Trim(); string classid = this.dropNewsClass.SelectedValue; bool dormancy = this.chkDormancy.Checked; if (heading == "") { strErr += "标题不能为空\\n"; } if (content == "") { strErr += "内容不能为空\\n"; } if ((this.dropNewsClass.Items.Count == 0) || (classid.Trim() == "")) { strErr += "没有可以选择的类别!\\n"; } if (strErr != "") { LTP.Common.MessageBox.Show(this, strErr); return; } if (Session["UserInfo"] == null) { return; } LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"]; Maticsoft.Model.NewsManage.News news = new Maticsoft.Model.NewsManage.News(); news.ClassId = int.Parse(classid); news.Heading = heading; news.Focus = focus; news.Content = content; if (dormancy) { news.Dormancy = "False"; } else { news.Dormancy = "True"; } news.Dormancy = dormancy.ToString(); //news.Opened = opened; news.Frequency = 0; news.IssueDate = DateTime.Now; //news.ParentId = 0; news.Priority = 0; news.UserId = currentUser.UserID; //news.DepartmentID = int.Parse(currentUser.DepartmentID); if (chkIsTop.Checked) { news.IsTop = 1; } else { news.IsTop = 0; } Maticsoft.BLL.NewsManage.News n = new Maticsoft.BLL.NewsManage.News(); n.Add(news); if (chkAddContinue.Checked) { Session["news"] = news; Response.Redirect("Add.aspx"); } else { Session["news"] = null; Response.Redirect("index.aspx"); } }
//��ʾ���� private void ShowNews() { int cid = -1; if ((ViewState["cid"] != null) && (ViewState["cid"].ToString() != "")) { cid = int.Parse(ViewState["cid"].ToString()); } Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News(); DataSet ds = bll.GetNewsList(-1, cid, false);// gridView.DataSource = ds; gridView.DataBind(); //��ҳ int rows_Count = ds.Tables[0].Rows.Count; int page_Size = gridView.PageSize; int page_Count = gridView.PageCount; int page_Current = gridView.PageIndex + 1; lblRowsCount.Text = rows_Count.ToString(); lblPageCount.Text = page_Count.ToString(); lblCurrentPage.Text = page_Current.ToString(); #region ��ʾҳ���� btnFirst.Enabled = true; btnPrev.Enabled = true; btnNext.Enabled = true; btnLast.Enabled = true; if (gridView.PageIndex == 0) { btnFirst.Enabled = false; btnPrev.Enabled = false; if (gridView.PageCount == 1) { btnLast.Enabled = false; btnNext.Enabled = false; } } else if (gridView.PageIndex == gridView.PageCount - 1) { btnLast.Enabled = false; btnNext.Enabled = false; } #endregion }