示例#1
0
        private void initCompoment()
        {
            line1  = 35 + gapLine;
            line2  = 57 + gapLine;
            line3  = 75 + gapLine;
            line4  = 125 + gapLine;
            line41 = 120 + gapLine;
            line42 = 140 + gapLine;
            line5  = 270 + gapLine;

            lb1          = new MaterialLabel();
            lb1.Font     = cSupWS.fV1;
            lb1.Text     = "Text File";
            lb1.AutoSize = true;
            Controls.Add(lb1);
            lb1.Location = new System.Drawing.Point(cSupWS.formFirstLineX, cSupWS.formFirstLineY + gapLine);

            lb2          = new MaterialLabel();
            lb2.Font     = cSupWS.fV1;
            lb2.Text     = "Program Name Xcust Supplier Site Master Webservice";
            lb2.AutoSize = true;
            Controls.Add(lb2);
            lb2.Location = new System.Drawing.Point(grd3, cSupWS.formFirstLineY + gapLine);

            txtFileName      = new MaterialSingleLineTextField();
            txtFileName.Font = cSupWS.fV1;
            txtFileName.Text = "";
            txtFileName.Size = new System.Drawing.Size(300 - grd1 - 20 - 30, ControlHeight);
            Controls.Add(txtFileName);
            txtFileName.Location = new System.Drawing.Point(grd1, cSupWS.formFirstLineY + gapLine);
            txtFileName.Hint     = lb1.Text;
            txtFileName.Enter   += txtFileName_Enter;
            txtFileName.Leave   += txtFileName_Leave;


            btnRead      = new MaterialFlatButton();
            btnRead.Font = cSupWS.fV1;
            btnRead.Text = "Web Service";
            btnRead.Size = new System.Drawing.Size(30, ControlHeight);
            Controls.Add(btnRead);
            btnRead.Location = new System.Drawing.Point(grd1, line1);
            btnRead.Click   += btnRead_Click;

            pB1 = new MaterialProgressBar();
            Controls.Add(pB1);
            pB1.Size     = new System.Drawing.Size(formwidth - 40, pB1.Height);
            pB1.Location = new System.Drawing.Point(cSupWS.formFirstLineX + 5, line41);

            lv1               = new MaterialListView();
            lv1.Font          = cSupWS.fV1;
            lv1.FullRowSelect = true;
            lv1.Size          = new System.Drawing.Size(formwidth - 40, formheight - line3 - 100);
            lv1.Location      = new System.Drawing.Point(cSupWS.formFirstLineX + 5, line42);
            lv1.FullRowSelect = true;
            lv1.View          = View.Details;
            //lv1.Dock = System.Windows.Forms.DockStyle.Fill;
            lv1.BorderStyle = System.Windows.Forms.BorderStyle.None;

            Controls.Add(lv1);
        }
示例#2
0
        public void setXcustPRTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1)
        {
            String uri = "", dump = "";
            //HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            const Int32 BufferSize      = 128;

            String[] filePO;
            addListView("setXcustPRTbl ", "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_PO_RECEIPT_REP</v2:attributeTemplate> " +
                  "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_PO_RECEIPT_REP.xdo</v2:reportAbsolutePath> " +
                  "<pub:parameterNameValues> " +
                  "<pub:item> " +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_cre_date_frm</pub:name> " +
                  "<pub:values> " +
                  "<pub:item></pub:item> " +
                  "</pub:values>" +
                  "</pub:item>" +
                  "<pub:item>" +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed>" +
                  "<pub:name>p_cre_date_to</pub:name>" +
                  "<pub:values>" +
                  "<pub:item></pub:item>" +
                  "</pub:values>" +
                  "</pub:item> " +
                  "<pub:item>" +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_update_date_frm</pub:name> " +
                  "<pub:values> " +
                  "<pub:item></pub:item> " +
                  "</pub:values> " +
                  "</pub:item> " +
                  "<pub:item> " +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_update_date_to</pub:name> " +
                  "<pub:values> " +
                  "<pub:item></pub:item> " +
                  "</pub:values> " +
                  "</pub:item> " +
                  "<pub:item> " +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_receipt_num_frm</pub:name> " +
                  "<pub:values> " +
                  "<pub:item></pub:item> " +
                  "</pub:values> " +
                  "</pub:item> " +
                  "<pub:item> " +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_receipt_num_to</pub:name> " +
                  "<pub:values> " +
                  "<pub:item></pub:item> " +
                  "</pub:values> " +
                  "</pub:item> " +
                  "</pub:parameterNameValues>  " +
                  "</v2:reportRequest> " +
                  "<v2:userID>[email protected]</v2:userID> " +
                  "<v2:password>icetech@2017</v2:password> " +
                  "</v2:runReport> " +
                  "</soapenv:Body> " +
                  "</soapenv:Envelope> ";

            //byte[] byteArray = Encoding.UTF8.GetBytes(envelope);
            byte[] byteArray = Encoding.UTF8.GetBytes(uri);
            addListView("setXcustPRTbl 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("*****@*****.**" + ":" + "icetech@2017");
            string credentials     = System.Convert.ToBase64String(toEncodeAsBytes);

            // Create HttpWebRequest connection to the service
            HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://eglj-test.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-test.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("setXcustPRTbl 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("setXcustPRTbl 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("setXcustPRTbl 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(',');
                XcustPoReceiptTbl item  = new XcustPoReceiptTbl();
                item.LAST_UPDATE_DATE    = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[0].Trim());
                item.CREATION_DATE       = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[1].Trim());
                item.RECEIPT_SOURCE_CODE = data2[2].Trim();
                item.VENDOR_ID           = data2[3].Trim().Equals("")?"0": data2[3].Trim();
                item.VENDOR_SITE_ID      = data2[4].Trim().Equals("") ? "0" : data2[4].Trim();
                item.ORGANIZATION_ID     = data2[5].Trim().Equals("") ? "0" : data2[5].Trim();
                item.SHIPMENT_NUM        = data2[6].Trim();
                item.RECEIPT_NUM         = data2[7].Trim();
                item.SHIP_TO_LOCATION_ID = data2[8].Trim();
                item.PACKING_SLIP        = data2[9].Trim();
                item.SHIPPED_DATE        = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[10].Trim());

                item.EXPECTED_RECEIPT_DATE = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[11].Trim());
                item.ATTRIBUTE_CATEGORY    = data2[12].Trim();
                item.ATTRIBUTE1            = data2[13].Trim();
                item.ATTRIBUTE2            = data2[14].Trim();
                item.ATTRIBUTE3            = data2[15].Trim();
                item.ATTRIBUTE4            = data2[16].Trim();
                item.ATTRIBUTE5            = data2[17].Trim();
                item.ATTRIBUTE6            = data2[18].Trim();
                item.ATTRIBUTE7            = data2[19].Trim();
                item.ATTRIBUTE8            = data2[20].Trim();

                item.ATTRIBUTE9            = data2[21].Trim();
                item.ATTRIBUTE10           = data2[22].Trim();
                item.REQUEST_ID            = data2[23].Trim().Equals("") ? "0" : data2[23].Trim();
                item.GROSS_WEIGHT          = data2[24].Trim().Equals("") ? "0" : data2[24].Trim();
                item.GROSS_WEIGHT_UOM_CODE = data2[25].Trim();
                item.NET_WEIGHT            = data2[26].Trim().Equals("") ? "0" : data2[26].Trim();
                item.NET_WEIGHT_UOM_CODE   = data2[27].Trim().Equals("") ? "0" : data2[27].Trim();
                item.PACKAGING_CODE        = data2[28].Trim();
                item.INVOICE_NUM           = data2[29].Trim();
                item.INVOICE_DATE          = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[30].Trim());

                item.INVOICE_AMOUNT       = data2[31].Trim().Equals("") ? "0" : data2[31].Trim();
                item.TAX_NAME             = data2[32].Trim();
                item.TAX_AMOUNT           = data2[33].Trim().Equals("") ? "0" : data2[33].Trim();
                item.FREIGHT_AMOUNT       = data2[34].Trim().Equals("") ? "0" : data2[34].Trim();
                item.INVOICE_STATUS_CODE  = data2[35].Trim();
                item.CURRENCY_CODE        = data2[36].Trim();
                item.CONVERSION_RATE_TYPE = data2[37].Trim();
                item.CONVERSION_RATE      = data2[38].Trim().Equals("") ? "0" : data2[38].Trim();
                item.CONVERSION_DATE      = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[39].Trim());
                item.PAYMENT_TERMS_ID     = data2[40].Trim().Equals("") ? "0" : data2[40].Trim();

                item.SHIP_TO_ORG_ID        = data2[41].Trim().Equals("") ? "0" : data2[41].Trim();
                item.CUSTOMER_ID           = data2[42].Trim().Equals("") ? "0" : data2[42].Trim();
                item.CUSTOMER_SITE_ID      = data2[43].Trim().Equals("") ? "0" : data2[43].Trim();
                item.REMIT_TO_SITE_ID      = data2[44].Trim().Equals("") ? "0" : data2[44].Trim();
                item.SHIP_FROM_LOCATION_ID = data2[45].Trim().Equals("") ? "0" : data2[45].Trim(); //CATEGORY
                item.APPROVAL_STATUS       = data2[46].Trim();                                     //CONVERSION_TYPE
                item.RMA_BU_ID             = data2[47].Trim().Equals("") ? "0" : data2[47].Trim();
                item.HEADER_INTERFACE_ID   = data2[48].Trim().Equals("") ? "0" : data2[48].Trim(); //CONVERSION_RATE
                item.RA_ORIG_SYSTEM_REF    = data2[49].Trim();
                item.SHIPMENT_LINE_ID      = data2[50].Trim().Equals("") ? "0" : data2[50].Trim();

                item.LINE_NUM           = data2[51].Trim().Equals("") ? "0" : data2[51].Trim();
                item.CATEGORY_ID        = data2[52].Trim().Equals("") ? "0" : data2[52].Trim();
                item.QUANTITY_SHIPPED   = data2[53].Trim().Equals("") ? "0" : data2[53].Trim();
                item.QUANTITY_RECEIVED  = data2[54].Trim().Equals("") ? "0" : data2[54].Trim();
                item.QUANTITY_DELIVERED = data2[55].Trim().Equals("") ? "0" : data2[55].Trim();
                item.QUANTITY_RETURNED  = data2[56].Trim().Equals("") ? "0" : data2[56].Trim();
                item.QUANTITY_ACCEPTED  = data2[57].Trim().Equals("") ? "0" : data2[57].Trim();
                item.QUANTITY_REJECTED  = data2[58].Trim().Equals("") ? "0" : data2[58].Trim();
                item.UOM_CODE           = data2[59].Trim();
                item.ITEM_DESCRIPTION   = data2[60].Trim();

                item.ITEM_ID                   = data2[61].Trim().Equals("") ? "0" : data2[61].Trim();
                item.ITEM_REVISION             = data2[62].Trim();
                item.SHIPMENT_LINE_STATUS_CODE = data2[63].Trim().Replace(@"""", "");
                item.SOURCE_DOCUMENT_CODE      = data2[64].Trim();
                item.PO_HEADER_ID              = data2[65].Trim().Equals("") ? "0" : data2[65].Trim();
                item.PO_LINE_ID                = data2[66].Trim().Equals("") ? "0" : data2[66].Trim();
                item.PO_LINE_LOCATION_ID       = data2[67].Trim().Equals("") ? "0" : data2[67].Trim();
                item.PO_DISTRIBUTION_ID        = data2[68].Trim().Equals("") ? "0" : data2[68].Trim();
                item.REQUISITION_LINE_ID       = data2[69].Trim().Equals("") ? "0" : data2[69].Trim();
                item.REQ_DISTRIBUTION_ID       = data2[70].Trim().Equals("") ? "0" : data2[70].Trim();

                item.FROM_ORGANIZATION_ID   = data2[71].Trim().Equals("") ? "0" : data2[71].Trim();
                item.DESTINATION_TYPE_CODE  = data2[72].Trim().Equals("") ? "0" : data2[72].Trim();
                item.TO_ORGANIZATION_ID     = data2[73].Trim().Equals("") ? "0" : data2[73].Trim();
                item.TO_SUBINVENTORY        = data2[74].Trim();
                item.LOCATOR_ID             = data2[75].Trim().Equals("") ? "0" : data2[74].Trim();
                item.DELIVER_TO_LOCATION_ID = data2[76].Trim().Equals("") ? "0" : data2[75].Trim();
                item.SHIPMENT_UNIT_PRICE    = data2[77].Trim().Equals("") ? "0" : data2[76].Trim();
                item.TRANSFER_COST          = data2[78].Trim().Equals("") ? "0" : data2[77].Trim();
                item.TRANSPORTATION_COST    = data2[79].Trim().Equals("") ? "0" : data2[78].Trim();
                item.ATTRIBUTE_CATEGORY_L   = data2[80].Trim();

                item.ATTRIBUTE1_L  = data2[81].Trim();
                item.ATTRIBUTE2_L  = data2[82].Trim();
                item.ATTRIBUTE3_L  = data2[83].Trim();
                item.ATTRIBUTE4_L  = data2[84].Trim();
                item.ATTRIBUTE5_L  = data2[85].Trim();
                item.ATTRIBUTE6_L  = data2[86].Trim();
                item.ATTRIBUTE7_L  = data2[87].Trim();
                item.ATTRIBUTE8_L  = data2[88].Trim();
                item.ATTRIBUTE9_L  = data2[89].Trim();
                item.ATTRIBUTE10_L = data2[90].Trim();

                item.ATTRIBUTE_NUMBER1_L  = data2[91].Trim().Equals("") ? "0" : data2[91].Trim();
                item.ATTRIBUTE_NUMBER2_L  = data2[92].Trim().Equals("") ? "0" : data2[92].Trim();
                item.ATTRIBUTE_NUMBER3_L  = data2[93].Trim().Equals("") ? "0" : data2[93].Trim();
                item.ATTRIBUTE_NUMBER4_L  = data2[94].Trim().Equals("") ? "0" : data2[94].Trim();
                item.ATTRIBUTE_NUMBER5_L  = data2[95].Trim().Equals("") ? "0" : data2[95].Trim();
                item.ATTRIBUTE_NUMBER6_L  = data2[96].Trim().Equals("") ? "0" : data2[96].Trim();
                item.ATTRIBUTE_NUMBER7_L  = data2[97].Trim().Equals("") ? "0" : data2[97].Trim();
                item.ATTRIBUTE_NUMBER8_L  = data2[98].Trim().Equals("") ? "0" : data2[98].Trim();
                item.ATTRIBUTE_NUMBER9_L  = data2[99].Trim().Equals("") ? "0" : data2[99].Trim();
                item.ATTRIBUTE_NUMBER10_L = data2[100].Trim().Equals("") ? "0" : data2[100].Trim();

                item.ATTRIBUTE_DATE1_L   = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[101].Trim());
                item.ATTRIBUTE_DATE2_L   = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[102].Trim());
                item.ATTRIBUTE_DATE3_L   = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[103].Trim());
                item.ATTRIBUTE_DATE4_L   = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[104].Trim());
                item.REASON_ID           = data2[105].Trim();
                item.REQUEST_ID_L        = data2[106].Trim();
                item.DESTINATION_CONTEXT = data2[107].Trim();
                item.PRIMARY_UOM_CODE    = data2[108].Trim();
                item.TAX_NAME_L          = data2[109].Trim();
                item.TAX_AMOUNT_L        = data2[110].Trim().Equals("") ? "0" : data2[110].Trim();

                item.INVOICE_STATUS_CODE_L       = data2[111].Trim();
                item.SHIP_TO_LOCATION_ID_L       = data2[112].Trim().Equals("") ? "0" : data2[112].Trim();
                item.SECONDARY_QUANTITY_SHIPPED  = data2[113].Trim().Equals("") ? "0" : data2[113].Trim();
                item.SECONDARY_QUANTITY_RECEIVED = data2[114].Trim().Equals("") ? "0" : data2[114].Trim();
                item.SECONDARY_UOM_CODE          = data2[115].Trim();
                item.MMT_TRANSACTION_ID          = data2[116].Trim().Equals("") ? "0" : data2[116].Trim();
                item.AMOUNT            = data2[117].Trim().Equals("") ? "0" : data2[117].Trim();
                item.AMOUNT_RECEIVED   = data2[118].Trim().Equals("") ? "0" : data2[118].Trim();
                item.ATTRIBUTE_DATE5_L = xCPoRDB.xCPoR.dateTimeYearToDB1(data2[119].Trim());
                item.LOT_NUMBER        = data2[120].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;

                xCPoRDB.insertxCPoR(item);
            }

            Console.WriteLine(decodedString);
        }
        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);
        }
示例#4
0
        public void setXcustBlkLTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1)
        {
            String uri = "", dump = "";
            //HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            const Int32 BufferSize      = 128;

            String[] filePO;
            addListView("setXcustBlkLTbl ", "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_BLANKET_AGREEMENT_LINE_REP</v2:attributeTemplate> " +
                  "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_BLANKET_AGREEMENT_LINE_REP.xdo</v2:reportAbsolutePath> " +
                  "<pub:parameterNameValues> " +
                  "<pub:item>" +
                  "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                  "<pub:name>p_update_from</pub:name> " +                     //PARAMETER : p_update_from
                  "<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> " +                    //PARAMETER : p_update_to
                  "<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> " +               //username
                  "<v2:password>" + Cm.initC.passcloud + "</v2:password> " +           //password
                  "</v2:runReport> " +
                  "</soapenv:Body> " +
                  "</soapenv:Envelope> ";

            //byte[] byteArray = Encoding.UTF8.GetBytes(envelope);
            byte[] byteArray = Encoding.UTF8.GetBytes(uri);
            addListView("setXcustBlkLTbl 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("setXcustBlKLTbl 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("setXcustBlKLTbl 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("setXcustBlKLTbl 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(',');
                XcustBlanketLineTbl item  = new XcustBlanketLineTbl();

                item.LINE_NUMBER         = data2[0].Trim().Replace("\"", "");
                item.ITEM_ID             = data2[1].Trim().Equals("") ? "0" : data2[1].Trim();
                item.ITEM_CODE           = data2[2].Trim().Replace("\"", "");
                item.DESCRIPTION         = data2[3].Trim().Replace("\"", "");
                item.UOM                 = data2[4].Trim().Trim().Replace("\"", "");
                item.PRICE               = data2[5].Trim().Trim().Equals("") ? "0" : data2[5].Trim();
                item.RELEASE_AMT         = data2[6].Trim().Equals("") ? "0" : data2[6].Trim();
                item.EXPIRATION_DATE     = data2[7].Trim().Replace("\"", "");
                item.LINE_STATUS         = data2[8].Trim().Trim().Replace("\"", "");
                item.LINE_AGREEMENT_QTY  = data2[9].Trim().Equals("") ? "0" : data2[9].Trim();   //QUANTITY_COMMITTED
                item.LINE_AGREEMENT_AMT  = data2[10].Trim().Equals("") ? "0" : data2[10].Trim(); //COMMITTED_AMOUNT
                item.ALLOW_PRICE_OVERIDE = data2[11].Trim().Equals("") ? "0" : data2[11].Trim(); //ALLOW_PRICE_OVERRIDE_FLAG
                //item.COMUNICATION_METHOD = data2[12].Trim().Trim().Replace("\"", "");  //NOT_TO_EXCEED_PRICE
                //item.DESCRIPTION = data2[13].Trim().Trim().Replace("\"", "");  //REVISION_NUM
                item.CURRENCY_CODE    = data2[14].Trim().Replace("\"", "");                  //CURRENCY_CODE
                item.CREATION_DATE    = data2[15].Trim().Replace("\"", "");                  //CREATION_DATE
                item.LAST_UPDATE_DATE = data2[16].Trim().Replace("\"", "");                  //LAST_UPDATE_DATE
                //item.RELEASE_AMT = data2[17].Trim().Equals("") ? "0" : data2[17].Trim(); ;  //COMPONENT_AMOUNT_RELEASED
                item.PO_HEADER_ID    = data2[18].Trim().Replace("\"", "");                   //PO_HEADER_ID
                item.PO_LINE_ID      = data2[19].Trim().Replace("\"", "");                   //PO_LINE_ID
                item.min_release_amt = data2[20].Trim().Equals("") ? "0" : data2[20].Trim(); //MIN_RELEASE_AMT
                item.ATTRIBUTE1      = data2[21].Trim().Replace("\"", "");                   //ATTRIBUTE1
                item.ATTRIBUTE2      = data2[22].Trim().Replace("\"", "");                   //ATTRIBUTE2
                item.ATTRIBUTE3      = data2[23].Trim().Replace("\"", "");                   //ATTRIBUTE3
                item.ATTRIBUTE4      = data2[24].Trim().Replace("\"", "");                   //ATTRIBUTE4
                item.ATTRIBUTE5      = data2[25].Trim().Replace("\"", "");                   //ATTRIBUTE5
                item.ATTRIBUTE6      = data2[26].Trim().Replace("\"", "");                   //ATTRIBUTE6
                item.ATTRIBUTE7      = data2[27].Trim().Replace("\"", "");                   //ATTRIBUTE7
                item.ATTRIBUTE8      = data2[28].Trim().Replace("\"", "");                   //ATTRIBUTE8
                item.ATTRIBUTE9      = data2[29].Trim().Replace("\"", "");                   //ATTRIBUTE9
                item.ATTRIBUTE10     = data2[30].Trim().Replace("\"", "");                   //ATTRIBUTE10

                item.LINE_RELEASE_AMT = "0";
                item.LINE_RELEASE_QTY = "0";
                item.LINE_REVISION    = "0";
                item.PRICE_LIMIT      = "0";


                //item.LAST_UPDATE_DATE = xCBlkHDB.xCBlKH.dateTimeYearToDB1(data2[0].Trim());
                //item.CREATION_DATE = xCBlkHDB.xCBlKH.dateTimeYearToDB1(data2[1].Trim());


                xCBlkLDB.insertxCBlKL(item);

                //addListView("insert XCUST_BLANKET_AGREEMENT_LINES_TBL", "Web Service", lv1, form1);
            }

            Console.WriteLine(decodedString);
        }
示例#5
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            //Application.EnableVisualStyles();
            // Application.SetCompatibleTextRenderingDefault(false);

            MaterialListView    lv1;
            MaterialProgressBar pB1;
            Form form1;

            string[] args = Environment.GetCommandLineArgs();
            //args = args == null ? Environment.GetCommandLineArgs():args;



            ControlMain Cm = new ControlMain();

            lv1   = new MaterialListView();
            pB1   = new MaterialProgressBar();
            form1 = new Form();


            Cm.args = args;
            Cm.setAgrument();
            // Cm.GetConfig();

            // MessageBox.Show("Mastername ="  + Cm.initC.Mastername);

            // MessageBox.Show("args =" + args.ToString() + "," + args.Length, "");

            ControlAPInvoiceWebService         cApInvWS      = new ControlAPInvoiceWebService(Cm);
            ControlApSourceWebService          cApWS         = new ControlApSourceWebService(Cm);
            ControlBlanketHeader               cBlKH         = new ControlBlanketHeader(Cm);
            ControlBlanketLine                 cBlKL         = new ControlBlanketLine(Cm);
            ControlBuMstWebService             cIBuWS        = new ControlBuMstWebService(Cm);
            ControlCatMappingMstWebService     cICatmWS      = new ControlCatMappingMstWebService(Cm);
            ControlCSTPeriodMstWebService      cICSTPeriodWS = new ControlCSTPeriodMstWebService(Cm);
            ControlCurrencyMstWebService       cICurWS       = new ControlCurrencyMstWebService(Cm);
            ControlGlCodeCombinationWebService cGlCWS        = new ControlGlCodeCombinationWebService(Cm);
            ControlGlEntityWebService          cGlWS         = new ControlGlEntityWebService(Cm);
            ControlGlLedger             cGLG    = new ControlGlLedger(Cm);
            ControlGlPeriodWebService   cGlPWS  = new ControlGlPeriodWebService(Cm);
            ControlLocatorMstWebService cLCT    = new ControlLocatorMstWebService(Cm);
            ControlItemMstWebService    cItemWS = new ControlItemMstWebService(Cm);
            ControlLocationsWebService  cLcWS   = new ControlLocationsWebService(Cm);
            // ControlPoRWebService cPoRWS = new ControlPoRWebService(Cm);
            ControlSubInvMstWebService     cISubWS     = new ControlSubInvMstWebService(Cm);
            ControlSupplierSiteWebService  cSupSWS     = new ControlSupplierSiteWebService(Cm);
            ControlSupplierWebService      cSupWS      = new ControlSupplierWebService(Cm);
            ControlTaxCodeWebService       cTxCWS      = new ControlTaxCodeWebService(Cm);
            ControlUomConvertMstWebService cIUomConvWS = new ControlUomConvertMstWebService(Cm);
            ControlUomMstWebService        cIUomWS     = new ControlUomMstWebService(Cm);
            ControlValueSet         cVS     = new ControlValueSet(Cm);
            ControlOrgMstWebService cIOrgWS = new ControlOrgMstWebService(Cm);



            //MessageBox.Show("args "+ args.Length, "");

            /*if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("xcustvalueset"))
             * {
             *  Application.Run(new XcustValueSet(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("xcustvalueset"))
             * {
             *  Application.Run(new XcustValueSet(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustItemMstWebService"))
             * {
             *  Application.Run(new XCustItemMstWebService(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustSubInvMstWebService"))
             * {
             *  Application.Run(new XCustSubInvMstWebService(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustUomMstWebService"))
             * {
             *  Application.Run(new XCustUomMstWebService(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustCurrencyMstWebService"))
             * {
             *  Application.Run(new XCustCurrencyMstWebService(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustBuMstWebService"))
             * {
             *  Application.Run(new XCustBuMstWebService(Cm));
             * }
             * else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().Equals("XCustUomConvertMstWebService"))
             * {
             *  Application.Run(new XCustUomConvertMstWebService(Cm));
             * }
             * else
             * {
             *  //Application.Run(new XCustPoRWebService(Cm));
             *  //Application.Run(new XCustGlPeriodWebService(Cm));
             *  //Application.Run(new XCustApSourceWebService(Cm));
             *  //Application.Run(new XCustGlEntityWebService(Cm));
             *  //Application.Run(new XCustTaxCodeWebService(Cm));
             *  //Application.Run(new XCustSupplierSiteWebService(Cm));
             *  //Application.Run(new XCustSupplierWebService(Cm));
             *  //Application.Run(new XCustGlEntityWebService(Cm));
             *
             *  //Application.Run(new XCustUomMstWebService(Cm));  //kts****
             *  //Application.Run(new XCustBuMstWebService(Cm));  //kts
             *  //Application.Run(new XCustCurrencyMstWebService(Cm));  //kts
             *  //Application.Run(new XCustSubInvMstWebService(Cm));  //kts **
             *  Application.Run(new XcustValueSet(Cm));  //kts
             *  //Application.Run(new XcustItemLocator(Cm));  //kts
             *  //Application.Run(new XCustItemMstWebService(Cm));  //kts
             *  //Application.Run(new XCustUomConvertMstWebService(Cm));  //kts
             *  //Application.Run(new XCustCSTPeriodMstWebService(Cm));  //kts
             *  //Application.Run(new XCustCatMappingMstWebService(Cm));  //kts
             *
             *  //Application.Run(new XCustSubInvMstWebService(Cm));  //kts
             *
             *
             *  //Application.Run(new XcustBlanketHeader(Cm));
             *
             *  //Application.Run(new XCustBlanketLine(Cm));
             *  //Application.Run(new XCustGlLedger(Cm));
             *
             *  //Application.Run(new XCustUomMstWebService(Cm));  //kts
             *  //Application.Run(new XCustGlCodeCombinationWebService(Cm));
             *  //Application.Run(new XCustLocationsWebService(Cm));
             * }
             */

            //Application.Run(new XCustUomConvertMstWebService(Cm));
            //Application.Run(new XCustItemMstWebService(Cm));
            //Application.Run(new XcustSyncMaster(Cm));
            //Application.Run(new XcustValueSet(Cm));

            if (args.Length >= 2 && args[1].ToString().ToLower() == "schedule")
            {
                //MessageBox.Show("args =" + args[1].ToString() + "," + args.Length + "," + Cm.initC.Mastername, "");

                if (Cm.initC.Mastername == "XCustAPInvoiceWebService")
                {
                    cApInvWS.setXcustAPTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustApSourceWebService")
                {
                    cApWS.setXcustApTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustBlanketHeader")
                {
                    cBlKH.setXcustBlkHTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustBlanketLine")
                {
                    cBlKL.setXcustBlkLTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustBuMstWebService")
                {
                    cIBuWS.setXcustBUTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustCatMappingMstWebService")
                {
                    cICatmWS.setXcustCatMappingTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustCSTPeriodMstWebService")
                {
                    cICSTPeriodWS.setXcustCSTPeriodTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustCurrencyMstWebService")
                {
                    cICurWS.setXcustCURTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustGlCodeCombinationWebService")
                {
                    cGlCWS.setXcustGlCTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustGlEntityWebService")
                {
                    cGlWS.setXcustGlTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustGlLedger")
                {
                    cGLG.setXcustGlLedgerTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustGlPeriodWebService")
                {
                    cGlPWS.setXcustGlPTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XcustItemLocator")
                {
                    cLCT.setXcustLocatorTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustItemMstWebService")
                {
                    cItemWS.setXcustITEMTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustLocationsWebService")
                {
                    cLcWS.setXcustGlCTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustSubInvMstWebService")
                {
                    cISubWS.setXcustSUBTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustSupplierSiteWebService")
                {
                    cSupSWS.setXcustSupTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustSupplierWebService")
                {
                    cSupWS.setXcustSupTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustTaxCodeWebService")
                {
                    cTxCWS.setXcustTxCTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustUomConvertMstWebService")
                {
                    cIUomConvWS.setXcustUOMConvertTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XCustUomMstWebService")
                {
                    cIUomWS.setXcustUOMTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XcustValueSet")
                {
                    cVS.setXcustValueTbl(lv1, form1, pB1);
                }
                else if (Cm.initC.Mastername == "XcustOrgMstWebService")
                {
                    //MessageBox.Show("XcustOrgMstWebService =" + args[1].ToString() + "," + args.Length, "");
                    cIOrgWS.setXcustOrgMstTbl(lv1, form1, pB1);
                }
                else
                {
                    cApInvWS.setXcustAPTbl(lv1, form1, pB1);
                    cApWS.setXcustApTbl(lv1, form1, pB1);
                    cBlKH.setXcustBlkHTbl(lv1, form1, pB1);
                    cBlKL.setXcustBlkLTbl(lv1, form1, pB1);
                    cIBuWS.setXcustBUTbl(lv1, form1, pB1);
                    cICatmWS.setXcustCatMappingTbl(lv1, form1, pB1);
                    cICSTPeriodWS.setXcustCSTPeriodTbl(lv1, form1, pB1);
                    cICurWS.setXcustCURTbl(lv1, form1, pB1);
                    cGlCWS.setXcustGlCTbl(lv1, form1, pB1);
                    cGlWS.setXcustGlTbl(lv1, form1, pB1);
                    cGLG.setXcustGlLedgerTbl(lv1, form1, pB1);
                    cGlPWS.setXcustGlPTbl(lv1, form1, pB1);
                    cLCT.setXcustLocatorTbl(lv1, form1, pB1);
                    cItemWS.setXcustITEMTbl(lv1, form1, pB1);
                    cLcWS.setXcustGlCTbl(lv1, form1, pB1);
                    cISubWS.setXcustSUBTbl(lv1, form1, pB1);
                    cSupSWS.setXcustSupTbl(lv1, form1, pB1);
                    cSupWS.setXcustSupTbl(lv1, form1, pB1);
                    cTxCWS.setXcustTxCTbl(lv1, form1, pB1);
                    cIUomConvWS.setXcustUOMConvertTbl(lv1, form1, pB1);
                    cIUomWS.setXcustUOMTbl(lv1, form1, pB1);
                    cVS.setXcustValueTbl(lv1, form1, pB1);
                    cIOrgWS.setXcustOrgMstTbl(lv1, form1, pB1);
                }
            }
            else
            {
                Application.Run(new XcustSyncMaster(Cm));
            }
        }
示例#6
0
        public void setValueSetMst(MaterialListView lv1, Form form1, MaterialProgressBar pB1)
        {
            String uri = "", dump = "";
            //HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            const Int32 BufferSize      = 128;

            String[] filePO;
            addListView("setValueSetMst ", "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:v2='http://xmlns.oracle.com/oxp/service/v2' > " +
                  "<soapenv:Header/> " +
                  "<soapenv:Body> " +
                  "<v2:runReport> " +
                  "<v2:reportRequest> " +
                  "<v2:attributeLocale>en-US</v2:attributeLocale> " +
                  "<v2:attributeTemplate>XCUST_MAS_VALUE_SET_REP2</v2:attributeTemplate> " +
                  "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_MAS_VALUE_SET_REP.xdo</v2:reportAbsolutePath>" +
                  "</v2:reportRequest> " +
                  "<v2:userID>[email protected]</v2:userID> " +
                  "<v2:password>icetech@2017</v2:password> " +
                  "</v2:runReport> " +
                  "</soapenv:Body> " +
                  "</soapenv:Envelope> ";

            //byte[] byteArray = Encoding.UTF8.GetBytes(envelope);
            byte[] byteArray = Encoding.UTF8.GetBytes(uri);
            addListView("setValueSetMst 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("*****@*****.**" + ":" + "icetech@2017");
            string credentials     = System.Convert.ToBase64String(toEncodeAsBytes);

            // Create HttpWebRequest connection to the service
            HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://eglj-test.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", "http://xmlns.oracle.com/oxp/service/PublicReportService");

            // Write the xml payload to the request
            Stream dataStream = request1.GetRequestStream();

            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            addListView("setValueSetMst 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("setValueSetMst 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(@"<reportBytes xmlns=""http://xmlns.oracle.com/oxp/service/v2"">", "");
                                actNumber = actNumber.Replace("</reportBytes>", "").Replace("</result>", "").Replace(@"""", "").Replace("<>", "");
                            }
                        }
                    }
                }
            }
            addListView("setValueSetMst 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");

            foreach (var nodeTr in nodesTable)
            {
                row++;
                if (row == 0)
                {
                    continue;
                }
                XcustValueSetMstTbl item  = new XcustValueSetMstTbl();
                HtmlNodeCollection  cells = nodeTr.SelectNodes("td");
                //String VALUE_SET_ID = cells[0].InnerText.Replace("\r\n","").Trim();
                //String VALUE_SET_CODE = cells[1].InnerText.Replace("\r\n", "").Trim();
                //String VALUE_ID = cells[2].InnerText.Replace("\r\n", "").Trim();
                //String VALUE = cells[3].InnerText.Replace("\r\n", "").Trim();
                //String DESCRIPTION = cells[4].InnerText.Replace("\r\n", "").Trim();
                //String ENABLED_FLAG = cells[5].InnerText.Replace("\r\n", "").Trim();
                //String LAST_UPDATE_DATE = cells[6].InnerText.Replace("\r\n", "").Trim();
                //String CREATION_DATE = cells[7].InnerText.Replace("\r\n", "").Trim();
                item.VALUE_SET_ID     = cells[0].InnerText.Replace("\r\n", "").Trim();
                item.VALUE_SET_CODE   = cells[1].InnerText.Replace("\r\n", "").Trim();
                item.VALUE_ID         = cells[2].InnerText.Replace("\r\n", "").Trim();
                item.VALUE            = cells[3].InnerText.Replace("\r\n", "").Trim();
                item.DESCRIPTION      = cells[4].InnerText.Replace("\r\n", "").Trim();
                item.ENABLED_FLAG     = cells[5].InnerText.Replace("\r\n", "").Trim();
                item.LAST_UPDATE_DATE = cells[6].InnerText.Replace("\r\n", "").Trim();
                item.CREATION_DATE    = cells[7].InnerText.Replace("\r\n", "").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;

                xCVSMTDB.insertFromxCVSMT(item, "kfc_po");
            }

            Console.WriteLine(decodedString);
        }