温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:唐唐企业管理网站源码
当前文件:
TangCompany/Manager/New.aspx.cs,打开代码结构图
TangCompany/Manager/New.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class Manager_New : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
if (!Page.IsPostBack) { 18
19
BindNew(); 20
21
} 22
} 23
protected void BindNew() { 24
25
NewDataList.DataSource = SqlHelper.ExcuteReadApdater("sys_SelectNew", CommandType.StoredProcedure, null); 26
NewDataList.DataKeyField = "Id"; 27
NewDataList.DataBind(); 28
29
} 30
protected string IsShow(string isBool) { 31
32
string txtRe = string.Empty; 33
if (isBool.ToLower() == "true") 34
{ 35
36
txtRe = "优惠信息"; 37
38
} 39
else { 40
41
txtRe = "商家公告"; 42
43
} 44
return txtRe; 45
46
} 47
protected void NewDataList_DeleteCommand(object source, DataListCommandEventArgs e) 48
{ 49
int nId = int.Parse(NewDataList.DataKeys[e.Item.ItemIndex].ToString()); 50
SqlParameter[] paras ={ new SqlParameter("@Id", SqlDbType.Int, 4) }; 51
paras[0].Value = nId; 52
SqlHelper.ExcuteNonQurey("DELETE FROM [New] WHERE Id=@Id", CommandType.Text, paras); 53
BindNew(); 54
55
} 56
protected void bntNew_Click(object sender, EventArgs e) 57
{ 58
Response.Redirect("AddNews.aspx"); 59
} 60
} 61





}
}