-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotification_Edit.aspx.cs
88 lines (83 loc) · 3.12 KB
/
Notification_Edit.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class Notification_Edit :CommonClasses.MyPage
{
protected void Page_Load(object sender, EventArgs e)
{
ModuleKey = "010101";
ModuleName = "日常办公-通知通告";
Response.Cache.SetExpires(DateTime.Now);
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);
if (!IsPostBack)
{
string operate = Request["code"].ToString();
HF_Operate.Value = operate;
if (operate != "add")
{
string id = Request["id"].ToString();
HF_ID.Value = id;
EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
note.ID = Int32.Parse(id);
DataTable table = note.getOriginTableByID();
TB_name.Value = table.Rows[0]["name"].ToString();
TA_Memo.Value = table.Rows[0]["memo"].ToString();
this.Title = "修改通知通告";
}
}
}
protected void Lbtn_OK_Click(object sender, EventArgs e)
{
EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
int result = -1;
note.Name = TB_name.Value;
note.UnitCode = _user.UnitCode;
note.IsApproved = false;
//note.Memo = "";
try
{
Stream myStream = File1.PostedFile.InputStream;
int imgDataLen = File1.PostedFile.ContentLength;
byte[] imgData = new byte[imgDataLen];
myStream.Read(imgData, 0, imgDataLen);
note.File = imgData;
note.ContentType = File1.PostedFile.ContentType;
string fielName = File1.PostedFile.FileName;
int i = fielName.LastIndexOf('.');
note.FileType = fielName.Substring(i + 1, fielName.Length - i - 1);
}
catch
{
}
note.log_moduleName = ModuleName;
note.log_userName = _user.UserName;
note.Memo = TA_Memo.Value;
if (HF_Operate.Value == "add")
{
note.AddPerson = User.Identity.Name;
note.DYear = Request["year"].ToString();
note.DMonth = Request["month"].ToString();
result = note.Insert();
}
if (HF_Operate.Value == "edit")
{
note.ChgPerson = User.Identity.Name;
note.ID = Int32.Parse(HF_ID.Value);
result = note.Update();
}
Response.Write("<script language='javascript'>javascript:var s=new Object();s.success=true;s.data='"+result+"';window.returnValue=s;self.close();</script>");
}
protected void Lbtn_Cancel_Click(object sender, EventArgs e)
{
Response.Write("<script language='javascript'>javascript:var s=new Object();s.success=false;window.returnValue=s;self.close();</script>");
}
}