コード例 #1
0
        public static DTO_CAT_HRCOConfig post_CAT_HRCOConfig(AppEntities db, DTO_CAT_HRCOConfig item, string Username)
        {
            tbl_CAT_HRCOConfig dbitem = new tbl_CAT_HRCOConfig();

            if (item != null)
            {
                dbitem.IDNhanSu   = item.IDNhanSu;
                dbitem.IsDisabled = item.IsDisabled;
                dbitem.IsDeleted  = item.IsDeleted;

                dbitem.CreatedBy   = Username;
                dbitem.CreatedDate = DateTime.Now;

                dbitem.ModifiedBy   = Username;
                dbitem.ModifiedDate = DateTime.Now;


                try
                {
                    db.tbl_CAT_HRCOConfig.Add(dbitem);
                    db.SaveChanges();

                    BS_CUS_Version.update_CUS_Version(db, null, "DTO_CAT_HRCOConfig", DateTime.Now, Username);


                    item.ID = dbitem.ID;

                    item.CreatedBy   = dbitem.CreatedBy;
                    item.CreatedDate = dbitem.CreatedDate;

                    item.ModifiedBy   = dbitem.ModifiedBy;
                    item.ModifiedDate = dbitem.ModifiedDate;
                }
                catch (DbEntityValidationException e)
                {
                    errorLog.logMessage("post_CAT_HRCOConfig", e);
                    item = null;
                }
            }
            return(item);
        }
コード例 #2
0
 public static DTO_CAT_HRCOConfig toDTO(tbl_CAT_HRCOConfig dbResult)
 {
     if (dbResult != null)
     {
         return(new DTO_CAT_HRCOConfig()
         {
             ID = dbResult.ID,
             IDNhanSu = dbResult.IDNhanSu,
             IsDisabled = dbResult.IsDisabled,
             IsDeleted = dbResult.IsDeleted,
             CreatedDate = dbResult.CreatedDate,
             CreatedBy = dbResult.CreatedBy,
             ModifiedDate = dbResult.ModifiedDate,
             ModifiedBy = dbResult.ModifiedBy,
         });
     }
     else
     {
         return(null);
     }
 }