Exemple #1
0
 // Start is called before the first frame update
 void Start()
 {
     //ClickNum = ClicksChanger2.ClickNum;
     ClickNum          = 299995; // For debug
     ResourceNum       = ClicksChanger2.ResourceNum;
     MoneyNum          = ClicksChanger2.MoneyNum;
     AutoClick         = ClicksChanger2.AutoClick;
     AutoConvert       = ClicksChanger2.AutoConvert;
     AutoClickPrice    = 35;
     CurrentMarketing  = 0;
     CurrentExchange   = 12;
     Clicks.text       = "Paperplanes: " + ClickNum.ToString();
     Resources.text    = "Paper: " + ResourceNum.ToString();
     Money.text        = "Money: " + MoneyNum.ToString();
     AutoClickNum.text = "AutoFolders: " + AutoClick.ToString();
     AutoClickSec.text = "Fold/0.1s: " + (AutoClick * 10).ToString();
     if (AutoConvert == 0)
     {
         AutoConvertON.text = "AutoConverter: OFF";
     }
     else
     {
         AutoConvertON.text = "AutoConverter: ON";
     }
     CurrentMarketingLev.text   = "Marketing: Lv. " + CurrentMarketing.ToString();
     CurrentExchangeRate.text   = "Ratio: $10 : &" + CurrentExchange.ToString();
     CurrentAutoClickPrice.text = "AutoFolder Price: &" + AutoClickPrice.ToString();
 }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        ClickNum         = ClicksChanger3.ClickNum;
        ResourceNum      = ClicksChanger3.ResourceNum;
        MoneyNum         = ClicksChanger3.MoneyNum;
        AutoClick        = ClicksChanger3.AutoClick;
        AutoConvert      = ClicksChanger3.AutoConvert;
        CurrentMarketing = ClicksChanger3.CurrentMarketing;
        CurrentExchange  = ClicksChanger3.CurrentExchange;
        AutoClickPrice   = ClicksChanger3.AutoClickPrice;

        Clicks.text       = "Paperplanes: " + ClickNum.ToString();
        Resources.text    = "Paper: " + ResourceNum.ToString();
        Money.text        = "Money: " + MoneyNum.ToString();
        AutoClickNum.text = "AutoFolders: " + AutoClick.ToString();
        AutoClickSec.text = "Fold/0.1s: " + (AutoClick * 10).ToString();
        if (AutoConvert == 0)
        {
            AutoConvertON.text = "AutoConverter: OFF";
        }
        else
        {
            AutoConvertON.text = "AutoConverter: ON";
        }
        CurrentMarketingLev.text   = "Marketing: Lv. " + CurrentMarketing.ToString();
        CurrentExchangeRate.text   = "Ratio: $10 : $" + CurrentExchange.ToString();
        RemainingTime.text         = "Time Left: " + minute.ToString() + " : " + second.ToString();
        CurrentAutoClickPrice.text = "AutoFolder Price: &" + AutoClickPrice.ToString();
    }
Exemple #3
0
 private void AnalysOPI1(OrderbookPublicInformation data)
 {
     if (data != null)
     {
         OrderbookPublicInformation orderbookPublic = CurrentExchange.GetOrderbookPublic("USD", 4);
         a2.BeginInvoke(orderbookPublic, null, null);
         lstOrderbookPublicInformation.Add(orderbookPublic);
     }
 }
Exemple #4
0
        private void AnalysOPI2(OrderbookPublicInformation data)
        {
            if (data != null)
            {
                OrderbookPublicInformation orderbookPublic = CurrentExchange.GetOrderbookPublic("BTCUSD", 4);
                lstOrderbookPublicInformation.Add(orderbookPublic);

                Debug.WriteLine(lstOrderbookPublicInformation.Count);
            }
        }
Exemple #5
0
 public void MarketingInvestmentButton()
 {
     int[] MarketingPrice = new int[] { 0, 200, 2000, 10000, 50000 };
     if (CurrentMarketing < 4 && MoneyNum >= MarketingPrice[CurrentMarketing + 1])
     {
         CurrentMarketing++;
         CurrentExchange         *= 2;
         MoneyNum                -= MarketingPrice[CurrentMarketing];
         CurrentMarketingLev.text = "Marketing: Lv. " + CurrentMarketing.ToString();
         CurrentExchangeRate.text = "Ratio: $10 : &" + CurrentExchange.ToString();
     }
 }
 public List <LineP> getNotasDeCreditoLinePFor(List <Document> documents, CurrentExchange exchange)
 {
     try
     {
         List <LineP> Plines = this.getDocumentsLinePFor(documents, exchange, "[ifsDocsN4].[get_line_P_nota_credito]");
         return(Plines);
     }
     catch (Exception ex)
     {
         _iLogService.Error(ex.Message);
     }
     return(null);
 }
 public List <LineI> getBoletasLineIFor(List <Document> documents, CurrentExchange exchange)
 {
     try
     {
         List <LineI> Ilines = this.getDocumentsLineIFor(documents, exchange, "[ifsDocsN4].[get_line_I_boleta]");
         return(Ilines);
     }
     catch (Exception ex)
     {
         _iLogService.Error(ex.Message);
     }
     return(null);
 }
 private List <LineP> getDocumentsLinePFor(List <Document> documents, CurrentExchange exchange, string SPName)
 {
     try
     {
         List <LineP> Plines = new List <LineP>();
         this.addInParameter("@docs", this.convertDocsToXML(documents));
         var result = this.executeSPWithResults(SPName);
         foreach (DataRow row in result.Rows)
         {
             Plines.Add(new LineP()
             {
                 origen                 = row["origen"].ToString(),
                 invoice_no             = row["invoice_no"].ToString(),
                 line_type              = row["line_type"].ToString(),
                 invoice_no__           = row["invoice_no"].ToString(),
                 item_id                = row["item_id"].ToString(),
                 row_id                 = row["row_id"].ToString(),
                 code_a                 = row["code_a"].ToString(),
                 code_b                 = row["code_b"].ToString(),
                 code_c                 = row["code_c"].ToString(),
                 code_d                 = row["code_d"].ToString(),
                 code_e                 = row["code_e"].ToString(),
                 code_f                 = row["code_f"].ToString(),
                 code_g                 = row["code_g"].ToString(),
                 code_h                 = row["code_h"].ToString(),
                 code_i                 = row["code_i"].ToString(),
                 code_j                 = row["code_j"].ToString(),
                 quantity               = row["quantity"].ToString(),
                 curr_amount            = row["curr_amount"].ToString(),
                 dom_amount             = row["dom_amount"].ToString(),
                 auto_posting_proc_code = row["auto_posting_proc_code"].ToString(),
                 optional_code          = row["optional_code"].ToString(),
                 text = row["text"].ToString(),
                 project_activity_id = row["project_activity_id"].ToString(),
                 branch       = row["branch"].ToString(),
                 invoice_type = row["invoice_type"].ToString(),
                 // [Billy, 20170209] Extras
                 inv_type_id     = row["inv_type_id"].ToString(),
                 cli_tax_id      = row["cli_tax_id"].ToString(),
                 cli1_tax_id     = row["cli1_tax_id"].ToString(),
                 tar_id          = row["tar_id"].ToString(),
                 itm_description = row["itm_description"].ToString()
             });
         }
         return(Plines);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public List <LineH> getFacturasLineHFor(List <Document> documents, CurrentExchange exchange)
 {
     try
     {
         List <LineH> Hlines = this.getDocumentsLineHFor(documents, exchange, "[ifsDocsN4].[get_line_H_factura]");
         this._iLogService.Debug(Hlines);
         return(Hlines);
     }
     catch (Exception ex)
     {
         _iLogService.Error(ex.Message);
     }
     return(null);
 }
 public CurrentExchange getExchangeForDate(DateTime date)
 {
     try
     {
         CurrentExchange exchange = _iBillingRepository.getExchangeForDate(date);
         _iLogService.Debug("Current Exchange: ");
         _iLogService.Debug(exchange);
         return(exchange);
     }
     catch (Exception ex)
     {
         _iLogService.Error(ex.Message);
     }
     return(null);
 }
 private List <LineI> getDocumentsLineIFor(List <Document> documents, CurrentExchange exchange, string SPName)
 {
     try
     {
         List <LineI> Ilines = new List <LineI>();
         this.addInParameter("@docs", this.convertDocsToXML(documents));
         var result = this.executeSPWithResults(SPName);
         foreach (DataRow row in result.Rows)
         {
             Ilines.Add(new LineI()
             {
                 origen                 = row["origen"].ToString(),
                 invoice_no             = row["invoice_no"].ToString(),
                 line_type              = row["line_type"].ToString(),
                 invoice_no__           = row["invoice_no"].ToString(),
                 item_id                = row["item_id"].ToString(),
                 vat_code               = row["vat_code"].ToString(),
                 net_curr_amount        = row["net_curr_amount"].ToString(),
                 net_dom_amount         = row["net_dom_amount"].ToString(),
                 vat_curr_amount        = row["vat_curr_amount"].ToString(),
                 vat_dom_amount         = row["vat_dom_amount"].ToString(),
                 reference              = row["reference"].ToString(),
                 deliv_type_id          = row["deliv_type_id"].ToString(),
                 series_reference       = row["series_reference"].ToString(),
                 number_reference       = row["number_reference"].ToString(),
                 man_tax_liability_date = row["man_tax_liability_date"].ToString(),
                 branch                 = row["branch"].ToString(),
                 invoice_type           = row["invoice_type"].ToString()
             });
         }
         return(Ilines);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #12
0
        public void runJob()
        {
            // var originTypes = Enum.GetValues(typeof(OriginType));
            var docTypes = Enum.GetValues(typeof(DocType));

            foreach (DocType docType in docTypes) // Factura, Boleta, NC-Factura, NC-Boleta
            // foreach (DocType docType in new DocType[]{DocType.Factura})
            {
                List <IFSRegister> IFSRegisters = new List <IFSRegister>();
                List <Document>    documents    = new List <Document>();
                List <Auditory>    auditories   = new List <Auditory>();

                #region "Zona de Lectura de Documentos"
                LastDoc lastDoc = _IBdConsulta1Service.getLastDocByType(docType);
                // ↑ Obtenemos el último documento en TransDocumento

                List <Document> totalDocuments = _IBillingService.getNextDocumentsByTypeFrom(docType, lastDoc);
                // ↑ Obtenemos TODOS los documentos del N4, posteriores al último documento
                #endregion

                List <DateTime> dates = totalDocuments.DistinctBy(d => d.finalized_date).Select(d => d.finalized_date).ToList <DateTime>();
                // ↑ Obtenemos las diferentes fechas de los documentos obtenidos (porque cada fecha tiene su tipo de cambio)

                foreach (DateTime date in dates)
                // ↑ Iteramos por cada fecha distinta de la lista de documentos
                {
                    _ILogService.Info(date.ToString("dd/MM/yyyy"));
                    // ↑ Escribe en el log
                    documents = totalDocuments.Where(d => d.finalized_date == date).ToList <Document>();

                    if (documents.Count > 0)
                    {
                        // Obtemos el tipo de cambio del día
                        CurrentExchange current_exchange = _IBillingService.getExchangeForDate(date);

                        List <LineH>        Hlines        = _IBillingService.getLineHByTypeFor(docType, documents, current_exchange);
                        List <LineOperator> linesOperator = _IN4Service.getLineOperatorsFor(Hlines);
                        List <OtherPayer>   otherPayers   = _IBillingService.getOtherPayersFor(
                            _IBdSolicitudServicioService.getRucAgenteByTypeFor(docType,
                                                                               Hlines.Where(h => h.other_payer == IFSKeys.PENDING_DATA).ToList <LineH>())
                            );
                        foreach (LineH lineH in Hlines)
                        {
                            lineH.creators_reference = linesOperator.Where(l => l.draft == lineH.draft_nbr)
                                                       .DefaultIfEmpty(new LineOperator()
                            {
                                draft = lineH.draft_nbr, line_operator = lineH.creators_reference
                            })
                                                       .First().line_operator;
                            lineH.other_payer = otherPayers.Where(p => p.invoice_no == lineH.invoice_no)
                                                .DefaultIfEmpty(new OtherPayer()
                            {
                                invoice_no = lineH.invoice_no, other_payer = lineH.other_payer
                            })
                                                .First().other_payer;
                        }

                        List <LineI> ILines = _IBillingService.getLineIByTypeFor(docType, documents, current_exchange);
                        List <LineP> PLines = _IBillingService.getLinePByTypeFor(docType, documents, current_exchange);
                        List <CodeA> codesA = _IBdConsulta1Service.getCodeAByTypeFor(docType, PLines);
                        foreach (LineP lineP in PLines)
                        {
                            lineP.code_a = codesA.Where(c => c.invoice_no == lineP.invoice_no)
                                           .DefaultIfEmpty(new CodeA()
                            {
                                invoice_no = lineP.invoice_no, code_a = lineP.code_a
                            })
                                           .First().code_a;
                        }

                        #region "Zona de Mapeo"
                        IFSRegisters.AddRange(Hlines.Select(this._IMappingService.MapLineHToIFSFile).ToList <IFSRegister>());

                        IFSRegisters.AddRange(ILines.Select(this._IMappingService.MapLineIToIFSFile).ToList <IFSRegister>());

                        IFSRegisters.AddRange(PLines.Select(this._IMappingService.MapLinePToIFSFile).ToList <IFSRegister>());

                        auditories.AddRange(Hlines.Select((h) => { return(this._IMappingService.MapLineHToAuditory(OriginType.N4, docType, h)); }));
                        #endregion

                        /* <GrabarBD> → Grabar en BD las líneas H, I y P */
                        _IBdConsulta1Service.saveLinesH(Hlines);        // TRAMA_IFS_H
                        _IBdConsulta1Service.saveLinesI(ILines);        // TRAMA_IFS_I
                        _IBdConsulta1Service.saveLinesP(PLines);        // TRAMA_IFS_P
                        /* </GrabarBD> */

                        IFSRegisters = IFSRegisters.OrderBy(R => R.sorterB).ThenBy(R => R.sorterA).ToList <IFSRegister>();

                        OperationResult result = _IIFSService.writeIFSRegistersByOriginType(OriginType.N4, docType, IFSRegisters);

                        auditories = auditories.Select((a) =>
                        {
                            a.des_fil = result[IFSKeys.FILE].ToString();
                            return(a);
                        }).ToList <Auditory>();                        // ↑

                        _IBdConsulta1Service.saveAuditory(auditories); // TransDocumento

                        IFSRegisters.Clear();
                        auditories.Clear();
                    }
                }
            }
        }
 private List <LineH> getDocumentsLineHFor(List <Document> documents, CurrentExchange exchange, string SPName)
 {
     try
     {
         List <LineH> Hlines = new List <LineH>();
         addInParameter("@docs", this.convertDocsToXML(documents));
         addInParameter("@current_exchange", exchange.value);
         var result = this.executeSPWithResults(SPName);
         foreach (DataRow row in result.Rows)
         {
             Hlines.Add(new LineH()
             {
                 origen                  = row["origen"].ToString(),
                 line_type               = row["line_type"].ToString(),
                 customer_id             = row["customer_id"].ToString(),
                 invoice_no              = row["invoice_no"].ToString(),
                 transaction_date        = row["transaction_date"].ToString(),
                 invoice_type            = row["invoice_type"].ToString(),
                 invoice_date            = row["invoice_date"].ToString(),
                 due_date                = row["due_date"].ToString(),
                 pay_term_id             = row["pay_term_id"].ToString(),
                 currency                = row["currency"].ToString(),
                 curr_rate               = row["curr_rate"].ToString(),
                 branch                  = row["branch"].ToString(),
                 voucher_no              = row["voucher_no"].ToString(),
                 text                    = row["text"].ToString(),
                 div_factor              = row["div_factor"].ToString(),
                 creators_reference      = row["creators_reference"].ToString(),
                 ncf_reference           = row["ncf_reference"].ToString(),
                 pre_acc_code_b          = row["pre_acc_code_b"].ToString(),
                 pre_acc_code_c          = row["pre_acc_code_c"].ToString(),
                 pre_acc_code_d          = row["pre_acc_code_d"].ToString(),
                 pre_acc_code_e          = row["pre_acc_code_e"].ToString(),
                 pre_acc_code_f          = row["pre_acc_code_f"].ToString(),
                 pre_acc_code_g          = row["pre_acc_code_g"].ToString(),
                 pre_acc_code_h          = row["pre_acc_code_h"].ToString(),
                 pre_acc_code_i          = row["pre_acc_code_i"].ToString(),
                 pre_acc_code_j          = row["pre_acc_code_j"].ToString(),
                 pre_project_activity_id = row["pre_project_activity_id"].ToString(),
                 voucher_type            = row["voucher_type"].ToString(),
                 discount_date1          = row["discount_date1"].ToString(),
                 discount_perc1          = row["discount_perc1"].ToString(),
                 discount_curramount1    = row["discount_curramount1"].ToString(),
                 discount_domamount1     = row["discount_domamount1"].ToString(),
                 discount_date2          = row["discount_date2"].ToString(),
                 discount_perc2          = row["discount_perc2"].ToString(),
                 discount_curramount2    = row["discount_curramount2"].ToString(),
                 discount_domamount2     = row["discount_domamount2"].ToString(),
                 discount_date3          = row["discount_date3"].ToString(),
                 discount_perc3          = row["discount_perc3"].ToString(),
                 discount_curramount3    = row["discount_curramount3"].ToString(),
                 discount_domamount3     = row["discount_domamount3"].ToString(),
                 pay_term_base_date      = row["pay_term_base_date"].ToString(),
                 advance_invoice         = row["advance_invoice"].ToString(),
                 series_reference        = row["series_reference"].ToString(),
                 number_reference        = row["number_reference"].ToString(),
                 way_pay_id              = row["way_pay_id"].ToString(),
                 payment_address_id      = row["payment_address_id"].ToString(),
                 other_payer             = row["other_payer"].ToString(),
                 delivery_date           = row["delivery_date"].ToString(),
                 delivery_address_id     = row["delivery_address_id"].ToString(),
                 customer_reference      = row["customer_reference"].ToString(),
                 affect_line_postings    = row["affect_line_postings"].ToString(),
                 draft_nbr               = row["draft_nbr"].ToString(),
                 flex_long04             = row["flex_long04"].ToString()
             });
         }
         return(Hlines);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public List <LineH> getLineHByTypeFor(DocType type, List <Document> documents, CurrentExchange exchange)
        {
            try
            {
                List <LineH> HLines = null;
                switch (type)
                {
                case DocType.Boleta:
                    HLines = _iBillingRepository.getBoletasLineHFor(documents, exchange);
                    break;

                case DocType.Factura:
                    HLines = _iBillingRepository.getFacturasLineHFor(documents, exchange);
                    break;

                case DocType.NotaDeCreditoBoleta:
                case DocType.NotaDeCreditoFactura:
                    HLines = _iBillingRepository.getNotasDeCreditoLineHFor(documents, exchange);
                    break;
                }
                _iLogService.Debug("Line H " + type.ToString());
                _iLogService.Debug("Count: " + HLines.Count);
                return(HLines);
            }
            catch (Exception ex)
            {
                _iLogService.Error(ex.Message);
            }
            return(null);
        }
Exemple #15
0
        public MainForm()
        {
            InitializeComponent();

            a1 = new MyEventHandler(AnalysOPI1);
            a2 = new MyEventHandler(AnalysOPI2);

            // Создаем один набор бирж для последующей работы с ними
            ExchangesSet exchangesSet = new ExchangesSet("set1", "Тестовый набор бирж");

            // Подключаем библиотеку для взаимодействия с API бирж
            ExchangeInterface exchange = new ExchangeInterface();

            IExchangeInterface ccxt = null;

            // Если подключенных плагинов больше 0, то отображаем подключение для одной биржи CCXT
            if (exchange.ExchangesCount > 0)
            {
                // Получаем конкретную биржу по её имени CCXT

                /*ccxt = exchange.GetExchangeByName("ccxT");
                 * if (ccxt != null)
                 * {
                 *      Debug.WriteLine(String.Format("Активировали плагин биржи по имени - {0}", ccxt.LibraryName));
                 *
                 *      // Добавляем биржу в набор
                 *      exchangesSet.AddExchangeToSet(ccxt);
                 *
                 *      // Вызываем функцию из интерфейса для каждой биржи (если не используется CCXT)
                 *      //exchangesSet.GetListCurrency();
                 *      // Вызываем функцию из интерфейса для каждой биржи (если используется CCXT)
                 *      exchangesSet.GetListCurrency(new List<string> {"binance", "hitbtc", "yobit"});
                 * }*/

                // Получаем список валютных пар из всех бирж
                exchangesList = exchange.GetExchangesList();
                // Добавляем биржу в набор, исключаяя CCXT
                foreach (IExchangeInterface excs in exchangesList)
                {
                    if (excs.LibraryName != "ccxt" && excs.LibraryName != "yobit")
                    {
                        exchangesSet.AddExchangeToSet(excs);
                        if (excs.LibraryEnabled == false)
                        {
                            /*if (excs.LibraryName != "hitbtc")*/ excs.LibraryInit();
                            //else excs.LibraryInitSocket();
                        }
                    }
                }
                // Вызываем функцию из интерфейса для каждой биржи в наборе для получения списка символьных пар
                //Dictionary<string, List<SymbolPairsInfo>> listCurrencys = exchangesSet.GetListSymbols();
                // Получаем список по доступным остаткам криптовалют

                /*Dictionary<string, List<BalanceCurrency>> listBalanceCurrency = exchangesSet.GetListBalanceCurrency();
                 * // Получаем список активных ордеров
                 * Dictionary<string, List<ActiveOrder>> listActiveOrders = exchangesSet.GetListActiveOrders();
                 * // Получаем список тикеров
                 * Dictionary<string, List<TickerInformation>> listTickers = exchangesSet.GetTickers();*/

                //Debug.WriteLine(listTickers);

                /*CurrentExchange = GetExchangeByName("hitbtc");
                 * if (CurrentExchange != null)
                 * {
                 *      //List<SymbolPairsInfo> pairsInfos = CurrentExchange.GetListSymbols();
                 *
                 *      /*List<CurrencyInfo> exchHitBtcCurrencies = CurrentExchange.GetListCurrency();
                 *
                 *      string fee = "";
                 *
                 *      CurrencyInfo ci = exchHitBtcCurrencies.Where(x => x.Id.ToLower() == "btc").FirstOrDefault();
                 *      if (ci != null) fee = Helpers.ConvertDoubleToString(ci.PayoutFee);* /
                 *
                 *      List<TradesPublicInformation> tradesPublic = CurrentExchange.GetTradesPublic("BTCUSD", "ASC");
                 *      OrderbookPublicInformation orderbookPublic = CurrentExchange.GetOrderbookPublic("BTCUSD", 4);
                 *      List<TickerInformation> tickerInformation = CurrentExchange.GetTickers();
                 *      OrderInformation orderNew = CurrentExchange.CreateNewOrder("BTCUSD", "buy", 0.001d);
                 *      List<OrderInformation> ordersCancel = CurrentExchange.SetCancelOrders("BTCUSD");
                 *
                 *      Debug.WriteLine(orderbookPublic);
                 *
                 *      a1.BeginInvoke(orderbookPublic, null, null);
                 *      lstOrderbookPublicInformation.Add(orderbookPublic);
                 * }
                 * /*IExchangeInterface bfCurrentExchange = GetExchangeByName("yobit");
                 * if (bfCurrentExchange != null)
                 * {
                 *      List<TickerInformation> tickerInformation = bfCurrentExchange.GetTickers();
                 *
                 *      Debug.WriteLine(tickerInformation);
                 * }*/

                CurrentExchange = GetExchangeByName("kucoin");
                if (CurrentExchange != null)
                {
                    var obitfinex = CurrentExchange.GetOrderbookPublic("BTC-USDT", 20);
                    var tbitfinex = CurrentExchange.GetTickers();

                    Debug.WriteLine(obitfinex);
                }
            }
        }