Ejemplo n.º 1
0
        private int IsRegisteredOrg(MyHttpUtility httpUtility, string regNumOrg, string password)
        {
            ToLog(">Проверка наличия организации. Ожидайте...");
            string queryString = "reg=" + regNumOrg +
                                 "&pass="******"http://www.gpfpmr.idknet.com/php_scr/getorg.php",
                                                                 queryString);

            return(Convert.ToInt32(result));
        }
Ejemplo n.º 2
0
        private int SendBlob(MyHttpUtility httpUtility, int orgId, int repYear)
        {
            byte[]    buf       = File.ReadAllBytes(Path.Combine(_directoryPath, _archiveName));
            int       offset    = 0;
            const int blobSize  = 65535;
            string    b64String = Convert.ToBase64String(buf);
            int       lengh     = b64String.Length;
            int       ret       = 0;

            ToLog(">Отправка контейнера. Ожидайте...");
            ToLog(">Отправлено 0%...");

            while (offset < lengh)
            {
                httpUtility.ContentType    = _contentTypeMultipart + _boundary;
                httpUtility.AcceptEncoding = _acceptEncoding;

                int    lengthToSend = (lengh - offset > blobSize) ? blobSize : lengh - offset;
                string queryString  =
                    "--" + _boundary + "\n" +
                    "Content-Type: text/plain" + "\n" +
                    "Content-Disposition: form-data; name=\"pid\"" + "\n" + "\n" + orgId.ToString() + "\n" + "--" +
                    _boundary + "--" + "\n" + "\n" +
                    "--" + _boundary + "\n" +
                    "Content-Type: text/plain" + "\n" +
                    "Content-Disposition: form-data; name=\"ry\"" + "\n" + "\n" + repYear.ToString() + "\n" + "--" +
                    _boundary + "--" + "\n" + "\n" +
                    "--" + _boundary + "\n" +
                    "Content-Type: application/octet-stream; filename=\"" + _containerName + "\"" + "\n" +
                    "Content-Transfer-Encoding: base64" + "\n" +
                    "Content-Disposition: form-data; name=\"data\"" + "\n" + "\n" +
                    b64String.Substring(offset, lengthToSend) + "\n" + "--" + _boundary + "--" + "\n" + "\n";

                string result = httpUtility.CreatePostRequestAndExec("http://www.gpfpmr.idknet.com/php_scr/wrblob.php",
                                                                     queryString);
                ret = Convert.ToInt32(result);
                if (ret < 1)
                {
                    ToLog("Произошла ошибка при отправке контейнера!");
                    DeleteAll(httpUtility, orgId, repYear);
                    return(0);
                }

                offset += lengthToSend;
                UndoLog();
                ToLog(String.Format(">Отправлено {0:0.0%}...", (offset * 1.0) / lengh));

                if (_abortSending)
                {
                    return(0);
                }
            }
            return(ret);
        }
Ejemplo n.º 3
0
        private int SendMdc(MyHttpUtility httpUtility, int orgId, int repYear, int reportType)
        {
            ToLog(">Отправка контрольной суммы. Ожидайте...");

            byte[] buf = File.ReadAllBytes(Path.Combine(_directoryPath, _mdcName));
            //int length = buf.Length;

            if (_abortSending)
            {
                throw new Exception(">Отправка данных прервана!");
            }

            string b64String = Convert.ToBase64String(buf);

            string queryString =
                "--" + _boundary + "\n" +
                "Content-Type: text/plain" + "\n" +
                "Content-Disposition: form-data; name=\"pid\"" + "\n" + "\n" + orgId.ToString() + "\n" + "--" +
                _boundary + "--" + "\n" + "\n" +
                "--" + _boundary + "\n" +
                "Content-Type: text/plain" + "\n" +
                "Content-Disposition: form-data; name=\"ry\"" + "\n" + "\n" + repYear.ToString() + "\n" + "--" +
                _boundary + "--" + "\n" + "\n" +
                "--" + _boundary + "\n" +
                "Content-Type: text/plain" + "\n" +
                "Content-Disposition: form-data; name=\"dt\"" + "\n" + "\n" + reportType.ToString() + "\n" + "--" +
                _boundary + "--" + "\n" + "\n" +
                "--" + _boundary + "\n" +
                "Content-Type: application/octet-stream; filename=\"" + _mdcName + "\"" + "\n" +
                "Content-Transfer-Encoding: base64" + "\n" +
                "Content-Disposition: form-data; name=\"mdc\"" + "\n" + "\n" +
                b64String + "\n" + "--" + _boundary + "--" + "\n" + "\n";

            httpUtility.ContentType    = _contentTypeMultipart + _boundary;
            httpUtility.AcceptEncoding = _acceptEncoding;
            string result = httpUtility.CreatePostRequestAndExec("http://www.gpfpmr.idknet.com/php_scr/wrmdc.php",
                                                                 queryString);

            return(Convert.ToInt32(result));
        }