Esempio n. 1
0
        private void initConfig()
        {
            xCCatm = new XcustCatMappingMstTbl();

            xCCatm.ORGANIZATION_ID           = "ORGANIZATION_ID";
            xCCatm.ORGANIZATION_CODE         = "ORGANIZATION_CODE";
            xCCatm.INVENTORY_ITEM_ID         = "INVENTORY_ITEM_ID";
            xCCatm.CATEGORY_SET_ID           = "CATEGORY_SET_ID";
            xCCatm.CATEGORY_ID               = "CATEGORY_ID";
            xCCatm.ENABLED_FLAG              = "ENABLED_FLAG";
            xCCatm.CATEGORY_CODE             = "CATEGORY_CODE";
            xCCatm.CATALOG_CODE_C            = "CATALOG_CODE_C";
            xCCatm.MAPPING_SET_CODE          = "MAPPING_SET_CODE";
            xCCatm.VALUE_CODE_COMBINATION_ID = "VALUE_CODE_COMBINATION_ID";
            xCCatm.SEGMENT1         = "SEGMENT1";
            xCCatm.SEGMENT2         = "SEGMENT2";
            xCCatm.SEGMENT3         = "SEGMENT3";
            xCCatm.SEGMENT4         = "SEGMENT4";
            xCCatm.SEGMENT5         = "SEGMENT5";
            xCCatm.SEGMENT6         = "SEGMENT6";
            xCCatm.CONCATESEGMENT   = "CONCATESEGMENT";
            xCCatm.CREATION_DATE    = "CREATION_DATE";
            xCCatm.LAST_UPDATE_DATE = "LAST_UPDATE_DATE";

            xCCatm.table = "XCUST_CATEGORY_MAPPING_MST_TBL";
        }
Esempio n. 2
0
        public String insertxCCatMappingMst(XcustCatMappingMstTbl p)
        {
            String sql = "", chk = "";

            if (selectDupPk(p.ORGANIZATION_ID, p.INVENTORY_ITEM_ID, p.CATEGORY_SET_ID, p.CATEGORY_ID))
            {
                deletexCCat(p.ORGANIZATION_ID, p.INVENTORY_ITEM_ID, p.CATEGORY_SET_ID, p.CATEGORY_ID);
            }
            chk = insert(p);
            return(chk);
        }
Esempio n. 3
0
        public String insert(XcustCatMappingMstTbl p)
        {
            String sql = "", chk = "";

            try
            {
                //if (p.OrpChtNum.Equals(""))
                //{
                //    return "";
                //}
                //p.RowNumber = selectMaxRowNumber(p.YearId);
                //p.Active = "1";
                //MessageBox.Show("ORGANIZATION_ID" + p.ORGANIZATION_ID);
                //MessageBox.Show("222" + xCBU.BU_NAME);
                sql = "Insert Into " + xCCatm.table + "(" + xCCatm.ORGANIZATION_ID +
                      "," + xCCatm.ORGANIZATION_CODE +
                      "," + xCCatm.INVENTORY_ITEM_ID +
                      "," + xCCatm.CATEGORY_SET_ID +
                      "," + xCCatm.CATEGORY_ID +
                      "," + xCCatm.ENABLED_FLAG +
                      "," + xCCatm.CATEGORY_CODE +
                      "," + xCCatm.CATALOG_CODE_C +
                      "," + xCCatm.MAPPING_SET_CODE +
                      "," + xCCatm.VALUE_CODE_COMBINATION_ID +
                      "," + xCCatm.SEGMENT1 +
                      "," + xCCatm.SEGMENT2 +
                      "," + xCCatm.SEGMENT3 +
                      "," + xCCatm.SEGMENT4 +
                      "," + xCCatm.SEGMENT5 +
                      "," + xCCatm.SEGMENT6 +
                      "," + xCCatm.CONCATESEGMENT +
                      "," + xCCatm.CREATION_DATE +
                      "," + xCCatm.LAST_UPDATE_DATE +
                      ") " +
                      "Values('" + decimal.Parse(p.ORGANIZATION_ID) +
                      "','" + p.ORGANIZATION_CODE.Replace("|", ",") +
                      "','" + p.INVENTORY_ITEM_ID +
                      "','" + p.CATEGORY_SET_ID +
                      "','" + p.CATEGORY_ID +
                      "','" + p.ENABLED_FLAG.Replace("|", ",") +
                      "','" + p.CATEGORY_CODE +
                      "','" + p.CATALOG_CODE_C +
                      "','" + p.MAPPING_SET_CODE +
                      "','" + p.VALUE_CODE_COMBINATION_ID +
                      "','" + p.SEGMENT1 +
                      "','" + p.SEGMENT2 +
                      "','" + p.SEGMENT3 +
                      "','" + p.SEGMENT4 +
                      "','" + p.SEGMENT5 +
                      "','" + p.SEGMENT6 +
                      "','" + p.CONCATESEGMENT +
                      "','" + 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);
        }
Esempio n. 4
0
        public void setXcustCatMappingTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1)
        {
            String uri = "", dump = "";
            //HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            const Int32 BufferSize = 128;
            String[] filePO;
            addListView("setXcustCatMappingTbl ", "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_CATEGORY_MAPPING_REP</v2:attributeTemplate> " +
                                "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_CATEGORY_MAPPING_REP.xdo</v2:reportAbsolutePath> " +
                                "<pub:parameterNameValues> " +
                                "<pub:item> " +
                                    "<pub:multiValuesAllowed>False</pub:multiValuesAllowed> " +
                                    "<pub:name>p_last_update_fr</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_last_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("setXcustCatMappingTbl 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("setXcustCatMappingTbl 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("setXcustCatMappingTbl 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("setXcustCatMappingTbl 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(',');
                XcustCatMappingMstTbl CATM = new XcustCatMappingMstTbl();
                CATM.ORGANIZATION_ID = data2[0].Trim().ToString();
                CATM.ORGANIZATION_CODE = data2[1].Trim().ToString();
                CATM.INVENTORY_ITEM_ID = data2[2].Trim().Replace("\"", "");
                CATM.CATEGORY_SET_ID = data2[3].Trim().Replace("\"", "");
                CATM.CATEGORY_ID = data2[4].Trim().Replace("\"", "");
                CATM.ENABLED_FLAG = data2[5].Trim().Replace("\"", "");
                CATM.CATEGORY_CODE = data2[6].Trim().Replace("\"", "");
                CATM.CATALOG_CODE_C = data2[7].Trim().Replace("\"", "");
                CATM.MAPPING_SET_CODE = data2[8].Trim().Replace("\"", "");
                CATM.VALUE_CODE_COMBINATION_ID = data2[9].Trim().Replace("\"", "");
                CATM.SEGMENT1 = data2[10].Trim().Replace("\"", "");
                CATM.SEGMENT2 = data2[11].Trim().Replace("\"", "");
                CATM.SEGMENT3 = data2[12].Trim().Replace("\"", "");
                CATM.SEGMENT4 = data2[13].Trim().Replace("\"", "");
                CATM.SEGMENT5 = data2[14].Trim().Replace("\"", "");
                CATM.SEGMENT6 = data2[15].Trim().Replace("\"", "");
                CATM.CONCATESEGMENT = data2[16].Trim().Replace("\"", "");
                CATM.CREATION_DATE = data2[17].Trim().Replace("\"", "");
                CATM.LAST_UPDATE_DATE = data2[18].Trim().Replace("\"", "");
                //MessageBox.Show("111"+item.CREATION_DATE);
                xCICatmDB.insertxCCatMappingMst(CATM); 
      
            }
            Console.WriteLine(decodedString);
        }