/// <summary>
        /// Initializes the data.
        /// </summary>

        protected override void InitData()
        {
            base.InitData();
            var receiptEstimateId = ((EstimateModel)MasterBindingSource.Current).RefId;

            KeyValue = receiptEstimateId.ToString(CultureInfo.InvariantCulture);
            _planTemplateListsPresenter.DisplayByReceipt();
            _receiptEstimatePresenter.Display(long.Parse(KeyValue));
        }
Beispiel #2
0
        protected override void InitData()
        {
            PlanTypes = new ObjectGeneral().GetPlanTypes();
            // get plan template lists
            if (PlanType == 0)
            {
                _planTemplateListsPresenter.DisplayByReceipt();
            }
            else
            {
                _planTemplateListsPresenter.DisplayByPayment();
            }

            // get budget item lists
            if (PlanType == 0)
            {
                _budgetItemsPresenter.DisplayActive(); //.DisplayIsReceiptForEstimate();
            }
            else
            {
                _budgetItemsPresenter.DisplayIsPaymentForEstimate();
            }

            // get plan template list by keyvalue
            if (KeyValue != null)
            {
                _planTemplateListPresenter.Display(KeyValue);
            }
            else
            {
                PlanTemplateItems = new List <PlanTemplateItemModel>();
            }

            //get init checked and plan template list name
            if (ParentId == null)
            {
                chkCheck.Checked            = false;
                grdPlanTemplateList.Enabled = false;
            }
            else
            {
                chkCheck.Checked = true;
            }

            //LINHMC - 20/8/2015
            //Nếu mẫu chứng từ đã tồn tại, không cho bố con thằng nào sửa những cái không được sửa
            var isExisted = _planTemplateItemsPresenter.CheckConstraintData(PlanTemplateListId);

            txtPlanTemplateItemCode.Enabled         = !isExisted;
            cboPlanType.Enabled                     = !isExisted;
            spnPlanYear.Enabled                     = !isExisted;
            grdPlanTemplateList.Enabled             = !isExisted;
            gridViewDetail.OptionsBehavior.Editable = !isExisted;
            barButtonDeleteRowItem.Enabled          = !isExisted;
            grdPlanTemplateList.Enabled             = chkCheck.Checked;
            if (PlanType == 0)
            {
                chkCheck.Enabled            = false;
                grdPlanTemplateList.Enabled = false;
            }
            else
            {
                chkCheck.Enabled = !isExisted;
            }
        }