public static BudgetParameters CreateBudgetParameters(string dataAreaId)
        {
            BudgetParameters budgetParameters = new BudgetParameters();

            budgetParameters.dataAreaId = dataAreaId;
            return(budgetParameters);
        }
Exemplo n.º 2
0
        private void AssignBudget_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            BudgetParameters p = (BudgetParameters)e.PopupWindow.View.CurrentObject;

            if (p.IsErr)
            {
                return;
            }
            if (p.Amount <= 0)
            {
                return;
            }
            if (p.ParamYear >= 2010 && p.ParamYear <= 2099)
            {
            }
            else
            {
                return;
            }

            Budgets  currentobject = (Budgets)View.CurrentObject;
            ListView lv            = ((ListView)View);

            if (lv.CollectionSource is PropertyCollectionSource)
            {
                PropertyCollectionSource collectionSource = (PropertyCollectionSource)lv.CollectionSource;
                if (collectionSource.MasterObject != null)
                {
                    if (collectionSource.MasterObjectType == typeof(BudgetMasters))
                    {
                        BudgetMasters masterobject = (BudgetMasters)collectionSource.MasterObject;
                        if (p.IsYearly)
                        {
                            Budgets budget = ObjectSpace.CreateObject <Budgets>();
                            budget.DateFrom = new DateTime(p.ParamYear, 1, 1);
                            budget.DateTo   = new DateTime(p.ParamYear, 12, 31);
                            budget.Amount   = p.Amount;
                            masterobject.Budget.Add(budget);
                        }
                        else
                        {
                            for (int x = 1; x <= 12; x++)
                            {
                                Budgets budget = ObjectSpace.CreateObject <Budgets>();
                                budget.DateFrom = new DateTime(p.ParamYear, x, 1);
                                budget.DateTo   = budget.DateFrom.AddMonths(1).AddDays(-1);
                                budget.Amount   = p.Amount;
                                masterobject.Budget.Add(budget);
                            }
                        }
                    }
                }
            }
        }