Example #1
0
        public String insertxCItemMst(XcustItemMstTbl p)
        {
            String sql = "", chk = "";

            if (selectDupPk(p.ORGANIZATION_ID, p.INVENTORY_ITEM_ID))
            {
                deletexCItem(p.ORGANIZATION_ID, p.INVENTORY_ITEM_ID);
            }

            chk = insert(p);
            return(chk);
        }
Example #2
0
        private void initConfig()
        {
            xCITEM = new XcustItemMstTbl();

            xCITEM.ORGANIZATION_ID            = "ORGANIZATION_ID";
            xCITEM.INVENTORY_ITEM_ID          = "INVENTORY_ITEM_ID";
            xCITEM.ITEM_CODE                  = "ITEM_CODE";
            xCITEM.ITEM_NAME                  = "ITEM_NAME";
            xCITEM.DESCRIPTION                = "DESCRIPTION";
            xCITEM.ATTRIBUTE1                 = "ATTRIBUTE1";
            xCITEM.ATTRIBUTE2                 = "ATTRIBUTE2";
            xCITEM.ATTRIBUTE3                 = "ATTRIBUTE3";
            xCITEM.ATTRIBUTE4                 = "ATTRIBUTE4";
            xCITEM.ATTRIBUTE5                 = "ATTRIBUTE5";
            xCITEM.ATTRIBUTE6                 = "ATTRIBUTE6";
            xCITEM.ATTRIBUTE7                 = "ATTRIBUTE7";
            xCITEM.ATTRIBUTE8                 = "ATTRIBUTE8";
            xCITEM.ATTRIBUTE9                 = "ATTRIBUTE9";
            xCITEM.ATTRIBUTE10                = "ATTRIBUTE10";
            xCITEM.ATTRIBUTE11                = "ATTRIBUTE11";
            xCITEM.ATTRIBUTE12                = "ATTRIBUTE12";
            xCITEM.ATTRIBUTE13                = "ATTRIBUTE13";
            xCITEM.ATTRIBUTE14                = "ATTRIBUTE14";
            xCITEM.ATTRIBUTE15                = "ATTRIBUTE15";
            xCITEM.ITEM_STATUS                = "ITEM_STATUS";
            xCITEM.ITEM_CLASS_NAME            = "ITEM_CLASS_NAME";
            xCITEM.ITEM_CLASS_CODE            = "ITEM_CLASS_CODE";
            xCITEM.ITEM_TYPE                  = "ITEM_TYPE";
            xCITEM.PRIMARY_UOM                = "PRIMARY_UOM";
            xCITEM.ITEM_CATEGORY_CODE         = "ITEM_CATEGORY_CODE";
            xCITEM.ITEM_CATEGORY_NAME         = "ITEM_CATEGORY_NAME";
            xCITEM.ITEM_REFERENCE1            = "ITEM_REFERENCE1";
            xCITEM.LOT_CONTROL_CODE           = "LOT_CONTROL_CODE";
            xCITEM.SERIAL_NUMBER_CONTROL_CODE = "SERIAL_NUMBER_CONTROL_CODE";
            xCITEM.CREATION_DATE              = "CREATION_DATE";
            xCITEM.LAST_UPDATE_DATE           = "LAST_UPDATE_DATE";
            xCITEM.TAX_RATE                    = "TAX_RATE";
            xCITEM.ASSET_CATEGORY_CODE         = "ASSET_CATEGORY_CODE";
            xCITEM.ACCOUNT_CODE_COMBINATION_ID = "ACCOUNT_CODE_COMBINATION_ID";
            xCITEM.TAX_CODE                    = "TAX_CODE";

            xCITEM.table = "xcust_item_mst_tbl";
        }
Example #3
0
        public void setXcustITEMTbl(MaterialListView lv1, Form form1, MaterialProgressBar pB1)
        {
            String uri = "", dump = "";
            //HttpWebRequest request = CreateWebRequest();
            XmlDocument soapEnvelopeXml = new XmlDocument();
            const Int32 BufferSize      = 128;

            String[] filePO;
            addListView("setXcustITEMTbl ", "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_ITEM_MASTER_REP</v2:attributeTemplate> " +
                  "<v2:reportAbsolutePath>/Custom/XCUST_CUSTOM/XCUST_ITEM_MASTER_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("setXcustITEMTbl 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("setXcustITEMTbl 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("setXcustITEMTbl 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("setXcustITEMTbl 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(',');
                XcustItemMstTbl item  = new XcustItemMstTbl();
                item.ORGANIZATION_ID            = data2[0].Trim();
                item.INVENTORY_ITEM_ID          = data2[1].Trim();
                item.ITEM_CODE                  = data2[2].Trim().Replace("\"", "");
                item.ITEM_NAME                  = data2[3].Trim().Replace("\"", "");
                item.DESCRIPTION                = data2[4].Trim().Replace("\"", "");
                item.ATTRIBUTE1                 = data2[5].Trim().Replace("\"", "");
                item.ATTRIBUTE2                 = data2[6].Trim().Replace("\"", "");
                item.ATTRIBUTE3                 = data2[7].Trim().Replace("\"", "");
                item.ATTRIBUTE4                 = data2[8].Trim().Replace("\"", "");
                item.ATTRIBUTE5                 = data2[9].Trim().Replace("\"", "");
                item.ATTRIBUTE6                 = data2[10].Trim().Replace("\"", "");
                item.ATTRIBUTE7                 = data2[11].Trim().Replace("\"", "");
                item.ATTRIBUTE8                 = data2[12].Trim().Replace("\"", "");
                item.ATTRIBUTE9                 = data2[13].Trim().Replace("\"", "");
                item.ATTRIBUTE10                = data2[14].Trim().Replace("\"", "");
                item.ATTRIBUTE11                = data2[15].Trim().Replace("\"", "");
                item.ATTRIBUTE12                = data2[16].Trim().Replace("\"", "");
                item.ATTRIBUTE13                = data2[17].Trim().Replace("\"", "");
                item.ATTRIBUTE14                = data2[18].Trim().Replace("\"", "");
                item.ATTRIBUTE15                = data2[19].Trim().Replace("\"", "");
                item.ITEM_STATUS                = data2[20].Trim().Replace("\"", "");
                item.ITEM_CLASS_NAME            = data2[21].Trim().Replace("\"", "");
                item.ITEM_CLASS_CODE            = data2[22].Trim().Replace("\"", "");
                item.ITEM_TYPE                  = data2[23].Trim().Replace("\"", "");
                item.PRIMARY_UOM                = data2[24].Trim().Replace("\"", "");
                item.ITEM_CATEGORY_NAME         = data2[25].Trim().Replace("\"", "");
                item.ITEM_CATEGORY_CODE         = data2[26].Trim().Replace("\"", "");
                item.CREATION_DATE              = data2[27].Trim().Replace("\"", "");
                item.LAST_UPDATE_DATE           = data2[28].Trim().Replace("\"", "");
                item.LOT_CONTROL_CODE           = data2[29].Trim().Replace("\"", "");
                item.SERIAL_NUMBER_CONTROL_CODE = data2[30].Trim().Replace("\"", "");
                item.ITEM_REFERENCE1            = data2[31].Trim().Replace("\"", "");
                item.TAX_RATE                    = data2[32].Trim().Replace("\"", "");
                item.ASSET_CATEGORY_CODE         = data2[33].Trim().Replace("\"", "");
                item.ACCOUNT_CODE_COMBINATION_ID = data2[34].Trim().Replace("\"", "");
                item.TAX_CODE                    = data2[35].Trim().Replace("\"", "");
                //MessageBox.Show("111"+item.CREATION_DATE);
                xCItemDB.insertxCItemMst(item);
            }
            Console.WriteLine(decodedString);
        }
Example #4
0
        public String insert(XcustItemMstTbl 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" + p.CREATION_DATE);
                sql = "Insert Into " + xCITEM.table + "(" + xCITEM.ORGANIZATION_ID +
                      "," + xCITEM.INVENTORY_ITEM_ID +
                      "," + xCITEM.ITEM_CODE +
                      "," + xCITEM.ITEM_NAME +
                      "," + xCITEM.DESCRIPTION +
                      "," + xCITEM.ATTRIBUTE1 +
                      "," + xCITEM.ATTRIBUTE2 +
                      "," + xCITEM.ATTRIBUTE3 +
                      "," + xCITEM.ATTRIBUTE4 +
                      "," + xCITEM.ATTRIBUTE5 +
                      "," + xCITEM.ATTRIBUTE6 +
                      "," + xCITEM.ATTRIBUTE7 +
                      "," + xCITEM.ATTRIBUTE8 +
                      "," + xCITEM.ATTRIBUTE9 +
                      "," + xCITEM.ATTRIBUTE10 +
                      "," + xCITEM.ATTRIBUTE11 +
                      "," + xCITEM.ATTRIBUTE12 +
                      "," + xCITEM.ATTRIBUTE13 +
                      "," + xCITEM.ATTRIBUTE14 +
                      "," + xCITEM.ATTRIBUTE15 +
                      "," + xCITEM.ITEM_STATUS +
                      "," + xCITEM.ITEM_CLASS_NAME +
                      "," + xCITEM.ITEM_CLASS_CODE +
                      "," + xCITEM.ITEM_TYPE +
                      "," + xCITEM.PRIMARY_UOM +
                      "," + xCITEM.ITEM_CATEGORY_NAME +
                      "," + xCITEM.ITEM_CATEGORY_CODE +
                      "," + xCITEM.ITEM_REFERENCE1 +
                      "," + xCITEM.LOT_CONTROL_CODE +
                      "," + xCITEM.SERIAL_NUMBER_CONTROL_CODE +
                      "," + xCITEM.CREATION_DATE +
                      "," + xCITEM.LAST_UPDATE_DATE +
                      "," + xCITEM.TAX_RATE +
                      "," + xCITEM.ASSET_CATEGORY_CODE +
                      "," + xCITEM.ACCOUNT_CODE_COMBINATION_ID +
                      "," + xCITEM.TAX_CODE +
                      ") " +
                      "Values('" + decimal.Parse(p.ORGANIZATION_ID) +
                      "','" + decimal.Parse(p.INVENTORY_ITEM_ID) +
                      "','" + p.ITEM_CODE +
                      "','" + p.ITEM_NAME +
                      "','" + p.DESCRIPTION +
                      "','" + p.ATTRIBUTE1 +
                      "','" + p.ATTRIBUTE2 +
                      "','" + p.ATTRIBUTE3 +
                      "','" + p.ATTRIBUTE4 +
                      "','" + p.ATTRIBUTE5 +
                      "','" + p.ATTRIBUTE6 +
                      "','" + p.ATTRIBUTE7 +
                      "','" + p.ATTRIBUTE8 +
                      "','" + p.ATTRIBUTE9 +
                      "','" + p.ATTRIBUTE10 +
                      "','" + p.ATTRIBUTE11 +
                      "','" + p.ATTRIBUTE12 +
                      "','" + p.ATTRIBUTE13 +
                      "','" + p.ATTRIBUTE14 +
                      "','" + p.ATTRIBUTE15 +
                      "','" + p.ITEM_STATUS +
                      "','" + p.ITEM_CLASS_NAME +
                      "','" + p.ITEM_CLASS_CODE +
                      "','" + p.ITEM_TYPE +
                      "','" + p.PRIMARY_UOM +
                      "','" + p.ITEM_CATEGORY_NAME +
                      "','" + p.ITEM_CATEGORY_CODE +
                      "','" + p.ITEM_REFERENCE1 +
                      "','" + p.LOT_CONTROL_CODE +
                      "','" + p.SERIAL_NUMBER_CONTROL_CODE +
                      "','" + p.CREATION_DATE +
                      "','" + p.LAST_UPDATE_DATE +
                      "','" + p.TAX_RATE +
                      "','" + p.ASSET_CATEGORY_CODE +
                      "','" + p.ACCOUNT_CODE_COMBINATION_ID +
                      "','" + p.TAX_CODE +
                      "'" +
                      ") ";
                //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);
        }