private void initConfig() { xCGlC = new XcustLocationsMstTbl(); xCGlC.LAST_UPDATE_DATE = "LAST_UPDATE_DATE"; xCGlC.CREATION_DATE = "CREATION_DATE"; xCGlC.LOCATION_ID = "LOCATION_ID"; xCGlC.LOCATION_DETAILS_ID = "LOCATION_DETAILS_ID"; xCGlC.EFFECTIVE_START_DATE = "EFFECTIVE_START_DATE"; xCGlC.EFFECTIVE_END_DATE = "EFFECTIVE_END_DATE"; xCGlC.LOCATION_CODE = "LOCATION_CODE"; xCGlC.LOCATION_NAME = "LOCATION_NAME"; xCGlC.DESCRIPTION = "DESCRIPTION"; xCGlC.STYLE = "STYLE"; xCGlC.ADDRESS_LINE_1 = "ADDRESS_LINE_1"; xCGlC.ADDRESS_LINE_2 = "ADDRESS_LINE_2"; xCGlC.ADDRESS_LINE_3 = "ADDRESS_LINE_3"; xCGlC.ADDRESS_LINE_4 = "ADDRESS_LINE_4"; xCGlC.BUILDING = "BUILDING"; xCGlC.FLOOR_NUMBER = "FLOOR_NUMBER"; xCGlC.COUNTRY = "COUNTRY"; xCGlC.POSTAL_CODE = "POSTAL_CODE"; xCGlC.TIMEZONE_CODE = "TIMEZONE_CODE"; xCGlC.table = "XCUST_LOCATIONS_MST_TBL"; }
public String insertxCGlC(XcustLocationsMstTbl p) { String sql = "", chk = ""; if (selectDupPk(p.LOCATION_ID, p.LOCATION_DETAILS_ID)) { deletexCGlC(p.LOCATION_ID, p.LOCATION_DETAILS_ID); } chk = insert(p); return(chk); }
public void setXcustGlCTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1) { String uri = "", dump = ""; //HttpWebRequest request = CreateWebRequest(); XmlDocument soapEnvelopeXml = new XmlDocument(); const Int32 BufferSize = 128; String[] filePO; addListView("setXcustLocationMstTbl ", "Web Service", lv1, form1); //filePO = Cm.getFileinFolder(Cm.initC.PathZip); //String text = System.IO.File.ReadAllText(filePO[0]); //byte[] byteArraytext = Encoding.UTF8.GetBytes(text); //byte[] toEncodeAsBytestext = System.Text.ASCIIEncoding.ASCII.GetBytes(text); //String Arraytext = System.Convert.ToBase64String(toEncodeAsBytestext); //< soapenv:Envelope xmlns:soapenv = "http://schemas xmlsoap org/soap/envelope/" xmlns: v2 = "http://xmlns oracle com/oxp/service/v2" > uri = @" <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:pub='http://xmlns.oracle.com/oxp/service/PublicReportService'> " + "<soapenv:Header/> " + "<soapenv:Body> " + "<v2:runReport> " + "<v2:reportRequest> " + "<v2:attributeLocale>en-US</v2:attributeLocale> " + "<v2:attributeTemplate>XCUST_LOCATIONS_MST_REP</v2:attributeTemplate> " + "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_LOCATIONS_MST_REP.xdo</v2:reportAbsolutePath> " + "<pub:parameterNameValues> " + "<pub:item>" + "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " + "<pub:name>p_update_from</pub:name> " + "<pub:values> " + "<pub:item>" + Cm.initC.p_update_from + "</pub:item> " + "</pub:values> " + "</pub:item> " + "<pub:item> " + "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " + "<pub:name>p_update_to</pub:name> " + "<pub:values> " + "<pub:item>" + Cm.initC.p_update_to + "</pub:item> " + "</pub:values> " + "</pub:item> " + "</pub:parameterNameValues> " + "</v2:reportRequest> " + "<v2:userID>" + Cm.initC.usercloud + "</v2:userID> " + "<v2:password>" + Cm.initC.passcloud + "</v2:password> " + "</v2:runReport> " + "</soapenv:Body> " + "</soapenv:Envelope> "; //byte[] byteArray = Encoding.UTF8.GetBytes(envelope); byte[] byteArray = Encoding.UTF8.GetBytes(uri); addListView("setXcustLocationMstTbl Start", "Web Service", lv1, form1); // Construct the base 64 encoded string used as credentials for the service call byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Cm.initC.usercloud + ":" + Cm.initC.passcloud); string credentials = System.Convert.ToBase64String(toEncodeAsBytes); // Create HttpWebRequest connection to the service HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://eglj.fa.us2.oraclecloud.com/xmlpserver/services/PublicReportService"); // Configure the request content type to be xml, HTTP method to be POST, and set the content length request1.Method = "POST"; request1.ContentType = "text/xml;charset=UTF-8"; request1.ContentLength = byteArray.Length; // Configure the request to use basic authentication, with base64 encoded user name and password, to invoke the service. request1.Headers.Add("Authorization", "Basic " + credentials); // Set the SOAP action to be invoked; while the call works without this, the value is expected to be set based as per standards request1.Headers.Add("SOAPAction", "https://eglj.fa.us2.oraclecloud.com/xmlpserver/services/PublicReportService"); // Write the xml payload to the request Stream dataStream = request1.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); addListView("setXcustLocationMstTbl Request", "Web Service", lv1, form1); // Get the response and process it; In this example, we simply print out the response XDocument doc; string actNumber = ""; XDocument doc; using (WebResponse response = request1.GetResponse()) { addListView("setXcustLocationMstTbl Response", "Web Service", lv1, form1); using (Stream stream = response.GetResponseStream()) { doc = XDocument.Load(stream); foreach (XNode node in doc.DescendantNodes()) { if (node is XElement) { XElement element = (XElement)node; if (element.Name.LocalName.Equals("reportBytes")) { actNumber = element.ToString().Replace(@"<ns1:reportBytes xmlns:ns1=""http://xmlns.oracle.com/oxp/service/PublicReportService"">", ""); actNumber = actNumber.Replace("</reportBytes>", "").Replace("</result>", "").Replace(@"""", "").Replace("<>", ""); actNumber = actNumber.Replace("<reportBytes>", "").Replace("</ns1:reportBytes>", ""); } } } } } actNumber = actNumber.Trim(); actNumber = actNumber.IndexOf("<reportContentType>") >= 0 ? actNumber.Substring(0, actNumber.IndexOf("<reportContentType>")) : actNumber; addListView("setXcustLocationMstTbl Extract html", "Web Service", lv1, form1); byte[] data = Convert.FromBase64String(actNumber); string decodedString = Encoding.UTF8.GetString(data); //XElement html = XElement.Parse(decodedString); //string[] values = html.Descendants("table").Select(td => td.Value).ToArray(); //int row = -1; //var doc1 = new HtmlAgilityPack.HtmlDocument(); //doc1.LoadHtml(html.ToString()); //var nodesTable = doc1.DocumentNode.Descendants("tr"); String[] data1 = decodedString.Split('\n'); //foreach (var nodeTr in nodesTable) for (int row = 0; row < data1.Length; row++) { if (row == 0) { continue; } if (data1[row].Length <= 0) { continue; } String[] data2 = data1[row].Split(','); XcustLocationsMstTbl item = new XcustLocationsMstTbl(); //item.LAST_UPDATE_DATE = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[0].Trim()); //item.CREATION_DATE = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[1].Trim()); item.LOCATION_ID = data2[0].Trim(); item.LOCATION_DETAILS_ID = data2[1].Trim(); item.EFFECTIVE_START_DATE = xCGlCDB.xCGlC.dateTimeYearToDB1(data2[2].Trim()); item.EFFECTIVE_END_DATE = xCGlCDB.xCGlC.dateTimeYearToDB1(data2[3].Trim()); item.LOCATION_CODE = data2[19].Trim().Replace("\"", ""); item.LOCATION_NAME = data2[5].Trim().Replace("\"", ""); item.DESCRIPTION = data2[6].Trim().Replace("\"", ""); item.STYLE = data2[7].Trim().Replace("\"", ""); item.ADDRESS_LINE_1 = data2[8].Trim().Replace("\"", ""); item.ADDRESS_LINE_2 = data2[9].Trim().Replace("\"", ""); item.ADDRESS_LINE_3 = data2[10].Trim().Replace("\"", ""); item.ADDRESS_LINE_4 = data2[11].Trim().Replace("\"", ""); item.BUILDING = data2[12].Trim().Replace("\"", ""); item.FLOOR_NUMBER = data2[13].Trim().Replace("\"", ""); item.COUNTRY = data2[14].Trim().Replace("\"", ""); item.POSTAL_CODE = data2[15].Trim().Replace("\"", ""); item.TIMEZONE_CODE = data2[16].Trim().Replace("\"", ""); item.CREATION_DATE = xCGlCDB.xCGlC.dateTimeYearToDB1(data2[17].Trim()); item.LAST_UPDATE_DATE = xCGlCDB.xCGlC.dateTimeYearToDB1(data2[18].Trim()); //int VALUE_SET_ID = 0, VALUE_SET_CODE = 1, VALUE_ID = 2, VALUE = 3, DESCRIPTION = 4, ENABLED_FLAG = 5, LAST_UPDATE_DATE = 6, CREATION_DATE = 7; xCGlCDB.insertxCGlC(item); } Console.WriteLine(decodedString); }
public String insert(XcustLocationsMstTbl p) { String sql = "", chk = ""; try { //if (p.OrpChtNum.Equals("")) //{ // return ""; //} //p.RowNumber = selectMaxRowNumber(p.YearId); //p.Active = "1"; String last_update_by = "0", creation_by = "0"; sql = "Insert Into " + xCGlC.table + "(" + xCGlC.LOCATION_ID + "," + xCGlC.LOCATION_DETAILS_ID + "," + xCGlC.EFFECTIVE_START_DATE + "," + xCGlC.EFFECTIVE_END_DATE + "," + xCGlC.LOCATION_CODE + "," + xCGlC.LOCATION_NAME + "," + xCGlC.DESCRIPTION + "," + xCGlC.STYLE + "," + xCGlC.ADDRESS_LINE_1 + "," + xCGlC.ADDRESS_LINE_2 + "," + xCGlC.ADDRESS_LINE_3 + "," + xCGlC.ADDRESS_LINE_4 + "," + xCGlC.BUILDING + "," + xCGlC.FLOOR_NUMBER + "," + xCGlC.COUNTRY + "," + xCGlC.POSTAL_CODE + "," + xCGlC.TIMEZONE_CODE + "," + xCGlC.CREATION_DATE + "," + xCGlC.LAST_UPDATE_DATE + " " + ") " + "Values( " + p.LOCATION_ID + "," + p.LOCATION_DETAILS_ID + ",'" + p.EFFECTIVE_START_DATE + "','" + p.EFFECTIVE_END_DATE + "','" + p.LOCATION_CODE.Replace("|", ",") + "','" + p.LOCATION_NAME.Replace("|", ",") + "','" + p.DESCRIPTION + "','" + p.STYLE + "','" + p.ADDRESS_LINE_1.Replace("|", ",") + "','" + p.ADDRESS_LINE_2.Replace("|", ",") + "','" + p.ADDRESS_LINE_3.Replace("|", ",") + "','" + p.ADDRESS_LINE_4.Replace("|", ",") + "','" + p.BUILDING + "','" + p.FLOOR_NUMBER + "','" + p.COUNTRY + "','" + p.POSTAL_CODE + "','" + p.TIMEZONE_CODE + "','" + p.CREATION_DATE + "','" + p.LAST_UPDATE_DATE + "'" + ") "; //MessageBox.Show(sql); chk = conn.ExecuteNonQuery(sql, "kfc_po"); //chk = p.RowNumber; //chk = p.Code; } catch (Exception ex) { //MessageBox.Show("Error " + ex.ToString(), "insert Doctor"); } return(chk); }