예제 #1
0
        public tblT_IzinCuti CreateFromDbAndUpdateFromDTO(IzinCutiDTO izinCutiDTO, DateTime dateStamp)
        {
            tblT_IzinCuti izinCuti;

            if (izinCutiDTO == null)
            {
                throw new ArgumentNullException("IzinCuti model is null.");
            }
            izinCuti = Db.tblT_IzinCuti.Find(izinCutiDTO.IzinCuti_PK);
            if (izinCuti == null)
            {
                throw new KairosException($"Record with key '{izinCutiDTO.IzinCuti_PK}' is not found.");
            }

            izinCuti.UpdateValueFrom(izinCutiDTO, "IzinCuti_PK", "Status_FK");
            if (!string.IsNullOrEmpty(izinCutiDTO.FilePhotoInBase64))
            {
                izinCuti.FilePendukung = new WebImageConverter().GetBytesFromBase64(izinCutiDTO.FilePhotoInBase64, false);
            }

            izinCutiDTO.CreatedBy   = izinCuti.CreatedBy;
            izinCutiDTO.CreatedDate = izinCuti.CreatedDate;
            izinCuti.UpdatedBy      = izinCutiDTO.UpdatedBy = User.Username;
            izinCuti.UpdatedDate    = izinCutiDTO.UpdatedDate = dateStamp;

            return(izinCuti);
        }
예제 #2
0
        public tblT_IzinCuti CreateFromDTO(IzinCutiDTO izinCutiDTO, DateTime dateStamp)
        {
            if (izinCutiDTO == null)
            {
                throw new ArgumentNullException("IzinCuti model is null.");
            }
            izinCutiDTO.Status_FK   = (int)RecordStatus.Active;
            izinCutiDTO.CreatedBy   = User.Username;
            izinCutiDTO.CreatedDate = dateStamp;
            izinCutiDTO.UpdatedBy   = User.Username;
            izinCutiDTO.UpdatedDate = dateStamp;
            tblT_IzinCuti izinCuti = izinCutiDTO.ToObject <tblT_IzinCuti>();

            if (!string.IsNullOrEmpty(izinCutiDTO.FilePhotoInBase64))
            {
                izinCuti.FilePendukung = new WebImageConverter().GetBytesFromBase64(izinCutiDTO.FilePhotoInBase64, false);
            }

            return(izinCuti);
        }