프로젝트

일반

사용자정보

개정판 669a91cf

ID669a91cfe21f67957b6cfef1857051e4e73c2564
상위 c4c99cb9
하위 4e1260ed, 523c6c0f

김태성이(가) 4년 이상 전에 추가함

효성 AutoApprovalTest 수정

Change-Id: Id8ad597480ff40f45ad204dfb285e224901398bd

차이점 보기:

KCOM_API_AutoStamping/AutoApprovalTest.aspx
17 17
        <tr>
18 18
        <td>Project No :</td>
19 19
        <td>
20
        <asp:TextBox ID="txtproject_no" runat="server"></asp:TextBox>
20
       <%-- <asp:TextBox ID="txtproject_no" runat="server"></asp:TextBox>--%>
21
            <asp:DropDownList ID="PROJECT_LIST" runat="server" AutoPostBack="true"></asp:DropDownList>
21 22
        </td>
22 23
         <td>
23
             <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"   
24
         <%--    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"   
24 25
            ControlToValidate="txtproject_no" ErrorMessage="Project No required" ForeColor="Red"></asp:RequiredFieldValidator>
25
             </td>
26
             </td>--%>
26 27
        </tr>
27 28
        <tr>
28 29
        <td>Slip No :</td>
......
38 39
        <tr>
39 40
        <td>User ID :</td>
40 41
        <td>
41
        <asp:TextBox ID="txtuser_id" runat="server"></asp:TextBox>
42
        <asp:TextBox ID="txtuser_id" AutoPostBack="true" runat="server"></asp:TextBox>
42 43
        </td>
43 44
              <td>
44 45
             <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"   
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
}
KCOM_API_AutoStamping/AutoApprovalTest.aspx.designer.cs
22 22
        protected global::System.Web.UI.HtmlControls.HtmlForm form1;
23 23
        
24 24
        /// <summary>
25
        /// txtproject_no 컨트롤입니다.
25
        /// PROJECT_LIST 컨트롤입니다.
26 26
        /// </summary>
27 27
        /// <remarks>
28 28
        /// 자동 생성 필드입니다.
29 29
        /// 수정하려면 디자이너 파일에서 코드 숨김 파일로 필드 선언을 이동하세요.
30 30
        /// </remarks>
31
        protected global::System.Web.UI.WebControls.TextBox txtproject_no;
32
        
33
        /// <summary>
34
        /// RequiredFieldValidator1 컨트롤입니다.
35
        /// </summary>
36
        /// <remarks>
37
        /// 자동 생성 필드입니다.
38
        /// 수정하려면 디자이너 파일에서 코드 숨김 파일로 필드 선언을 이동하세요.
39
        /// </remarks>
40
        protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
31
        protected global::System.Web.UI.WebControls.DropDownList PROJECT_LIST;
41 32
        
42 33
        /// <summary>
43 34
        /// txtslip_no 컨트롤입니다.
KCOM_API_AutoStamping/AutoStamping.svc.cs
70 70
            return result;
71 71
        }
72 72

  
73
        [OperationContract]
74
        public ProjectInfo[] GetProjectList()
75
        {
76
            ProjectInfo[] result = null;
77

  
78
            try
79
            {
80
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
81
                {
82
                    result = _entity.RUN_PROJECTS.ToList().Select(x => new ProjectInfo { No = x.PROJECT_NO, Name = $"{x.PROJECT_NO} - {x.PROJECT_NAME}"}).ToArray();
83
                }
84

  
85
            }
86
            catch (Exception)
87
            {
88
            }
89

  
90
            return result;
91
        }
92

  
73 93
        /// <summary>
74 94
        /// 심볼로 변경
75 95
        /// </summary>
......
114 134
                        var user = GetSelectMember(cIEntity, project_no, slip_no, user_id);
115 135

  
116 136

  
117
                        if (user.IS_ORIGINATOR == 0)
137
                        if (user.SLIP_COUNT == 0)
118 138
                        {
119
                            result = "You are not an originator of the slip.";
139
                            result = "Slip No does not exist.";
120 140
                        }
121 141
                        else
122 142
                        {
123
                            if (user.USER_NAME == null)
143
                            if (user.IS_ORIGINATOR == 0)
124 144
                            {
125
                                result = "user name IS NULL.";
145
                                result = "User ID is not the Originator for that Slip No.";
126 146
                            }
127 147
                            else
128 148
                            {
129
                                userName = user.USER_NAME;
130

  
131
                                foreach (DOCUMENT_ITEM dOCUMENTITEM in list)
149
                                if (user.USER_NAME == null)
132 150
                                {
133
                                    DOCINFO dOCINFO = (
134
                                        from x in cIEntity.DOCINFO
135
                                        where x.PROJECT_NO == project_no && x.DOCUMENT_ID == dOCUMENTITEM.DOCUMENT_ID
136
                                        select x).FirstOrDefault<DOCINFO>();
137

  
138
                                    MARKUP_INFO mARKUPINFO = (
139
                                        from x in cIEntity.MARKUP_INFO
140
                                        where x.DOCINFO_ID == dOCINFO.ID && x.AVOID_CONSOLIDATE == 0 && x.CONSOLIDATE == 1
141
                                        select x).FirstOrDefault<MARKUP_INFO>();
151
                                    result = "user name IS NULL.";
152
                                }
153
                                else
154
                                {
155
                                    userName = user.USER_NAME;
142 156

  
143
                                    if (mARKUPINFO == null)
157
                                    foreach (DOCUMENT_ITEM dOCUMENTITEM in list)
144 158
                                    {
145
                                        var pageInfo = dOCINFO.DOCPAGE.First();
159
                                        DOCINFO dOCINFO = (
160
                                            from x in cIEntity.DOCINFO
161
                                            where x.PROJECT_NO == project_no && x.DOCUMENT_ID == dOCUMENTITEM.DOCUMENT_ID
162
                                            select x).FirstOrDefault<DOCINFO>();
146 163

  
147
                                        mARKUPINFO = new MARKUP_INFO()
148
                                        {
149
                                            ID = shortGuid(),
150
                                            DOCINFO_ID = dOCINFO.ID,
151
                                            USER_ID = user_id,
152
                                            CREATE_TIME = DateTime.Now,
153
                                            CONSOLIDATE = 1,
154
                                            AVOID_CONSOLIDATE = 0,
155
                                            PART_CONSOLIDATE = 0,
156
                                            DESCRIPTION = "",
157
                                            UPDATE_TIME = new DateTime?(DateTime.Now),
158
                                        };
159

  
160
                                        cIEntity.MARKUP_INFO.AddObject(mARKUPINFO);
161

  
162
                                        MARKUP_INFO_VERSION mARKUPINFOVERSION = new MARKUP_INFO_VERSION()
164
                                        MARKUP_INFO mARKUPINFO = (
165
                                            from x in cIEntity.MARKUP_INFO
166
                                            where x.DOCINFO_ID == dOCINFO.ID && x.AVOID_CONSOLIDATE == 0 && x.CONSOLIDATE == 1
167
                                            select x).FirstOrDefault<MARKUP_INFO>();
168

  
169
                                        if (mARKUPINFO == null)
163 170
                                        {
164
                                            ID = shortGuid(),
165
                                            MARKUPINFO_ID = mARKUPINFO.ID,
166
                                            CREATE_DATE = DateTime.Now
167
                                        };
171
                                            var pageInfo = dOCINFO.DOCPAGE.First();
168 172

  
169
                                        cIEntity.MARKUP_INFO_VERSION.AddObject(mARKUPINFOVERSION);
173
                                            mARKUPINFO = new MARKUP_INFO()
174
                                            {
175
                                                ID = shortGuid(),
176
                                                DOCINFO_ID = dOCINFO.ID,
177
                                                USER_ID = user_id,
178
                                                CREATE_TIME = DateTime.Now,
179
                                                CONSOLIDATE = 1,
180
                                                AVOID_CONSOLIDATE = 0,
181
                                                PART_CONSOLIDATE = 0,
182
                                                DESCRIPTION = "",
183
                                                UPDATE_TIME = new DateTime?(DateTime.Now),
184
                                            };
170 185

  
171
                                        Point startPoint = new Point(15, 15);
186
                                            cIEntity.MARKUP_INFO.AddObject(mARKUPINFO);
172 187

  
173
                                        var symCtrl = GetSymNControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID, startPoint, _stampData);
188
                                            MARKUP_INFO_VERSION mARKUPINFOVERSION = new MARKUP_INFO_VERSION()
189
                                            {
190
                                                ID = shortGuid(),
191
                                                MARKUPINFO_ID = mARKUPINFO.ID,
192
                                                CREATE_DATE = DateTime.Now
193
                                            };
174 194

  
175
                                        var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height));
195
                                            cIEntity.MARKUP_INFO_VERSION.AddObject(mARKUPINFOVERSION);
176 196

  
177
                                        var txtOriginator = GetTextControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID
178
                                                       , userName, 20, System.Windows.Media.Color.FromArgb(255, 0, 0, 255), FontWeights.Bold, TextAlignment.Center, bottom, bottom.Top + 3);
197
                                            Point startPoint = new Point(15, 15);
179 198

  
180
                                        var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" };
199
                                            var symCtrl = GetSymNControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID, startPoint, _stampData);
181 200

  
182
                                        var txtDate = GetTextControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID
183
                                                       , DateTime.Now.ToString("d", dtfi), 20,System.Windows.Media.Color.FromArgb(255, 255, 0, 0), FontWeights.Bold, TextAlignment.Center, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2);
201
                                            var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height));
184 202

  
185
                                        var symData = symCtrl.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID);
186
                                        cIEntity.MARKUP_DATA.AddObject(symData);
187
                                        cIEntity.MARKUP_DATA.AddObject(txtOriginator.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID));
188
                                        cIEntity.MARKUP_DATA.AddObject(txtDate.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID));
189
                                    }
190
                                    cIEntity.SaveChanges();
203
                                            var txtOriginator = GetTextControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID
204
                                                           , userName, 20, System.Windows.Media.Color.FromArgb(255, 0, 0, 255), FontWeights.Bold, TextAlignment.Center, bottom, bottom.Top + 3);
191 205

  
206
                                            var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" };
192 207

  
193
                                    this.SetFinalPDF(project_no, dOCINFO.ID, mARKUPINFO.ID, user_id);
208
                                            var txtDate = GetTextControl(Convert.ToDouble(pageInfo.PAGE_WIDTH), Convert.ToDouble(pageInfo.PAGE_HEIGHT), mARKUPINFO.USER_ID, mARKUPINFO.ID
209
                                                           , DateTime.Now.ToString("d", dtfi), 20, System.Windows.Media.Color.FromArgb(255, 255, 0, 0), FontWeights.Bold, TextAlignment.Center, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2);
210

  
211
                                            var symData = symCtrl.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID);
212
                                            cIEntity.MARKUP_DATA.AddObject(symData);
213
                                            cIEntity.MARKUP_DATA.AddObject(txtOriginator.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID));
214
                                            cIEntity.MARKUP_DATA.AddObject(txtDate.GetMarkupData(mARKUPINFO.USER_ID, 1, mARKUPINFOVERSION.ID));
215
                                        }
216
                                        cIEntity.SaveChanges();
217

  
218

  
219
                                        this.SetFinalPDF(project_no, dOCINFO.ID, mARKUPINFO.ID, user_id);
220
                                    }
194 221
                                }
195 222
                            }
196 223
                        }
......
700 727
        /// 0보다 크면 originator
701 728
        /// </summary>
702 729
        public int IS_ORIGINATOR { get; set; }
730

  
731
        /// <summary>
732
        /// 해당 SLIP NO가 있는지
733
        /// </summary>
734
        public int SLIP_COUNT { get; set; }
735
    }
736

  
737

  
738
    [DataContract]
739
    public class ProjectInfo
740
    {
741
        [DataMember]
742
        public string No { get; set; }
743

  
744
        [DataMember]
745
        public string Name { get; set; }
703 746
    }
704 747
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)