개정판 669a91cf
효성 AutoApprovalTest 수정
Change-Id: Id8ad597480ff40f45ad204dfb285e224901398bd
KCOM_API_AutoStamping/AutoApprovalTest.aspx.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.Data; |
|
3 | 4 |
using System.Linq; |
4 | 5 |
using System.Net; |
5 | 6 |
using System.Web; |
6 | 7 |
using System.Web.UI; |
7 | 8 |
using System.Web.UI.WebControls; |
8 | 9 |
using System.Xml; |
10 |
//using Microsoft.SharePoint; |
|
9 | 11 |
|
10 | 12 |
namespace KCOM_API_AutoStamping |
11 | 13 |
{ |
12 | 14 |
public partial class AutoApprovalTest : System.Web.UI.Page |
13 | 15 |
{ |
16 |
private const string cookieName = "autoStampCookie"; |
|
17 |
private const string cookieKeySelectPrj = "SelectProject"; |
|
18 |
|
|
14 | 19 |
protected void Page_Load(object sender, EventArgs e) |
15 | 20 |
{ |
21 |
if (!IsPostBack) |
|
22 |
{ |
|
23 |
DataSet ds = new DataSet(); |
|
24 |
|
|
25 |
WebClient client = new WebClient(); |
|
26 |
string reqstr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" |
|
27 |
+ "<soapenv:Header/>" |
|
28 |
+ "<soapenv:Body>" |
|
29 |
+ "</soapenv:Body>" |
|
30 |
+ "</soapenv:Envelope>"; |
|
31 |
client.Headers.Add(HttpRequestHeader.ContentType, "text/xml"); |
|
32 |
client.Headers.Add("SOAPAction", "urn:Common/GetProjectList"); |
|
33 |
|
|
34 |
|
|
35 |
string _result = client.UploadString(new Uri($"http://{Request.Url.Host.ToString()}:{Request.Url.Port}/AutoStamping.svc"), reqstr); |
|
36 |
|
|
37 |
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(_result)); |
|
38 |
ds.ReadXml(reader); |
|
39 |
|
|
40 |
PROJECT_LIST.DataSource = ds.Tables["ProjectInfo"]; |
|
41 |
PROJECT_LIST.DataTextField = "Name"; |
|
42 |
PROJECT_LIST.DataValueField = "No"; |
|
43 |
PROJECT_LIST.DataBind(); |
|
44 |
|
|
45 |
var selectPrj = LoadCookies(cookieKeySelectPrj); |
|
46 |
|
|
47 |
if(selectPrj == null) |
|
48 |
{ |
|
49 |
PROJECT_LIST.SelectedIndex = 0; |
|
50 |
} |
|
51 |
else |
|
52 |
{ |
|
53 |
PROJECT_LIST.SelectedValue = selectPrj; |
|
54 |
} |
|
55 |
|
|
56 |
|
|
57 |
//try |
|
58 |
//{ |
|
59 |
|
|
60 |
// if (Request.QueryString["siteId"] != null) |
|
61 |
// hdnSiteid.Value = Request.QueryString["siteId"].ToString(); |
|
62 |
|
|
63 |
// if (Request.QueryString["webId"] != null) |
|
64 |
// hdnWebid.Value = Request.QueryString["webId"].ToString(); |
|
65 |
|
|
66 |
// if (Request.QueryString["NODE"] != null) |
|
67 |
// hdnNode.Value = Request.QueryString["NODE"].ToString(); |
|
68 |
|
|
69 |
// if (Request.QueryString["pjtno"] != null) |
|
70 |
// hdnpjtno.Value = Request.QueryString["pjtno"].ToString(); |
|
71 |
|
|
72 |
// //Guid guidSite = new Guid(hdnSiteid.Value); |
|
73 |
// //Guid guidWeb = new Guid(hdnWebid.Value); |
|
74 |
|
|
75 |
|
|
76 |
// string sspURL = "http://www.hsdh2.com"; |
|
77 |
|
|
78 |
// SPSite site = new SPSite(sspURL); |
|
79 |
|
|
80 |
// SPWeb web = site.OpenWeb(); |
|
81 |
|
|
82 |
// SPUser user = web.CurrentUser; |
|
83 |
|
|
84 |
// txtuser_id.Text = (user == null) ? web.Description : user.LoginName.Split('\\')[1].ToUpper(); |
|
85 |
|
|
86 |
//} |
|
87 |
//catch (Exception ex) |
|
88 |
//{ |
|
89 |
//} |
|
90 |
} |
|
16 | 91 |
} |
17 | 92 |
|
18 | 93 |
protected void Button1_Click(object sender, EventArgs e) |
19 | 94 |
{ |
20 |
string project_no = this.txtproject_no.Text.Trim().ToString();
|
|
95 |
string project_no = this.PROJECT_LIST.SelectedValue.Trim().ToString();
|
|
21 | 96 |
string slip_no = this.txtslip_no.Text.Trim().ToString(); |
22 | 97 |
string user_id = this.txtuser_id.Text.Trim().ToString(); |
23 | 98 |
|
... | ... | |
35 | 110 |
client.Headers.Add(HttpRequestHeader.ContentType, "text/xml"); |
36 | 111 |
client.Headers.Add("SOAPAction", "urn:Common/AutoStamping"); |
37 | 112 |
|
38 |
|
|
39 |
|
|
40 | 113 |
string _result = client.UploadString(new Uri($"http://{Request.Url.Host.ToString()}:{Request.Url.Port}/AutoStamping.svc"), reqstr); |
41 | 114 |
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(_result)); |
42 |
string msg = "Success"; |
|
115 |
|
|
116 |
string msg = "Success\\naaaa"; |
|
43 | 117 |
|
44 | 118 |
while (reader.Read()) |
45 | 119 |
{ |
... | ... | |
59 | 133 |
Response.Write("<script language='Javascript'> "); |
60 | 134 |
Response.Write("alert('" + msg + "'); "); |
61 | 135 |
Response.Write("</script>"); |
136 |
SaveCookies(cookieKeySelectPrj, project_no); |
|
137 |
} |
|
138 |
|
|
139 |
private void SaveCookies(string Key,string value) |
|
140 |
{ |
|
141 |
HttpCookie cookies = new HttpCookie(Key, value); |
|
142 |
cookies.Expires = DateTime.Now.AddDays(10); |
|
143 |
|
|
144 |
Response.Cookies[Key].Expires = DateTime.Now.AddDays(10); |
|
145 |
Response.Cookies.Add(cookies); |
|
146 |
} |
|
147 |
|
|
148 |
private string LoadCookies(string Key) |
|
149 |
{ |
|
150 |
return (Request.Cookies[Key] != null) ? Request.Cookies[Key].Value : null; |
|
62 | 151 |
} |
63 | 152 |
} |
64 | 153 |
} |
내보내기 Unified diff