Exemplo n.º 1
0
        public void CommitFileChanges(string serverSessionId, int countryId, int?folderId, Tuple <string, string> keys)
        {
            var client2 = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                client2.CommitFileChanges(serverSessionId, countryId, folderId, Program.currentUser.CountryID, Program.currentUser.UserID, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client2).Dispose();
            }
        }
Exemplo n.º 2
0
        public void SendFileAsync(FileInfo info, string serverSessionId, Tuple <string, string> keys)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var name = info.Name.ToUniqueFileName();
                info.SlimCopyAsync((data, pos, read) => { client.SaveDataAsync(serverSessionId, name, data.Copy(read), pos, keys.Item1, keys.Item2); });
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 3
0
        public string ReadCoverInfo(int id)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                return(client.ReadCoverInfo(id, keys.Item1, keys.Item2));
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 4
0
        public void ValidateVoucherThrow(int countryId, bool ss, int retailerId, int voucherId, bool voucherMustExist)
        {
            var keys   = Security.CreateInstance().GenerateSecurityKeys();
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                client.ValidateVoucher(countryId, ss, retailerId, voucherId, voucherMustExist, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 5
0
        public void RenameFolder(int id, string name)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client.RenameFolder(id, name, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 6
0
        public void DeleteAllFilesInFolder(int folderId)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client.DeleteAllFilesInFolder(folderId, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 7
0
        public void DeleteFile(int id, bool isVoucher)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client.DeleteFile(id, isVoucher, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 8
0
        public void AddFolder(int?parentId, string name)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client.AddFolder(parentId, name, Program.currentUser.CountryID, Program.currentUser.UserID, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 9
0
        public List <VoucherInfo> SelectVouchersByRetailer(int countryId, int retailerId)
        {
            IScanService client = null;

            try
            {
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client = ScanServiceClient.CreateProxy();
                return(new List <VoucherInfo>(client.ReadData(countryId, retailerId, keys.Item1, keys.Item2)));
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 10
0
        public byte[] ReadVersionFile(string fileName, long from)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var keys   = Security.CreateInstance().GenerateSecurityKeys();
                var buffer = client.ReadVersionFile(fileName, from, keys.Item1, keys.Item2);
                return(buffer);
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 11
0
        public void CommitVoucherChanges(string serverSessionId, int jobId, int countryId, int retailerId, int voucherId,
                                         int?folderId, string siteCode, string barCode, int typeId, Tuple <string, string> keys)
        {
            var client2 = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                client2.CommitVoucherChangesModify_V2(serverSessionId, jobId, countryId, retailerId,
                                                      voucherId, folderId, siteCode, barCode, Program.currentUser.CountryID, Program.currentUser.UserID, typeId, ChangeContentType.INIT, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client2).Dispose();
            }
        }
Exemplo n.º 12
0
        public string FindVoucher(int countryId, int voucherId, int voucherIdCD)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var keys   = Security.CreateInstance().GenerateSecurityKeys();
                var result = client.FindVoucher(countryId, voucherId, voucherIdCD, keys.Item1, keys.Item2);
                return(result);
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 13
0
        public VoucherInfo3 FindVoucherPRBySiteCode(string siteCode, int location)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var keys   = Security.CreateInstance().GenerateSecurityKeys();
                var result = client.FindVoucherPRBySiteCode(siteCode, location, keys.Item1, keys.Item2);
                return(result);
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 14
0
        public void UpdateVouchersOrFilesBySql(string setSql, string whereCause, bool isVoucher)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client.UpdateVouchersOrFilesBySql(setSql, whereCause, isVoucher, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 15
0
        public TransferFileInfo[] GetTransferFile(int countryId, int beginNumber, int endNumber, string siteCode)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                return(client.GetTransferFile(countryId, beginNumber, endNumber, siteCode, keys.Item1, keys.Item2));
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 16
0
        public UpdateFileInfo[] GetVersionInfo(string currentVersion)
        {
            var client = ScanServiceClient.CreateProxy(Program.SCAN_URL);

            try
            {
                var keys    = Security.CreateInstance().GenerateSecurityKeys();
                var results = client.GetVersionInfo(currentVersion, keys.Item1, keys.Item2);
                return(results);
            }
            finally
            {
                ((IDisposable)client).Dispose();
            }
        }
Exemplo n.º 17
0
        public void EmailNotaDebito(List <EmailInfo> emailInfo)
        {
            IScanService client = null;

            try
            {
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client = ScanServiceClient.CreateProxy();
                client.EmailNotaDebito(emailInfo.ToArray(), keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 18
0
        public void SaveHistory(OperationHistory operationType, Guid operationId,
                                int brIsoId, int brId, int vId, int v2Id, int count, string details, Tuple <string, string> keys)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                client.SaveHistory(Program.currentUser.CountryID, Program.currentUser.UserID, operationType, operationId, brIsoId, brId, vId, v2Id, count, details,
                                   keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 19
0
        public FolderInfo[] ReadFolderList(int?parentId, int countryId)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                var list = client.SelectFoldersByParent(parentId, countryId, keys.Item1, keys.Item2);
                return(list);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 20
0
        public file2Info[] ReadCoverList(int folderId)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                var list = client.SelectCoversByFolder(folderId, keys.Item1, keys.Item2);
                return(list);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 21
0
        public fileInfo[] ReadFileList(int folderId, int from)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                var list = client.SelectFilesByFolder2(folderId, from, Program.ITEMS_SHOWN, keys.Item1, keys.Item2);
                return(list);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 22
0
        public fileInfo[] SelectVouchersByNumber(int countryId, int voucherId)
        {
            IScanService client = null;

            try
            {
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client       = ScanServiceClient.CreateProxy();
                string where = string.Format("[iso_id] = {0} and [v_number] = {1}", countryId, voucherId);
                return(client.SelectFilesBySql(where, keys.Item1, keys.Item2));
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 23
0
        public fileInfo[] SelectFilesBySql(string whereCause)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                var list = client.SelectFilesBySql(whereCause, keys.Item1, keys.Item2);
                return(list);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 24
0
        public HistoryByCountryInfo[] ReadHistory(OperationHistory data, DateTime fromTime, DateTime toTime)
        {
            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                var list = client.ReadHistory(Program.currentUser.CountryID, Program.currentUser.UserID,
                                              data, fromTime, toTime, keys.Item1, keys.Item2);
                return(list);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="countryId"></param>
        /// <param name="officeId"></param>
        /// <param name="date"></param>
        /// <param name="invoiceNumber"></param>
        /// <param name="format">ATOM, HTML4.0, MHTML, IMAGE, EXCEL, WORD, CSV, PDF, XML</param>
        /// <param name="outputFormat">&OutputFormat=JPEG&</param>
        /// <returns></returns>
        /// <remarks>http://msdn.microsoft.com/en-us/library/ms152835.aspx</remarks>
        /// <remarks>http://msdn.microsoft.com/en-us/library/hh231593.aspx</remarks>
        public byte[] DownloadNotaDebitoReport(int countryId, int officeId, DateTime date, int invoiceNumber, string format = "PDF", string moreOptions = "")
        {
            //02/12/2013
            string uri = string.Format("http://192.168.53.144/Reportserver/Pages/ReportViewer.aspx?%2fNota+Debito%2fNota+Debito+0032&rs:Command=Render&rs:format={4}{5}&iso_id={0}&Office={1}&in_date={2:dd/MM/yyyy}&invoicenumber={3}",
                                       countryId, officeId, date, invoiceNumber, format, moreOptions);

            IScanService client = null;

            try
            {
                var keys = Security.CreateInstance().GenerateSecurityKeys();
                client = ScanServiceClient.CreateProxy();
                byte[] data = client.DownloadReport(uri, keys.Item1, keys.Item2);
                return(data);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }
Exemplo n.º 26
0
        public void LogOperation(OperationHistory operation, Guid session, int countryId, int branchId, int voucherId,
                                 int voucher2Id = 0, int count = 0, string message = null)
        {
#if SCANNING
            IScanService client = null;
            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_IP);
                var keys = Security.CreateInstance().GenerateSecurityKeys();


                client.SaveHistory(Program.currentUser.CountryID, Program.currentUser.UserID,
                                   operation, session, countryId, branchId, voucherId, voucher2Id, count, message, keys.Item1, keys.Item2);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
#endif
        }
Exemplo n.º 27
0
        public string ReceiveFile(int fileId, bool isVoucher, bool signed, string folder)
        {
            var finfo = new FileInfo(Path.Combine(folder, "dwn".Unique(".zip")));

            IScanService client = null;

            try
            {
                client = ScanServiceClient.CreateProxy(Program.SCAN_URL);
                var keys = Security.CreateInstance().GenerateSecurityKeys();

                for (; ;)
                {
                    using (var file = finfo.Open(FileMode.OpenOrCreate))
                    {
                        file.Seek(file.Length, SeekOrigin.Begin);

                        var buffer = client.SelectFileById(fileId, isVoucher, signed, (int)file.Length, keys.Item1, keys.Item2);

                        if (buffer.Length == 0)
                        {
                            return(finfo.FullName);
                        }

                        file.Write(buffer, 0, buffer.Length);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                return(null);
            }
            finally
            {
                ((IDisposable)client).DisposeSf();
            }
        }