Exemplo n.º 1
0
 protected override void LoadPage()
 {
     _ = new Fund().LoadAllToComboBox(flbFund);
     LoadAsynch();
 }
Exemplo n.º 2
0
        protected override void LoadPage()
        {
            LoadAsynch();

            _ = new Fund().LoadAllToComboBox(fldFund);
            List <string> fund_key = new List <string>();

            fldFund.Combo_SelectedIndexChangedResult(fund_key);

            CustomCombo cbUnit = fldUnit.field as CustomCombo;

            cbUnit.lookup_action = (key) => TempUnits(key);
            bool first_load = true;

            fldFund.Combo_SelectedIndexChanged((s, e) =>
                                               _ = cbUnit.BindData(fund_key[0],
                                                                   () =>
            {
                if (first_load)
                {
                    LoadAfterAsyncEditData(() =>
                    {
                        fldUnit.SetValue(EntityToEditObject.unit_cost_id);
                    });
                    first_load = false;
                }
            })
                                               );
            List <string> unit_key = new List <string>();

            fldUnit.Combo_SelectedIndexChangedResult(unit_key);


            CustomCombo cbAccount = fldAccount.field as CustomCombo;

            cbAccount.lookup_action = (key) =>
            {
                var accounts = new List <KeyValuePair <string, string> >();
                if (!string.IsNullOrWhiteSpace(key))
                {
                    accounts = new Account().GetAccounts(long.Parse(key));
                }
                return(Task.FromResult(accounts));
            };
            fldFund.Combo_SelectedIndexChanged((s, e) => _ = cbAccount.BindData(fund_key[0]));

            fldUnit.Combo_SelectedIndexChanged(async(s, e) =>
            {
                if (!string.IsNullOrWhiteSpace(unit_key[0]))
                {
                    var unit = await new UnitCost().Get <UnitCost>(unit_key[0]);
                    fldIssueCost.Text_SetText(unit.Model?.issue_cost?.ToString());
                }
                else
                {
                    fldIssueCost.Text_SetText("");
                }
            });

            List <decimal?> count = new List <decimal?>();

            fldCount.Numeric_ValueChangedResult(count);
            List <string> issue_cost = new List <string>();

            fldIssueCost.Text_ValueChangedResult(issue_cost);

            fldAmount.driven_action = (key) =>
            {
                return(Task.FromResult(key));
            };
            fldCount.Numeric_ValueChanged((s, e) =>
            {
                AmountDriveAcion(count, issue_cost);
            });
            fldIssueCost.Text_ValueChanged((s, e) =>
            {
                AmountDriveAcion(count, issue_cost);
            });


            buyerGridLastRow.AddAggregatedColumn(nameof(Purchase.amount), DataGridLastRow.AggreagteAction.Sum);
            dataGridView1.LastRowGrid = buyerGridLastRow;

            dataGridView1.InsertColumns(new Purchase().GetGridColumns());

            dataGridView1.SelectionChanged += DataGridView1_SelectionChanged;
        }