Пример #1
0
        private CostEntryModel GetUpdateStateModel(int costPK)
        {
            CostEntryFormData formData = new CostEntryFormData();

            List <Control> formControls = CreateFormControls(costPK);
            CostDTO        costDTO      = costQuery.GetByPrimaryKey(costPK);

            if (costDTO == null)
            {
                throw new KairosException($"Record with primary key '{costPK}' is not found.");
            }

            var costKategori = new CostKategoriQuery(Db).GetByPrimaryKey(costDTO.KategoriCost_FK);

            if (costKategori != null)
            {
                formData.CostKategoris.Add(costKategori);
            }


            return(new CostEntryModel()
            {
                FormData = formData,
                FormControls = formControls,
                Model = costDTO,
            });
        }
Пример #2
0
        private CostEntryModel GetCreateStateModel()
        {
            CostEntryFormData formData     = new CostEntryFormData();
            List <Control>    formControls = CreateFormControls(0);
            CostDTO           costDTO      = new CostDTO()
            {
                Tanggal = DateTime.Now
            };

            return(new CostEntryModel()
            {
                FormData = formData,
                FormControls = formControls,
                Model = costDTO,
            });
        }