using System; using System.Net.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Text; using System.Diagnostics; using System.Globalization; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; // Interface for Web Service Program JSPG2A // Generated by MANASYS Jazz from Visual Studio at 8/12/2020 4:12:17 PM, User JAZZUSR namespace MyJSv { public class JSPG2AClient { // Private - objects that are not known outside the Client object static readonly HttpClient client = new HttpClient(); private RequestJSPG2A Request = new RequestJSPG2A(); // Actual request message private ResponseJSPG2A Response = new ResponseJSPG2A(); // Actual response message private int IXT1Sub = 0; // Used if response has >1 occurrences of Table 1 struct SetByUser { public bool Skip; public bool EMPNO; public bool FIRSTNME; public bool MIDINIT; public bool LASTNAME; public bool WORKDEPT; public bool PHONENO; public bool HIREDATE; public bool JOB; public bool EDLEVEL; public bool SEX; public bool BIRTHDATE; public bool SALARY; public bool BONUS; public bool COMM; public bool CURRENCY; public bool DEPTMGR; } private SetByUser Changed = new SetByUser(); private string _Function = null; private string Function // => Request.Function { get => _Function; set { if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _Function = InList(value, new[] { "E", "U", "A", "D" }, true, "Function"); Request.JSPG2A.IJSPG2A.JZ_Function = _Function; } } private string _Checksum = null; // Key Properties - fields used by methods to access records private string _Skip = null; public string Skip // => Request.Skip { get => _Skip; set { Changed.Skip = true; _Skip = null; if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _Skip = IsInt(value, 0, 999, "Skip"); Request.JSPG2A.IJSPG2A.JZ_Employee_Skip = int.Parse(_Skip); } } private string _EMPNO = null; public string EMPNO // => Request.EMPNO { get => _EMPNO; set { Changed.EMPNO = true; _EMPNO = null; if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _EMPNO = IsInt(value, 0, 999999, "EMPNO"); Request.JSPG2A.IJSPG2A.JZ_Employee.EMPNO = _EMPNO; } } private string _WORKDEPT = null; public string WORKDEPT // => Request.WORKDEPT { get => _WORKDEPT; set { Changed.WORKDEPT = true; _WORKDEPT = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _WORKDEPT = "nul"; else _WORKDEPT = IsNoLongerThan(value, 3, "WORKDEPT"); Request.JSPG2A.IJSPG2A.JZ_Employee.WORKDEPT = _WORKDEPT; } } // I/O Data - non-key fields that may be set for update and add, will be set in response private string _FIRSTNME = null; public string FIRSTNME // => Request.FIRSTNME { get => _FIRSTNME; set { Changed.FIRSTNME = true; _FIRSTNME = null; if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _FIRSTNME = IsNoLongerThan(value, 12, "FIRSTNME"); Request.JSPG2A.IJSPG2A.JZ_Employee.FIRSTNME = _FIRSTNME; } } private string _MIDINIT = null; public string MIDINIT // => Request.MIDINIT { get => _MIDINIT; set { Changed.MIDINIT = true; _MIDINIT = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _MIDINIT = "n"; else _MIDINIT = IsNoLongerThan(value, 1, "MIDINIT"); Request.JSPG2A.IJSPG2A.JZ_Employee.MIDINIT = _MIDINIT; } } private string _LASTNAME = null; public string LASTNAME // => Request.LASTNAME { get => _LASTNAME; set { Changed.LASTNAME = true; _LASTNAME = null; if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _LASTNAME = IsNoLongerThan(value, 15, "LASTNAME"); Request.JSPG2A.IJSPG2A.JZ_Employee.LASTNAME = _LASTNAME; } } private string _PHONENO = null; public string PHONENO // => Request.PHONENO { get => _PHONENO; set { Changed.PHONENO = true; _PHONENO = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _PHONENO = "null"; else _PHONENO = IsInt(value, 0, 9999, "PHONENO"); Request.JSPG2A.IJSPG2A.JZ_Employee.PHONENO = _PHONENO; } } private string _HIREDATE = null; public string HIREDATE // => Request.HIREDATE { get => _HIREDATE; set { Changed.HIREDATE = true; _HIREDATE = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; string ReqValue = ""; _HIREDATE = IsDate(value, "HIREDATE", ref ReqValue); //Date Request.JSPG2A.IJSPG2A.JZ_Employee.HIREDATE = ReqValue; } } private string _JOB = null; public string JOB // => Request.JOB { get => _JOB; set { Changed.JOB = true; _JOB = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _JOB = "null"; else _JOB = IsNoLongerThan(value, 8, "JOB"); Request.JSPG2A.IJSPG2A.JZ_Employee.JOB = _JOB; } } private string _EDLEVEL = null; public string EDLEVEL // => Request.EDLEVEL { get => _EDLEVEL; set { Changed.EDLEVEL = true; _EDLEVEL = null; if (value == "") { _Error = "Value required"; _JZ_Employee_ReturnCode = "E"; return; } _EDLEVEL = IsInt(value, -32767, 32767, "EDLEVEL"); Request.JSPG2A.IJSPG2A.JZ_Employee.EDLEVEL = _EDLEVEL; } } private string _SEX = null; public string SEX // => Request.SEX { get => _SEX; set { Changed.SEX = true; _SEX = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _SEX = "n"; else _SEX = InList(value, new[] { "M", "F" }, true, "SEX"); Request.JSPG2A.IJSPG2A.JZ_Employee.SEX = _SEX; } } public string SEX_Value // => Request.SEX_Value { get { if (_SEX == "M") return "Male"; if (_SEX == "F") return "Female"; return ""; } } private string _BIRTHDATE = null; public string BIRTHDATE // => Request.BIRTHDATE { get => _BIRTHDATE; set { Changed.BIRTHDATE = true; _BIRTHDATE = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; string ReqValue = ""; _BIRTHDATE = IsDate(value, "BIRTHDATE", ref ReqValue); //Date Request.JSPG2A.IJSPG2A.JZ_Employee.BIRTHDATE = ReqValue; } } private string _SALARY = null; public string SALARY // => Request.SALARY { get => _SALARY; set { Changed.SALARY = true; _SALARY = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _SALARY = "null"; else _SALARY = IsFloat(value, 0, 9999999, "SALARY"); Request.JSPG2A.IJSPG2A.JZ_Employee.SALARY = _SALARY; } } private string _BONUS = null; public string BONUS // => Request.BONUS { get => _BONUS; set { Changed.BONUS = true; _BONUS = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _BONUS = "null"; else _BONUS = IsFloat(value, 0, 9999999, "BONUS"); Request.JSPG2A.IJSPG2A.JZ_Employee.BONUS = _BONUS; } } private string _COMM = null; public string COMM // => Request.COMM { get => _COMM; set { Changed.COMM = true; _COMM = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _COMM = "null"; else _COMM = IsFloat(value, 0, 9999999, "COMM"); Request.JSPG2A.IJSPG2A.JZ_Employee.COMM = _COMM; } } private string _CURRENCY = null; public string CURRENCY // => Request.CURRENCY { get => _CURRENCY; set { Changed.CURRENCY = true; _CURRENCY = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; if (value == "null") _CURRENCY = "nul"; else _CURRENCY = IsNoLongerThan(value, 3, "CURRENCY"); Request.JSPG2A.IJSPG2A.JZ_Employee.JZ_CURRENCY = _CURRENCY; } } private string _DEPTMGR = null; public string DEPTMGR // => Request.DEPTMGR { get => _DEPTMGR; set { Changed.DEPTMGR = true; _DEPTMGR = null; if (value == "" || value == "n" || value == "nu" || value == "nul") return; string ReqValue = "N"; _DEPTMGR = IsBool(value, "DEPTMGR", ref ReqValue); Request.JSPG2A.IJSPG2A.JZ_Employee.DEPTMGR = ReqValue; } } // Output data - readonly properties that are set from response, e.g. Message private string _Error = null; public string Error // Readonly { get => _Error; } private string _JZ_Employee_ReadTo = null; public string JZ_Employee_ReadTo // Readonly { get => _JZ_Employee_ReadTo; } private string _JZ_Employee_NbrReturned = null; public string JZ_Employee_NbrReturned // Readonly { get => _JZ_Employee_NbrReturned; } private string _JZ_Employee_BrowseCount = null; public string JZ_Employee_BrowseCount // Readonly { get => _JZ_Employee_BrowseCount; } private string _JZ_Employee_ReturnCode = null; public string JZ_Employee_ReturnCode // Readonly { get => _JZ_Employee_ReturnCode; } public string JZ_Employee_ReturnCode_Value // => Request.JZ_Employee_ReturnCode_Value { get { if (_JZ_Employee_ReturnCode == "' '") return "' '"; if (_JZ_Employee_ReturnCode == "W") return "Warning"; if (_JZ_Employee_ReturnCode == "E") return "Error"; if (_JZ_Employee_ReturnCode == "S") return "'Serious Error'"; if (_JZ_Employee_ReturnCode == "T") return "'Terminal Error'"; if (_JZ_Employee_ReturnCode == "A") return "Absent"; if (_JZ_Employee_ReturnCode == "C") return "Changed"; if (_JZ_Employee_ReturnCode == "D") return "Deleted"; if (_JZ_Employee_ReturnCode == "F") return "First"; if (_JZ_Employee_ReturnCode == "I") return "Inserted"; if (_JZ_Employee_ReturnCode == "L") return "Last"; if (_JZ_Employee_ReturnCode == "N") return "Nth"; if (_JZ_Employee_ReturnCode == "U") return "Unique"; return ""; } } // Functions used to check input properties // Methods. Usually related to Function, e.g. Function CHAR(1) CAPS CODES(E:Enquiry, U:Update, A:Add, D:Delete) will have // Enquiry, Update, Add, and Delete methods private string InList(string Funct, string[] VList, bool Upcase, string FieldName) { _Error = ""; _JZ_Employee_ReturnCode = ""; if (Upcase) Funct = Funct.ToUpper(); foreach (string X in VList) { if (X == Funct) return Funct; } _Error = FieldName + " Value out of range"; _JZ_Employee_ReturnCode = "E"; return ""; } private string IsInt(string Value, int MinVal, int maxval, string FieldName) { _Error = ""; _JZ_Employee_ReturnCode = ""; if (Value == "") return "0"; int IX = 0; if (!int.TryParse(Value, out IX)) { _Error = FieldName + " Value is Not Numeric"; _JZ_Employee_ReturnCode = "E"; } else if (IX < MinVal || IX > maxval) { _Error = FieldName + " Value out of range"; _JZ_Employee_ReturnCode = "E"; } return Value; } private string IsNoLongerThan(string Value, int MaxLen, string FieldName) { _Error = ""; _JZ_Employee_ReturnCode = ""; if (Value.Length > MaxLen) { _Error = FieldName + " Value is too long"; _JZ_Employee_ReturnCode = "W"; return Value.Substring(0, MaxLen); } return Value; } private string IsDate(string Value, string FieldName, ref string ReqValue) // Validate Date { _Error = ""; _JZ_Employee_ReturnCode = ""; if (Value == "") return "0"; if (Value == "null") { ReqValue = "null"; return "null"; } // Dates are entered according to the local culture, or as Jazz Format // Jazz format is ccyymmdd, i.e. 20210317 = 17th March 2021 DateTime DT; int IX = 0; if (int.TryParse(Value, out IX)) // Jazz format { if (Value.Length < 8) { _Error = FieldName + " integer-form date must be 8 digits"; _JZ_Employee_ReturnCode = "E"; return Value; } int Year = int.Parse(Value.Substring(0, 4)); int Month = int.Parse(Value.Substring(4, 2)); int Day = int.Parse(Value.Substring(6, 2)); try { DT = new DateTime(Year, Month, Day); ReqValue = Year.ToString("0000") + Month.ToString("00") + Day.ToString("00"); return DT.ToString("d"); } catch { _Error = FieldName + " Year:" + Year + ", Month:" + Month + ", Day:" + Day + " not a valid date"; _JZ_Employee_ReturnCode = "E"; } return Value; } if (!DateTime.TryParse(Value, out DT)) { _Error = FieldName + " Value is Not a date"; _JZ_Employee_ReturnCode = "E"; } ReqValue = DT.Year.ToString("0000") + DT.Month.ToString("00") + DT.Day.ToString("00"); return Value; } private string DateValue(string InputValue) // Display Jazz-Format Date as in local culture date { if (InputValue == "0") return "0"; int IX; if (InputValue.Length != 8 || !int.TryParse(InputValue, out IX)) { return InputValue + " invalid date"; } else { int Year = int.Parse(InputValue.Substring(0, 4)); int Month = int.Parse(InputValue.Substring(4, 2)); int Day = int.Parse(InputValue.Substring(6, 2)); try { DateTime DT = new DateTime(Year, Month, Day); return DT.ToString("d"); } catch { return InputValue + " invalid date"; } } } private string IsFloat(string Value, int MinVal, int maxval, string FieldName) { _Error = ""; _JZ_Employee_ReturnCode = ""; string C = NumberFormatInfo.CurrentInfo.CurrencySymbol; string V2 = Value.Replace(C, ""); if (V2 == "") return "0"; float X = 0; if (!float.TryParse(V2, out X)) { _Error = FieldName + " Value is Not Numeric"; _JZ_Employee_ReturnCode = "E"; } else if (X < MinVal || X > maxval) { _Error = FieldName + " Value out of range"; _JZ_Employee_ReturnCode = "E"; } return Value; } private string IsBool(string Value, string FieldName, ref string ReqValue) { _Error = ""; _JZ_Employee_ReturnCode = ""; if (Value == "null") { ReqValue = "null"; return "null"; } // Request: COBOL-side values are Y or N ReqValue = "N"; has been set before IsBool reference string V1; if (Value.Length == 1) { V1 = Value.ToUpper(); if (V1 == "T" || V1 == "Y") { ReqValue = "Y"; return "True"; } else if (V1 == "F" || V1 == "N") { return "False"; } } // Invalid _Error = FieldName + " Enter t or f"; _JZ_Employee_ReturnCode = "E"; return Value; } private string BoolValue(string InputValue) // Display Y as True, anything else as False { if (InputValue == "Y") { return "True"; } else { return "False"; } } // Standard Response Properties private System.Net.HttpStatusCode _StatusCode; public int StatusCode { get => (int)_StatusCode; } public string StatusCode_Value { get => _StatusCode.ToString(); } private bool _IsSuccessStatusCode; public string IsSuccessStatusCode { get => _IsSuccessStatusCode.ToString(); } private string _ReasonPhrase = null; public string ReasonPhrase { get => _ReasonPhrase; } private string _RawResponse = null; // blank except when unsuccessful request public string RawResponse { get => _RawResponse; } // Common Request/Response logic public bool RequestResponse(bool DoAssignToProperties = true) { try { var json = JsonConvert.SerializeObject(Request); var data = new StringContent(json, Encoding.UTF8, "application/json"); var url = "http://localhost:9003/cics/services/JSPG2A"; var response = client.PostAsync(url, data).Result; String result = response.Content.ReadAsStringAsync().Result; _StatusCode = response.StatusCode; _ReasonPhrase = response.ReasonPhrase; _IsSuccessStatusCode = response.IsSuccessStatusCode; _RawResponse = null; IXT1Sub = 0; if (response.IsSuccessStatusCode) { Response = JsonConvert.DeserializeObject(result); if (DoAssignToProperties) AssignResponseToProperties(true); else { _Error = Response.JSPG2AResponse.OJSPG2A.JZ_Error.JZD_Error; _JZ_Employee_ReturnCode = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].JZ_Employee_ReturnCode; } return true; } // Faulty Response, hasn't thrown an exception AssignResponseToProperties(true); _RawResponse = result; _JZ_Employee_ReturnCode = "S"; _Error = response.ReasonPhrase; return false; } catch (Exception e) { _JZ_Employee_ReturnCode = "S"; _Error = e.Message; return false; } } public bool Enquiry(string PSkip = null,string PEMPNO = null,string PWORKDEPT = null) { _Error = ""; _JZ_Employee_ReturnCode = ""; return DoRead(PSkip,PEMPNO,PWORKDEPT); } public bool ReadNext(string PSkip = null,string PWORKDEPT = null) { return Scroll(1, PSkip,PWORKDEPT); } public bool ReadLast(string PWORKDEPT = null) { int PSkip; int.TryParse(JZ_Employee_BrowseCount, out PSkip); PSkip -= 1; return Scroll(PSkip, "", PWORKDEPT); } public bool ReadPrev(string PSkip = null,string PWORKDEPT = null) { return Scroll(-1, PSkip,PWORKDEPT); } public bool ReadFirst(string PWORKDEPT = null) { return Scroll(0, "", PWORKDEPT); } private bool Scroll(int Increment, string PSkip = null,string PWORKDEPT = null) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); _Error = ""; _JZ_Employee_ReturnCode = ""; Response.JSPG2AResponse.OJSPG2A.JZ_Error.JZD_Error = ""; int Skip; int.TryParse(PSkip, out Skip); Skip += Increment; int BrowseCount; int.TryParse(JZ_Employee_BrowseCount, out BrowseCount); if (Skip < 0 || Skip > BrowseCount) { _Error = "Skip Value out of Range. BrowseCount = " + BrowseCount.ToString(); _JZ_Employee_ReturnCode = "E"; return false; } while (Skip >= Response.JSPG2AResponse.OJSPG2A.JZ_Employee.Count) { // Add next chunk of JZ_Employee to previously-read chunk(s) List T1Save = Response.JSPG2AResponse.OJSPG2A.JZ_Employee; string NextSkip = Response.JSPG2AResponse.OJSPG2A.JZ_Employee.Count.ToString(); if (DoRead(NextSkip, "", PWORKDEPT)) { int Limit = Response.JSPG2AResponse.OJSPG2A.JZ_Employee_NbrReturned; for (int IX = 0; IX < Limit; IX += 1) { T1Save.Add(Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IX]); } Response.JSPG2AResponse.OJSPG2A.JZ_Employee = T1Save; } } IXT1Sub = Skip; AssignResponseToProperties(true); PSkip = Skip.ToString(); _Skip = PSkip; stopwatch.Stop(); Debug.Print("Scroll Stopwatch: ms=" + stopwatch.ElapsedMilliseconds.ToString()); return true; } public bool DoRead(string PSkip = null,string PEMPNO = null,string PWORKDEPT = null) { //For Enquiry at least one key field must be given. With duplicate keys (DKEY) scrolling is a possibility. if (PEMPNO == null && PWORKDEPT == null) { _Error = "EMPNO or WORKDEPT required for Enquiry"; _JZ_Employee_ReturnCode = "E"; return false; } if (PEMPNO == "") { EMPNO = ""; WORKDEPT = PWORKDEPT; Skip = PSkip; } else { EMPNO = PEMPNO; } Function = "E"; AddPrivateFieldsToRequest(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); bool Result = RequestResponse(); stopwatch.Stop(); Debug.Print("RequestResponse Stopwatch: ms=" + stopwatch.ElapsedMilliseconds.ToString()); return Result; } public bool Update(string PEMPNO = null) { _Error = ""; _JZ_Employee_ReturnCode = ""; //Update must follow Enquiry. // Validate Argument(s) if (PEMPNO == null) _Error = "EMPNO required for Update"; else if (PEMPNO != EMPNO) _Error = "EMPNO must not change"; if (_Error != "") { _JZ_Employee_ReturnCode = "E"; return false; } // Set Key and Function EMPNO = PEMPNO; Function = "U"; AddPrivateFieldsToRequest(); bool Result = false; int BrowseCount; int.TryParse(_JZ_Employee_BrowseCount, out BrowseCount); if (BrowseCount < 2) { Result = RequestResponse(); } else { // Update follows Browse. Restore browsing position after update List T1Save = Response.JSPG2AResponse.OJSPG2A.JZ_Employee; int Sub = IXT1Sub; Result = RequestResponse(); if (Result) // Successful update. Replace corresponding record in T1Save with updated values { ResponseJSPG2A.JSPG2AResponse_.OJSPG2A_.JZ_Employee_ UpdatedRecord = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[0]; int IX = 0; foreach (ResponseJSPG2A.JSPG2AResponse_.OJSPG2A_.JZ_Employee_ Record in T1Save) { if (Record.EMPNO == UpdatedRecord.EMPNO) { UpdatedRecord.JZ_Employee_ReturnCode = Record.JZ_Employee_ReturnCode; T1Save[IX] = UpdatedRecord; break; } IX++; } } IXT1Sub = Sub; _Skip = Sub.ToString(); Response.JSPG2AResponse.OJSPG2A.JZ_Employee = T1Save; Response.JSPG2AResponse.OJSPG2A.JZ_Employee_BrowseCount = BrowseCount; } _JZ_Employee_ReturnCode = "C"; _JZ_Employee_BrowseCount = BrowseCount.ToString(); return Result; } public bool Add(string PEMPNO = null) { _Error = ""; _JZ_Employee_ReturnCode = ""; // Validate Argument(s) // Set Key and Function EMPNO = PEMPNO; Function = "A"; AddPrivateFieldsToRequest(); bool Result = false; int BrowseCount; int.TryParse(_JZ_Employee_BrowseCount, out BrowseCount); if (BrowseCount < 2) { Result = RequestResponse(); } else { // Add follows Browse. Ensure that browsing can continue List T1Save = Response.JSPG2AResponse.OJSPG2A.JZ_Employee; int Sub = 0; if (BrowseCount == T1Save.Count) Sub = BrowseCount - 1; // Non-zero => Add new record to T1String Result = RequestResponse(); if (Sub > 0) // Add new record { T1Save.Add(Response.JSPG2AResponse.OJSPG2A.JZ_Employee[0]); T1Save[Sub].JZ_Employee_ReturnCode = "N"; Sub += 1; T1Save[Sub].JZ_Employee_ReturnCode = "L"; } Response.JSPG2AResponse.OJSPG2A.JZ_Employee = T1Save; Response.JSPG2AResponse.OJSPG2A.JZ_Employee_BrowseCount = BrowseCount; } BrowseCount += 1; _JZ_Employee_BrowseCount = BrowseCount.ToString(); _JZ_Employee_ReturnCode = "I"; return Result; } public bool Delete(string PEMPNO = null) { _Error = ""; _JZ_Employee_ReturnCode = ""; // Validate Argument(s) if (PEMPNO == null) _Error = "EMPNO required for Delete"; else if (PEMPNO != EMPNO) _Error = "EMPNO must not change"; if (_Error != "") { _JZ_Employee_ReturnCode = "E"; return false; } // Set Key and Function EMPNO = PEMPNO; Function = "D"; AddPrivateFieldsToRequest(); bool Result = false; int BrowseCount; int.TryParse(_JZ_Employee_BrowseCount, out BrowseCount); if (BrowseCount < 2) { Result = RequestResponse(false); } else { // Delete follows Browse. Ensure that browsing can continue List T1Save = Response.JSPG2AResponse.OJSPG2A.JZ_Employee; int Sub = T1Save.Count; if (BrowseCount == T1Save.Count) Sub = BrowseCount - 1; Result = RequestResponse(false); // Delete record if (Sub > 0 && Response.JSPG2AResponse.OJSPG2A.JZ_Employee[0].JZ_Employee_ReturnCode != "E") { // Locate and delete record from T1Save to match database in web service int ix = 0; foreach (ResponseJSPG2A.JSPG2AResponse_.OJSPG2A_.JZ_Employee_ item in T1Save) { if (item.EMPNO == PEMPNO) { break; } else { ix++; } } if (ix == 0) { T1Save[1].JZ_Employee_ReturnCode = "F"; } if (T1Save[ix].JZ_Employee_ReturnCode == "L") { int ix2 = ix - 1; T1Save[ix2].JZ_Employee_ReturnCode = "L"; } T1Save.RemoveAt(ix); } Response.JSPG2AResponse.OJSPG2A.JZ_Employee = T1Save; } Response.JSPG2AResponse.OJSPG2A.JZ_Employee_BrowseCount = BrowseCount; BrowseCount -= 1; _JZ_Employee_BrowseCount = BrowseCount.ToString(); _JZ_Employee_ReturnCode = "D"; return Result; } // Routines. Functions and Subroutine used by methods private bool ResetChanged() { Changed.Skip = false; Changed.EMPNO = false; Changed.FIRSTNME = false; Changed.MIDINIT = false; Changed.LASTNAME = false; Changed.WORKDEPT = false; Changed.PHONENO = false; Changed.HIREDATE = false; Changed.JOB = false; Changed.EDLEVEL = false; Changed.SEX = false; Changed.BIRTHDATE = false; Changed.SALARY = false; Changed.BONUS = false; Changed.COMM = false; Changed.CURRENCY = false; Changed.DEPTMGR = false; return true; } private void AssignResponseToProperties(bool BrowseCount) { ResetChanged(); // Mark all properties as 'Unchanged By User' ClearRequest(); // Ensure no carry-forward data // Set properties From Response _Error = Response.JSPG2AResponse.OJSPG2A.JZ_Error.JZD_Error; _JZ_Employee_ReadTo = Response.JSPG2AResponse.OJSPG2A.JZ_Employee_ReadTo.ToString(); _JZ_Employee_NbrReturned = Response.JSPG2AResponse.OJSPG2A.JZ_Employee_NbrReturned.ToString(); if (BrowseCount) _JZ_Employee_BrowseCount = Response.JSPG2AResponse.OJSPG2A.JZ_Employee_BrowseCount.ToString(); _JZ_Employee_ReturnCode = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].JZ_Employee_ReturnCode; _EMPNO = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].EMPNO; _FIRSTNME = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].FIRSTNME.JZD_FIRSTNME; _MIDINIT = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].MIDINIT; _LASTNAME = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].LASTNAME.JZD_LASTNAME; _WORKDEPT = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].WORKDEPT; _PHONENO = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].PHONENO; _HIREDATE = DateValue(Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].HIREDATE.ToString()); _JOB = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].JOB; _EDLEVEL = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].EDLEVEL.ToString(); _SEX = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].SEX; _BIRTHDATE = DateValue(Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].BIRTHDATE.ToString()); _SALARY = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].SALARY.ToString("C2"); _BONUS = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].BONUS.ToString("C2"); _COMM = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].COMM.ToString("C2"); _CURRENCY = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].JZ_CURRENCY; _DEPTMGR = BoolValue(Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].DEPTMGR); _Checksum = Response.JSPG2AResponse.OJSPG2A.JZ_Employee[IXT1Sub].Checksum; } private void ClearRequest() { // Clear Request, to prevent data carry-over' Request.JSPG2A.IJSPG2A.JZ_Function = null; Request.JSPG2A.IJSPG2A.JZ_Employee_Skip = 0; Request.JSPG2A.IJSPG2A.JZ_Employee.EMPNO = null; Request.JSPG2A.IJSPG2A.JZ_Employee.FIRSTNME = null; Request.JSPG2A.IJSPG2A.JZ_Employee.MIDINIT = null; Request.JSPG2A.IJSPG2A.JZ_Employee.LASTNAME = null; Request.JSPG2A.IJSPG2A.JZ_Employee.WORKDEPT = null; Request.JSPG2A.IJSPG2A.JZ_Employee.PHONENO = null; Request.JSPG2A.IJSPG2A.JZ_Employee.HIREDATE = null; Request.JSPG2A.IJSPG2A.JZ_Employee.JOB = null; Request.JSPG2A.IJSPG2A.JZ_Employee.EDLEVEL = null; Request.JSPG2A.IJSPG2A.JZ_Employee.SEX = null; Request.JSPG2A.IJSPG2A.JZ_Employee.BIRTHDATE = null; Request.JSPG2A.IJSPG2A.JZ_Employee.SALARY = null; Request.JSPG2A.IJSPG2A.JZ_Employee.BONUS = null; Request.JSPG2A.IJSPG2A.JZ_Employee.COMM = null; Request.JSPG2A.IJSPG2A.JZ_Employee.JZ_CURRENCY = null; Request.JSPG2A.IJSPG2A.JZ_Employee.DEPTMGR = null; Request.JSPG2A.IJSPG2A.JZ_Employee.Checksum = null; } private void AddPrivateFieldsToRequest() { Request.JSPG2A.IJSPG2A.JZ_Employee.Checksum = _Checksum; } } }