Ejemplo n.º 1
0
        private void frmRibbon_OnItemClicked(string ActionType)
        {
            switch (ActionType)
            {
            case "AddBalance":
                AddBalance();
                break;

            case "SaveBalance":
                if (ValidateBalanceBudgetField())
                {
                    if (string.IsNullOrEmpty(txtbalanceName.Text))
                    {
                        UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("CannotBeBlank"), Uniconta.ClientTools.Localization.lookup("Name")), Uniconta.ClientTools.Localization.lookup("Warning"));
                        return;
                    }
                    SaveBalance();
                }
                break;

            case "DeleteBalance":
                DeleteBalance();
                break;

            case "NewColumn":

                CriteriaControl crControl = new CriteriaControl();
                crControl.companyList = companyList;
                crControl.API         = api;
                var numberOfChild = ControlContainer.Children.Count;
                if (numberOfChild >= ControlContainer.RowDefinitions.Count)
                {
                    ControlContainer.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });
                }
                Grid.SetRow(crControl, ControlContainer.Children.Count);
                ControlContainer.Children.Add(crControl);
                var datacontext = crControl.DataContext as SelectedCriteria;
                SetDefaultDate(datacontext);
                setColNameAndNumber(datacontext, objCriteria.selectedCriteria.Count + 1);
                objCriteria.selectedCriteria.Add(datacontext);
                SaveNewCritera();
                break;

            case "DeleteColumn":
                DeleteCriteria();
                break;

            case "MoveColumnUp":
                MoveColumnUp();
                break;

            case "MoveColumnDown":
                MoveColumnDown();
                break;

            case "BalanceReport":
                if (ValidateBalanceBudgetField())
                {
                    RunBalance();
                    LastGeneratedBalance = cbBalance.SelectedItem as Balance;
                }
                break;

            case "SetFrontPage":
                SetFrontPage();
                break;

            case "CopyBalance":
                if (ValidateBalanceBudgetField())
                {
                    CopyBalance();
                }
                break;

            case "CopyBalanceFromCompany":
                var childWindow = new CwCompanyBalances();
                childWindow.Closing += delegate
                {
                    if (childWindow.DialogResult == true)
                    {
                        if (ValidateBalanceBudgetField())
                        {
                            objBalance = childWindow.Balance;
                            var newItem = new Balance();
                            StreamingManager.Copy(objBalance, newItem);
                            var name = newItem.Name;
                            newItem._Name = name;
                            if (itemsBalance == null)
                            {
                                itemsBalance = new ObservableCollection <Balance>();
                            }
                            itemsBalance.Add(newItem);
                            cbBalance.SelectedItem = newItem;
                        }
                    }
                };
                childWindow.Show();
                break;
            }
        }
Ejemplo n.º 2
0
 private void populateValue(Balance obBalance)
 {
     balanceCollist = obBalance.ColumnList;
     if (balanceCollist != null)
     {
         bool first = true;
         foreach (var colBalance in balanceCollist)
         {
             if (first)
             {
                 first = false;
                 var Crit = objCriteria.selectedCriteria[0];
                 Crit.CriteriaName = colBalance._Name;
                 Crit.Journal      = colBalance._InclJournal;
                 Crit.BudgetModel  = colBalance._BudgetId;
                 Crit.FromDate     = colBalance._FromDate;
                 Crit.ToDate       = colBalance._ToDate;
                 Crit.dimval1      = colBalance.Dims1;
                 Crit.dimval2      = colBalance.Dims2;
                 Crit.dimval3      = colBalance.Dims3;
                 Crit.dimval4      = colBalance.Dims4;
                 Crit.dimval5      = colBalance.Dims5;
                 Crit.NotifyPropertyChanged("Dim1");
                 Crit.NotifyPropertyChanged("Dim2");
                 Crit.NotifyPropertyChanged("Dim3");
                 Crit.NotifyPropertyChanged("Dim4");
                 Crit.NotifyPropertyChanged("Dim5");
                 Crit.balanceColumnFormat = colBalance.ColumnFormatEnum;
                 Crit.balanceColumnMethod = colBalance.ColumnMethodEnum;
                 Crit.ShowDebitCredit     = colBalance._ShowDebitCredit;
                 Crit.InvertSign          = colBalance._InvertSign;
                 Crit.InclPrimo           = colBalance._InclPrimo;
                 Crit.ColA       = colBalance._ColA;
                 Crit.ColB       = colBalance._ColB;
                 Crit.Account100 = colBalance._Account100;
                 if (colBalance._ForCompanyId > 0)
                 {
                     Crit.ForCompany = companies?.Where(x => x.CompanyId == colBalance._ForCompanyId).FirstOrDefault();
                 }
                 else
                 {
                     Crit.ForCompany = null;
                 }
                 Crit.Hide = colBalance._Hide;
                 GetBalanceDimUsed(obBalance);
                 setColNameAndNumber(Crit, 1);
             }
             else
             {
                 CriteriaControl crControl = new CriteriaControl();
                 crControl.companyList          = companyList;
                 crControl.API                  = api;
                 crControl.MouseLeftButtonDown += CrControl_MouseLeftButtonDown;
                 ControlContainer.RowDefinitions.Add(new RowDefinition()
                 {
                     Height = GridLength.Auto
                 });
                 Grid.SetRow(crControl, ControlContainer.Children.Count);
                 ControlContainer.Children.Add(crControl);
                 objCriteria.selectedCriteria.Add(SetCriteriaControlValue(colBalance, crControl));
             }
         }
     }
 }