温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:缤纷企业管理系统源码
当前文件:
BinFenEnterpriseWeb/Admin/AddEdit_Jobs.aspx.cs[3K,2009-6-12 11:33:51],打开代码结构图
BinFenEnterpriseWeb/Admin/AddEdit_Jobs.aspx.cs[3K,2009-6-12 11:33:51],打开代码结构图1using System; 2
using System.Data; 3
using System.IO; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
namespace Web.Admin 13
{ 14
public partial class AddEdit_Jobs : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
pageload(); 19
} 20
private void pageload() 21
{ 22
//网页加载 23
24
if (!IsPostBack) 25
{ 26
//软件类型 27
CommFun.IsAdmin(); 28
string strqry; 29
30
string Action = Request.QueryString["Action"]; 31
string id = Request.QueryString["ID"]; 32
if (Action == "Edit" && id != null) 33
{ 34
//是示信息以供修改 35
36
strqry = string.Format("select * From T_Jobs where ID={0}", id); 37
DataRow dr = DBFun.GetDataView(strqry).Table.Rows[0]; 38
tb_Position.Text = dr["Jobposition"].ToString(); 39
tb_Department.Text = dr["department"].ToString(); 40
tb_Thewhere.Text = dr["thewhere"].ToString(); 41
tb_Email.Text = dr["email"].ToString(); 42
tb_Limittime.Text = ((DateTime)dr["limittime"]).ToString("yyyy-MM-dd"); 43
ftb_Requirement.Text = dr["requirement"].ToString(); 44
btn_Ok.Text = "修改"; 45
} 46
else 47
{ 48
btn_Ok.Text = "添加"; 49
50
} 51
52
53
} 54
} 55
protected void btn_Ok_Click(object sender, EventArgs e) 56
{ 57
//修改 58
modify(); 59
60
} 61
private void modify() 62
{ 63
string strsql; 64
if (btn_Ok.Text == "修改") 65
{ 66
string id = Request.QueryString["id"]; 67
if (id == null || id == "") 68
return; 69
70
strsql=string.Format("Update T_Jobs set Jobposition='{0}',department='{1}',thewhere='{2}'," 71
+"email='{3}',limittime=#{4}#,requirement='{5}' where id={6}", 72
tb_Position.Text, tb_Department.Text, tb_Thewhere.Text, 73
tb_Email.Text, tb_Limittime.Text, ftb_Requirement.Text.Replace("'", "''"), id); 74
75
if (DBFun.ExecuteUpdate(strsql)) 76
{ 77
Response.Write("<script>alert('修改成功!');window.location.href='AddEdiT_Jobs.aspx?Action=Edit&ID=" + id + "';</script>"); 78
79
} 80
else 81
{ 82
83
84
Response.Write("<script>alert('修改失败!请确认输入是否正确。');</script>"); 85
} 86
} 87
else 88
{ 89
//添加 90
91
strsql = string.Format("Insert into [T_Jobs] (Jobposition,department,thewhere," 92
+ "email,limittime,requirement) values('{0}','{1}','{2}','{3}',#{4}#,'{5}')", 93
tb_Position.Text, tb_Department.Text, tb_Thewhere.Text, 94
tb_Email.Text, tb_Limittime.Text, ftb_Requirement.Text.Replace("'", "''")); 95
if (DBFun.ExecuteUpdate(strsql)) 96
{ 97
98
string NewId = DBFun.SearchValue("Select Max(id) from T_Jobs"); 99
Response.Write("<script>alert('添加成功!');window.location.href='AddEdiT_Jobs.aspx?Action=Edit&ID=" + NewId + "';</script>"); 100
101
} 102
else 103
{ 104
105
Response.Write("<script>alert('添加失败!请确认输入是否正确。');</script>"); 106
} 107
108
} 109
} 110
111
112
113
} 114
} 115






}
}