private IzinCutiEntryModel GetCreateStateModel()
        {
            IzinCutiEntryFormData formData     = new IzinCutiEntryFormData();
            List <Control>        formControls = CreateFormControls(0);
            var now = DateTime.Now;

            IzinCutiDTO izinCutiDTO = new IzinCutiDTO
            {
                User_FK    = User.User_PK,
                TglMulai   = now,
                TglSelesai = now.AddDays(7)
            };

            var user = new UserQuery(this.Db).GetByPrimaryKey(User.User_PK);

            if (user != null)
            {
                izinCutiDTO.UserIzinCutiJabatanTitle = user.KategoriJabatanTitle;
                izinCutiDTO.UserIzinCutiName         = user.Name;
            }

            return(new IzinCutiEntryModel()
            {
                FormData = formData,
                FormControls = formControls,
                Model = izinCutiDTO,
            });
        }
        private IzinCutiEntryModel GetUpdateStateModel(int izinCutiPK)
        {
            IzinCutiEntryFormData formData     = new IzinCutiEntryFormData();
            List <Control>        formControls = CreateFormControls(izinCutiPK);
            IzinCutiDTO           izinCutiDTO  = izinCutiQuery.GetByPrimaryKey(izinCutiPK);

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

            return(new IzinCutiEntryModel()
            {
                FormData = formData,
                FormControls = formControls,
                Model = izinCutiDTO,
            });
        }