Esempio n. 1
0
        private void btUpload_Click(object sender, EventArgs e)
        {
            String requestFile   = @"Company.XML";
            String signatureFile = @"Company.XML.sig";
            //Byte[] registerZipArchive;
            //RegisterDump dump;
            String resultComment;
            //String code;

            Int64 ldd          = ZapretSOAPServices.LastDumpDate();
            Int64 LastDumpDate = 0;


            DateTime LastDumpDt = (new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddSeconds(ldd / 1000);

            tb1.AppendText("getLastDumpDate (дата последнего дампа):\n");
            tb1.AppendText(LastDumpDt.ToString("    yyyy-MM-dd HH:mm:ss") + "\n");
            tb1.AppendText("\n");


            if (ldd != LastDumpDate)
            {
                LastDumpDate = ldd;
                tb1.AppendText("Отправляю файлы :\n");
                tb1.AppendText("    " + requestFile + " и " + signatureFile + "\n");
                tb1.AppendText("\n");

                if (ZapretSOAPServices.SendRequest(out resultComment, out code, File.ReadAllBytes(requestFile), File.ReadAllBytes(signatureFile)))
                {
                    tb1.AppendText("Ответ сервера на SendRequest:\n");
                    tb1.AppendText("    resultComment: " + resultComment + "\n");
                    tb1.AppendText("    code: " + code + "\n");
                    tb1.AppendText("\n");

                    //File.Delete(requestFile);
                    //File.Delete(signatureFile);

/*
 *                      while (!ZapretSOAPServices.GetResult(out resultComment, out registerZipArchive, code))
 *                      {
 *                          tb1.AppendText("Ответ сервера на GetResult:\n");
 *                          tb1.AppendText("    resultComment: " + resultComment + "\n");
 *
 *
 *                          if (resultComment != "запрос обрабатывается")
 *                          {
 *
 *                              //return;
 *                          }
 *                          Thread.Sleep(300000);
 *
 *                      }
 * */
                }
            }
        }
Esempio n. 2
0
        private void btDownload_Click(object sender, EventArgs e)
        {
            Byte[] registerZipArchive;
            String registerZipArchivePath = @"register.zip";

            String resultComment;

            tb1.AppendText("Проверяем статус по коду: " + code + "\n");

            ZapretSOAPServices.GetResult(out resultComment, out registerZipArchive, code);

            tb1.AppendText("Ответ сервера на GetResult:\n");
            tb1.AppendText("    resultComment: " + resultComment + "\n");
            tb1.AppendText("\n");
            if (resultComment != "запрос обрабатывается")
            {
                File.WriteAllBytes(registerZipArchivePath, registerZipArchive);
            }
        }