private static void Response(string ResponseID) { try { get.creditinfosolutions.Service auth = new get.creditinfosolutions.Service(); auth.Credentials = new System.Net.NetworkCredential("microlend", "yM03vZ04"); //XmlDocument doc = new XmlDocument(); var node = auth.BatchResponse(ResponseID); //doc.AppendChild(node); //doc.Save(@"C:\Users\pab\Desktop\Analitics\_Analytics\Creditinfo\ML\Real\creditinfosync\Batch Response\" + Guid.NewGuid().ToString() + ".xml"); // File.WriteAllText(@"C:\Users\pab\Desktop\Analitics\_Analytics\Creditinfo\ML\Real\creditinfosync\Batch Response\Response.txt", node.InnerXml.ToString()); string readText = node.InnerXml.ToString(); XmlDocument doc = new XmlDocument(); readText = readText.Replace("xmlns=\"http://cb4.creditinfosolutions.com/BatchUploader/Batch\"", ""); readText = "<root>" + readText + "</root>"; doc.LoadXml(readText); XmlNodeList nodes = doc.DocumentElement.SelectNodes("/root/Commands/Command"); string _ErrorText = "", _Identifier = ""; int ErrorStep; foreach (XmlNode node1 in nodes) { ErrorStep = 0; XmlDocument doc1 = new XmlDocument(); doc1.LoadXml(node1.InnerXml); XmlNodeList nodes1 = doc1.DocumentElement.SelectNodes("/Exception/Parameters/Parameter"); foreach (XmlNode node2 in nodes1) { ErrorStep++; _Identifier = node1.Attributes["identifier"].Value.ToString(); _ErrorText = node2.SelectSingleNode("Value") == null ? "" : node2.SelectSingleNode("Value").InnerText; using (var db = new CreditinfoServiceEntities()) { if (_ErrorText != "") { var customers = db.Set <CreditInfoResult>(); customers.Add(new CreditInfoResult { Identifier = _Identifier, Result = _ErrorText, Date = DateTime.Now, IsML = 1, ErrorTypeId = ErrorStep }); db.SaveChanges(); } } } // _ErrorText = node1.SelectSingleNode("Exception/Parameters/Parameter/Value") == null ? "" : node1.SelectSingleNode("Exception/ErrorCode").InnerText; } } catch (Exception ex) { SendMail("PubInvest_Response: კრედიტინფოს სერვისის გაშვებისას დაფიქსირდა ხარვეზი,მიზეზი: " + System.Environment.NewLine + ex.Message.ToString()); } }
public static void UploadFile(string file, string cn = "") { long BUCBegin = 0; Zip(file, file + ".zip", 96); /* * using (var client = new CreditinfoService.ServiceSoapClient()) * { * client.BatchUploadChunkBegin(); * client.ClientCredentials.UserName.UserName = "******"; * client.ClientCredentials.UserName.Password= "******"; * client.BatchUploadChunk(BUCBegin, 1, GetBytesFromFile(file + ".zip")); * var finish = client.BatchUploadChunkFinish(CreditinfoService.BatchPriorityClassEnum.BatchProcessing, BUCBegin); * } */ get.creditinfosolutions.Service auth = new get.creditinfosolutions.Service(); auth.Credentials = new System.Net.NetworkCredential("microlend", "yM03vZ04"); auth.PreAuthenticate = true; BUCBegin = auth.BatchUploadChunkBegin(); auth.BatchUploadChunk(BUCBegin, 1, GetBytesFromFile(file + ".zip")); var BUCFinish = auth.BatchUploadChunkFinish(get.creditinfosolutions.BatchPriorityClassEnum.BatchProcessing, BUCBegin); long fin = Convert2Long(BUCFinish.SelectNodes("/*[1]/*[1]").Item(0).InnerText); System.IO.File.AppendAllText(@"C:\Users\L.Shanava\Desktop\PAB\CreditInfo\Shablons\result.txt", string.Format("{0}\t{1}\t{2}\r\n", file.Replace(".xml", ""), Convert.ToString(fin), cn)); using (var db = new CreditinfoServiceEntities()) { if (fin != 0) { var Batch = db.Set <CreditInfoBatchId>(); Batch.Add(new CreditInfoBatchId { BatchId = fin, Date = DateTime.Now, IsML = 1 }); db.SaveChanges(); } } }