public static DTO_PRO_DeTai toDTO(tbl_PRO_DeTai dbResult) { if (dbResult != null) { return(new DTO_PRO_DeTai() { ID = dbResult.ID, IDPartner = dbResult.IDPartner, IDNCV = dbResult.IDNCV, IDChuNhiem = dbResult.IDChuNhiem, IDHRCO = dbResult.IDHRCO, IDPhanLoaiDeTai = dbResult.IDPhanLoaiDeTai, IDTrangThai_HDDD = dbResult.IDTrangThai_HDDD, IDTrangThai_HDKH = dbResult.IDTrangThai_HDKH, IDTrangThai_HRCO = dbResult.IDTrangThai_HRCO, IDTrangThai_NghiemThu = dbResult.IDTrangThai_NghiemThu, DeTai = dbResult.DeTai, GhiChu = dbResult.GhiChu, SoNCT = dbResult.SoNCT, IsDisabled = dbResult.IsDisabled, IsDeleted = dbResult.IsDeleted, CreatedDate = dbResult.CreatedDate, CreatedBy = dbResult.CreatedBy, ModifiedDate = dbResult.ModifiedDate, ModifiedBy = dbResult.ModifiedBy, MaSo = dbResult.MaSo, TenTiengViet = dbResult.TenTiengViet, TenTiengAnh = dbResult.TenTiengAnh, MaSoProtocalID = dbResult.MaSoProtocalID, MaSoHDDD = dbResult.MaSoHDDD, FileUpload = dbResult.FileUpload, IDHinhThucXetDuyet = dbResult.IDHinhThucXetDuyet, IDTinhTrangNghienCuu = dbResult.IDTinhTrangNghienCuu, FileChapThuan = dbResult.FileChapThuan, IsDisabledHRCO = dbResult.IsDisabledHRCO, IsDisabledHDDD = dbResult.IsDisabledHDDD, FileQuyetDinhNghiemThu = dbResult.FileQuyetDinhNghiemThu, IDLinhVuc = dbResult.IDLinhVuc, }); } else { return(null); } }
public static DTO_PRO_DeTai post_PRO_DeTai(AppEntities db, int PartnerID, DTO_PRO_DeTai item, string Username) { tbl_PRO_DeTai dbitem = new tbl_PRO_DeTai(); if (item != null) { dbitem.IDNCV = item.IDNCV; dbitem.IDChuNhiem = item.IDChuNhiem; dbitem.IDHRCO = item.IDHRCO; dbitem.IDPhanLoaiDeTai = item.IDPhanLoaiDeTai; dbitem.IDTrangThai_HDDD = item.IDTrangThai_HDDD; dbitem.IDTrangThai_HDKH = item.IDTrangThai_HDKH; dbitem.IDTrangThai_HRCO = item.IDTrangThai_HRCO; dbitem.IDTrangThai_NghiemThu = item.IDTrangThai_NghiemThu; dbitem.DeTai = item.DeTai; dbitem.GhiChu = item.GhiChu; dbitem.SoNCT = item.SoNCT; dbitem.IsDisabled = item.IsDisabled; dbitem.IsDeleted = item.IsDeleted; dbitem.MaSo = item.MaSo; dbitem.TenTiengViet = item.TenTiengViet; dbitem.TenTiengAnh = item.TenTiengAnh; dbitem.MaSoProtocalID = item.MaSoProtocalID; dbitem.MaSoHDDD = item.MaSoHDDD; dbitem.FileUpload = item.FileUpload; dbitem.IDHinhThucXetDuyet = item.IDHinhThucXetDuyet; dbitem.IDTinhTrangNghienCuu = item.IDTinhTrangNghienCuu; dbitem.FileChapThuan = item.FileChapThuan; dbitem.IsDisabledHRCO = item.IsDisabledHRCO; dbitem.IsDisabledHDDD = item.IsDisabledHDDD; dbitem.FileQuyetDinhNghiemThu = item.FileQuyetDinhNghiemThu; dbitem.IDLinhVuc = item.IDLinhVuc; dbitem.CreatedBy = Username; dbitem.CreatedDate = DateTime.Now; dbitem.ModifiedBy = Username; dbitem.ModifiedDate = DateTime.Now; dbitem.IDPartner = PartnerID; try { db.tbl_PRO_DeTai.Add(dbitem); db.SaveChanges(); BS_CUS_Version.update_CUS_Version(db, dbitem.IDPartner, "DTO_PRO_DeTai", DateTime.Now, Username); item.ID = dbitem.ID; item.CreatedBy = dbitem.CreatedBy; item.CreatedDate = dbitem.CreatedDate; item.ModifiedBy = dbitem.ModifiedBy; item.ModifiedDate = dbitem.ModifiedDate; item.IDPartner = dbitem.IDPartner; } catch (DbEntityValidationException e) { errorLog.logMessage("post_PRO_DeTai", e); item = null; } } return(item); }