Пример #1
0
 public TransferForm(TransferType tt, List <ADBFile> myfiles, string path, FileManager fm)
 {
     InitializeComponent();
     IsChangeValue              = false;
     ExternalMethod.CounterEx   = 0;
     progressBar_transfer.Value = 0;
     Path       = path;
     MyFiles    = myfiles;
     FM         = fm;
     TransferTp = tt;
     progressBar_transfer.Maximum = 100;
     timer_5s.Start();
     label_totalFiles.Text = label_totalSize.Text = "•••";
     if (tt == TransferType.BackingUp)
     {
         DirectoryInfo di = new DirectoryInfo(path);
         label_transferTo.Text = "from => " + di.Name.DecodingText().Replace(@"\", "");
     }
     else
     {
         label_transferTo.Text = "to => " + path.DecodingText().Replace(@"\", "");
     }
     this.Text = tt.ToString();
     backgroundWorker_SetLabels.RunWorkerAsync();
 }
Пример #2
0
 public TransferForm(TransferType transfer_type, List <string> FilesForUpload, string path, DeviceData device)
 {
     InitializeComponent();
     ExternalMethod.CounterEx   = 0;
     progressBar_transfer.Value = 0;
     Path = path;
     FilesAndDirecoriesForUpload = FilesForUpload;
     FM         = new FileManager(device);
     TransferTp = transfer_type;
     progressBar_transfer.Maximum = 100;
     timer_5s.Interval            = 500;
     timer_5s.Start();
     label_totalFiles.Text = label_totalSize.Text = "•••";
     if (transfer_type == TransferType.BackingUp)
     {
         DirectoryInfo di = new DirectoryInfo(path);
         label_transferTo.Text = "From => " + di.Name.DecodingText().Replace(@"\", "");
     }
     else
     {
         label_transferTo.Text = "to => " + path.DecodingText().Replace(@"\", "");
     }
     this.Text = transfer_type.ToString();
     backgroundWorker_SetLabels.RunWorkerAsync();
 }
Пример #3
0
        /// <summary>
        /// Prompts for details on new transfers
        /// </summary>
        /// <returns>A NewTransfer object containing info to send to server</returns>
        public NewTransfer PromptForTransfer(TransferType transferType)
        {
            //user to/from
            Console.Write($"Enter ID of user you are {(transferType == TransferType.Request ? "requesting from" : "sending to")}: ");
            string userInput = Console.ReadLine();

            if (!int.TryParse(userInput, out int otherUser))
            {
                Console.WriteLine("Invalid input. Please enter only a number.");
                return(null);
            }

            //amount
            Console.Write($"Enter amount to {transferType.ToString().ToLower()}: $");
            if (!decimal.TryParse(Console.ReadLine(), out decimal amount))
            {
                Console.WriteLine("Invalid input. Please enter only a number.");
                return(null);
            }

            int currentUser = UserService.GetUserId();

            NewTransfer newTransfer = new NewTransfer()
            {
                TransferType = transferType,
                UserFrom     = transferType == TransferType.Request ? otherUser : currentUser,
                UserTo       = transferType == TransferType.Request ? currentUser : otherUser,
                Amount       = amount
            };

            return(newTransfer);
        }
Пример #4
0
 public override string ToString()
 {
     return(string.Format("{0,11} {1,-3} bmReq:{2:X2} bReq:{3:X2} wVal:{4:X4} wInd:{5:X4} wLen:{6:X4}",
                          transfer_type.ToString(),
                          GetEndpointDirection().ToString(),
                          bmRequestType, bRequest, wValue, wIndex, wLength
                          ));
 }
Пример #5
0
        /// <summary>
        /// TODO need caching
        /// </summary>
        protected TransferDto CreateTransferDto(Transfer transfer, TransferType type, List <SIN> sinCache, List <ShopWallet> shopCache, string owner = "владелец кошелька", bool overdraft = false)
        {
            bool anon = transfer.Anonymous;

            return(new TransferDto
            {
                ModelId = "закрыто",
                Comment = transfer.Comment,
                TransferType = type.ToString(),
                Amount = BillingHelper.Round(transfer.Amount),
                NewBalance = overdraft ? 0 : type == TransferType.Incoming ? transfer.NewBalanceTo : transfer.NewBalanceFrom,
                OperationTime = transfer.OperationTime,
                From = GetWalletName(transfer.WalletFrom, anon, sinCache, shopCache, owner),
                To = GetWalletName(transfer.WalletTo, anon, sinCache, shopCache, owner),
                Anonimous = transfer.Anonymous,
                Id = transfer.Id,
                Overdraft = transfer.Overdraft,
                RentaId = transfer.RentaId
            });
        }
Пример #6
0
 private void TransferForm_Load(object sender, EventArgs e)
 {
     PreLine_CopyCutBackup = TransferTp.ToString().DecodingText() + ":: ";
 }
Пример #7
0
        /// <summary>
        /// Sets transfer typr.
        /// </summary>
        /// <param name="type">Transfer type.</param>
        private void SetTransferType(TransferType type)
        {
            if(type == TransferType.Ascii){
                WriteLine("TYPE A");
            }
            else if(type == TransferType.Binary){
                WriteLine("TYPE I");
            }
            else{
                throw new ArgumentException("Not supported argument 'type' value '" + type.ToString() + "'.");
            }

            string[] response = ReadResponse();
            if(!response[0].StartsWith("2")){
                throw new FTP_ClientException(response[0]);
            }
        }
 public PaymentType GetPaymentType(TransferType type)
 {
     return(_paymentTypesRepository.GetAll()
            .FirstOrDefault(x => x.TypeName == type.ToString()));
 }
 private void TransFerDataHandlerCallback(TransferType type, string content, object userToken)
 {
     _fLogService.Info("return type..." + type.ToString());
     TransferParams param = new TransferParams()
     {
         TranType = type,
         Content = content
     };
     lock (_lockCallBack)
     {
         if (userToken != null && _dicCallBack.ContainsKey(userToken.ToString()))
         {
             _dicCallBack[userToken.ToString()].TransFerParamsCallBack(param, _dicCallBack[userToken.ToString()].UserToKen);
             _dicCallBack.Remove(userToken.ToString());
         }
     }
 }