Ejemplo n.º 1
0
        private void QueueDownload(PutioFile putiofile)
        {
            if (!AlreadyDownloading(putiofile))
            {
                string started = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
                string path    = Properties.Settings.Default.DownloadDirectory + @"\" + putiofile.name;

                dataGridViewDownloads.Rows.Add(putiofile.name, putiofile.file_type, started, "", "Not Started");
                DataGridViewRow newDownloadRow = dataGridViewDownloads.Rows[dataGridViewDownloads.Rows.Count - 1];

                putiofile.rowinque      = newDownloadRow;
                putiofile.download_path = path;

                FileDownloads.Enqueue(putiofile);
                DownloadFile();
            }
        }
Ejemplo n.º 2
0
        private void SubmitQueryAction(string submitactionlogfile)
        {
            Guid g;

            g = Guid.NewGuid();
            string         MemberCode           = "MAYB";
            string         DealerCode           = "CCM";
            string         ClientCode           = "LWL803";
            string         orderReferenceNumber = "JSE" + g.ToString().Substring(0, 6);
            ActionResponse actionresponse       = new ActionResponse();

            var displayData = FileDownloads.GetFileDownload(1, DateTime.Today, avventoServiceClient);

            // var instrumentData = FileDownloads.GetFileDownload(2, DateTime.Today, avventoServiceClient);
            // var mtm = FileDownloads.GetFileDownload(16, DateTime.Today, avventoServiceClient);
            if (displayData != null)
            {
                int i = 1;
                foreach (DataRow dr in displayData.Rows)
                {
                    actionresponse       = new ActionResponse();
                    orderReferenceNumber = orderReferenceNumber + i.ToString().PadLeft(3, '0');
                    var instrumentCode = dr["FirstInstrumentCode"].ToString();
                    var Price          = dr["OpeningPrice"].ToString();

                    OrderManipulation.SubmitOrder(avventoServiceClient, instrumentCode, ClientCode, "C", MemberCode,
                                                  DealerCode, "B", 0, GetRandomQuantity(150, 1150), 0, Price, 0, 1, orderReferenceNumber,
                                                  DateTime.Today,
                                                  out actionresponse);

                    ActionResponseCallback(actionresponse);
                }
            }
            else
            {
                MessageBox.Show("No Data Retrieved");
            }


            // ActionResponseCallback(actionresponse);
        }
Ejemplo n.º 3
0
        private void DownloadFile()
        {
            if (FileDownloads.Any())
            {
                foreach (WebClient wc in WebClients)
                {
                    if (!wc.IsBusy)
                    {
                        var putiofile = FileDownloads.Dequeue();
                        putiofile.rowinque.Cells["ColumnStatus"].Value = "Queued";
                        putiofile.webcilent = wc;

                        ContextMenuStrip cstrip = new ContextMenuStrip();
                        cstrip.Items.Add("Cancel").Click   += (s, e1) => CstripDownload_Click(s, e1, putiofile);
                        putiofile.rowinque.ContextMenuStrip = cstrip;
                        wc.DownloadFileAsync(putiofile.downloadlink, putiofile.download_path, putiofile);
                        return;
                    }
                }
            }
            return;
        }