Exemple #1
0
        private void Button_LoadFromXml_Click(object sender, RoutedEventArgs e)
        {
            _actualCurrencies = new List <ForeignCurrency>(50);

            XmlDocument doc = new XmlDocument();

            doc.Load("curr.xml");
            XmlNode     node = doc.SelectSingleNode("currencies");
            DateTime    date = Convert.ToDateTime(node.Attributes["date"].Value, ci);
            XmlNodeList prop = node.SelectNodes("currency");

            foreach (XmlNode n in prop)
            {
                string  n_code    = n.SelectSingleNode("code").InnerText;
                string  n_country = n.SelectSingleNode("country").InnerText;
                decimal n_amount  = Convert.ToDecimal(n.SelectSingleNode("amount").InnerText, ci);
                decimal n_exBuy   = Convert.ToDecimal(n.SelectSingleNode("exBuy").InnerText, ci);
                decimal n_exSell  = Convert.ToDecimal(n.SelectSingleNode("exSell").InnerText, ci);

                var fc = new ForeignCurrency()
                {
                    Datum    = date, Zeme = n_country, Mena = n_code,
                    Mnozstvi = n_amount, DevizaNakup = n_exBuy, DevizaProdej = n_exSell
                };
                _actualCurrencies.Add(fc);
            }

            dgMoney.ItemsSource = _actualCurrencies;
        }
 public AccountBuilder WithForeignCurrency(ForeignCurrency foreignCurrency)
 {
     if (foreignCurrency != null)
     {
         _foreignCurrency = foreignCurrency;
     }
     return(this);
 }
        private ForeignCurrency CreateForeignCurrency(string name, string symbol, decimal exchangeRate)
        {
            var result = new ForeignCurrency {
                CurrencySymbol = symbol + "{0}", ExchangeRate = exchangeRate, Name = name
            };

            Workspace.Add(result);
            return(result);
        }
        protected void grdVouchersAmount_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            //If is default foreign currency
            ForeignCurrency currentForeignCurrency =
                session.GetObjectByKey <ForeignCurrency>((Guid)e.NewValues["ForeignCurrencyId!Key"]);

            if (currentForeignCurrency.Name.Equals("VNĐ"))
            {
                e.NewValues["ExchangeRate"] = (double)1;
            }
        }
Exemple #5
0
 private void UpdateDenominations(ForeignCurrency value)
 {
     Freight.UpdateDenomination(value);
     if (Items != null)
     {
         foreach (var itm in Items)
         {
             itm.UnitCost.UpdateDenomination(value);
         }
     }
 }
Exemple #6
0
        public String searchForeignCurrencyId(Session session)
        {
            XPCollection <ForeignCurrency> collectionFC = new XPCollection <ForeignCurrency>(session);

            collectionFC.Criteria = CriteriaOperator.And(
                new BinaryOperator("Name", "NAAN_DEFAULT", BinaryOperatorType.Equal),
                new BinaryOperator("RowStatus", -1, BinaryOperatorType.Equal)
                );
            ForeignCurrency FCId = collectionFC.First();

            return(FCId.ForeignCurrencyId.ToString());
        }
Exemple #7
0
        public List <ForeignCurrency> Get()
        {
            List <ForeignCurrency> list = new List <ForeignCurrency>();

            var response = _client.GetAsync($"https://www.cnb.cz/cs/financni_trhy/devizovy_trh/kurzy_devizoveho_trhu/denni_kurz.txt");
            var cnbTxt   = response.Result.Content.ReadAsStringAsync().Result;

            string[] lines = cnbTxt.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

            if (lines.Length > 2)
            {
                DateTime dt = DateTime.Parse(lines[0].Substring(0, lines[0].IndexOf(" ") + 1));
                for (int i = 2; i < lines.Length; i++)
                {
                    string[] items = lines[i].Split("|");
                    if (items.Length < 5)
                    {
                        continue;
                    }

                    var zeme         = items[0];
                    var mena         = items[1];
                    var mnozstvi     = Convert.ToDecimal(items[2]);
                    var devizaNakup  = Convert.ToDecimal(items[4]);
                    var devizaProdej = devizaNakup;

                    var fc = new ForeignCurrency()
                    {
                        Datum = dt, Zeme = zeme, Mena = mena, Mnozstvi = mnozstvi, DevizaNakup = devizaNakup, DevizaProdej = devizaProdej
                    };
                    list.Add(fc);
                }
            }

            return(list);
        }
 public StockInvoiceItemsGridViewModel()
 {
     UnitCost = new ForeignCurrency();
 }
 public void Update(ForeignCurrency foreignCurrency)
 {
     PaymentButtonGroup.Update(_applicationState.GetPaymentScreenPaymentTypes(), foreignCurrency);
     RaisePropertyChanged(nameof(PaymentButtonGroup));
 }
Exemple #10
0
 public void CanDeserializeForexMarketCode(ForeignCurrency expected, ForeignCurrency actual)
 {
     Assert.AreEqual(expected.MarketCode, actual.MarketCode, nameof(ForeignCurrency.MarketCode));
 }
 private void gridView1_DoubleClick(object sender, EventArgs e)
 {
     resultModel       = list[gridView1.GetSelectedRows()[0]];
     this.DialogResult = DialogResult.OK;
 }
Exemple #12
0
 private void OnForeignCurrencySelected(ForeignCurrency obj)
 {
     ForeignCurrency = obj;
     CreateButtons(SelectedTicket);
 }
 private AccountBuilder(string accountName)
 {
     _accountName     = accountName;
     _foreignCurrency = ForeignCurrency.Default;
 }
Exemple #14
0
 public void CanDeserializeForexDataEnd(ForeignCurrency expected, ForeignCurrency actual)
 {
     Assert.AreEqual(expected.DataEnd, actual.DataEnd, nameof(ForeignCurrency.DataEnd));
 }
        private AccountTransactionType CreateTransactionType(Account sourceAccount, Account targetAccount, ForeignCurrency foreignCurrency)
        {
            var result = new AccountTransactionType
            {
                SourceAccountTypeId    = sourceAccount.AccountTypeId,
                TargetAccountTypeId    = targetAccount.AccountTypeId,
                DefaultSourceAccountId = sourceAccount.Id,
                DefaultTargetAccountId = targetAccount.Id,
                ForeignCurrencyId      = foreignCurrency.Id
            };

            Workspace.Add(result);
            Workspace.CommitChanges();
            return(result);
        }
        private Account CreateAccount(AccountType accountType, string accountName, int accountId, ForeignCurrency currency = null)
        {
            var result = AccountBuilder.Create(accountName)
                         .WithId(accountId)
                         .WithAccountType(accountType)
                         .WithForeignCurrency(currency)
                         .Build();

            Workspace.Add(result);
            Workspace.CommitChanges();
            return(result);
        }
Exemple #17
0
        /// <summary>
        /// Populate default data to database
        /// </summary>
        public static void Populate()
        {
            try
            {
                ////NAS.DAL.Accounting.AccountChart
                NAS.DAL.BI.Accounting.Account.CorrespondFinancialAccountDim.Populate();
                NAS.DAL.BI.Accounting.Account.FinancialAccountDim.Populate();
                Account.Populate();
                AccountType.Populate();
                AccountCategory.Populate();
                Currency.Populate();

                ////NAS.DAL.Accounting.Configure
                AllocationType.Populate();

                ////NAS.DAL.CMS.ObjectDocument
                ObjectType.Populate();
                CustomFieldType.Populate();
                ObjectTypeCustomField.Populate();

                ////NAS.DAL.Inventory.Item
                RecordedType.Populate();

                ////NAS.DAL.Inventory.Operation
                CommanderStockCartStatus.Populate();
                CommanderStockCartType.Populate();

                ////NAS.DAL.Inventory.StockCart
                StockCartActorType.Populate();

                ////NAS.DAL.Invoice
                TaxType.Populate();
                PromotionType.Populate();

                ////NAS.DAL.Nomenclature.Inventory
                Nomenclature.Inventory.Inventory.Populate();
                InventoryUnit.Populate();

                ////NAS.DAL.Nomenclature.Item
                ItemUnitRelationType.Populate();
                UnitType.Populate();
                Unit.Populate();
                ItemUnit.Populate();
                ItemTradingType.Populate();
                ItemCustomType.Populate();

                ////NAS.DAL.Nomenclature.Organization
                TradingCategory.Populate();
                AuthenticationProvider.Populate();
                DepartmentType.Populate();
                OrganizationType.Populate();
                Person.Populate();
                Organization.Populate();
                OwnerOrg.Populate();
                CustomerOrg.Populate();
                SupplierOrg.Populate();
                ManufacturerOrg.Populate();
                Department.Populate();
                DepartmentPerson.Populate();

                //NAS.DAL.Staging.Accounting.Journal
                AccountActorType.Populate();

                ////NAS.DAL.Vouches
                VouchesType.Populate();
                VouchesActorType.Populate();
                ReceiptVouchesType.Populate();
                PaymentVouchesType.Populate();
                ForeignCurrency.Populate();

                ////NAS.DAL.Accounting.Journal
                AccountingPeriod.Populate();
                //SalesInvoicePickingStockCart.Populate();

                ////NAS.DAL.System.ArtifactCode
                ArtifactType.Populate();
                CodeRuleDataType.Populate();
                CodeRuleDataFormat.Populate();
                RuleRepeaterType.Populate();

                //NAS.DAL.Sales.Price
                PricePolicyType.Populate();

                //NAS.DAL.Inventory.Lot.Lot
                NAS.DAL.Inventory.Lot.Lot.Populate();

                //NAS.DAL.Inventory.Command.InventoryCommandActorType
                NAS.DAL.Inventory.Command.InventoryCommandActorType.Populate();
                NAS.DAL.BI.Inventory.InventoryCommandDim.Populate();

                #region Other populate
                using (Session session = XpoHelper.GetNewSession())
                {
                    //Insert undefined supplier
                    if (!Util.isExistXpoObject <SupplierOrg>("OrganizationId",
                                                             Guid.Parse("3DEF2B62-2162-46CD-8418-DEE6F8E59E21")))
                    {
                        SupplierOrg undefinedSupplierOrg = new SupplierOrg(session)
                        {
                            OrganizationId       = Guid.Parse("3DEF2B62-2162-46CD-8418-DEE6F8E59E21"),
                            Name                 = "Mặc định",
                            Description          = "Mặc định",
                            Code                 = "MACDINH",
                            RowCreationTimeStamp = DateTime.Now,
                            RowStatus            = Constant.ROWSTATUS_ACTIVE,
                            OrganizationTypeId   =
                                NAS.DAL.Util.getDefaultXpoObject <OrganizationType>(session)
                        };
                        undefinedSupplierOrg.Save();
                    }
                }
                #endregion
            }
            catch (Exception)
            {
                throw new Exception("Populate failed");
            }
            finally
            {
            }
        }
Exemple #18
0
 public void Update(IEnumerable <PaymentType> paymentTypes, ForeignCurrency foreignCurrency)
 {
     _paymentButtons.Clear();
     _paymentButtons.AddRange(CreatePaymentButtons(paymentTypes, foreignCurrency));
 }
 public void Prepare()
 {
     ForeignCurrency = null;
     RefreshForeignCurrencyButtons();
 }
 private void OnForeignCurrencySelected(ForeignCurrency obj)
 {
     ForeignCurrency = obj;
     _paymentButtonsViewModel.Update(ForeignCurrency);
 }
Exemple #21
0
        private static void GetDataFrom(string fileName, out ForeignCurrency actual)
        {
            var endPoint = BuildEndPoint(fileName);

            actual = endPoint.Get(new ForeignCurrencyType("dummy-data"));
        }
Exemple #22
0
        private IEnumerable <CommandButtonViewModel <PaymentType> > CreatePaymentButtons(IEnumerable <PaymentType> paymentTypes, ForeignCurrency foreignCurrency)
        {
            var result = new List <CommandButtonViewModel <PaymentType> >();

            if (_settleCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Settle,
                    Command = _settleCommand,
                });
            }

            var pts = foreignCurrency == null?paymentTypes.Where(x => x.Account == null || x.Account.ForeignCurrencyId == 0) : paymentTypes.Where(x => x.Account != null && x.Account.ForeignCurrencyId == foreignCurrency.Id);

            result.AddRange(pts
                            .OrderBy(x => x.SortOrder)
                            .Select(x => new CommandButtonViewModel <PaymentType>
            {
                Caption   = x.Name.Replace(" ", "\r"),
                Command   = _makePaymentCommand,
                Color     = x.ButtonColor,
                FontSize  = x.FontSize,
                Parameter = x
            }));

            if (_closeCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Close,
                    Command = _closeCommand,
                    Color   = "Red"
                });
            }
            return(result);
        }
 public StockInvoiceItem()
 {
     UnitCost = new ForeignCurrency();
 }