public ProfessionalDevelopment Update(ProfessionalDevelopment obj, int?Ano, int?Tipo, int?Nseq, AuthUser authUser) { obj.Chapa = authUser.Chapa; var sql = "UPDATE CTJ_PROFESSIONALDEVELOPMENT SET DATA=@Data, DESCRIPTION=@Description, DETAILS=@Details, IMAGEMID=@Imagemid WHERE CHAPA=@Chapa AND ANO=@Ano AND NSEQ=@Nseq AND TIPO=@Tipo"; int nRowUpdated = Db.Database.ExecuteSqlCommand(sql, new[] { new SqlParameter("@Chapa", obj.Chapa), new SqlParameter("@Ano", Ano), new SqlParameter("@Nseq", Nseq), new SqlParameter("@Tipo", Tipo), new SqlParameter("@Data", obj.Data), new SqlParameter("@Description", obj.Description == null ? (object)DBNull.Value : obj.Description), new SqlParameter("@Details", obj.Details == null ? (object)DBNull.Value : obj.Details), new SqlParameter("@Imagemid", obj.ImagemId == null ? (object)DBNull.Value : obj.ImagemId) }); return(obj); }
public ProfessionalDevelopment Remove(ProfessionalDevelopment obj, AuthUser authUser) { obj.Chapa = authUser.Chapa; obj.Ano = authUser.ContextoAno; var sql = "DELETE FROM CTJ_PROFESSIONALDEVELOPMENT WHERE ANO=@Ano AND CHAPA=@Chapa AND TIPO=@Tipo AND NSEQ=@Nseq"; int nRowDeleted = Db.Database.ExecuteSqlCommand(sql, new[] { new SqlParameter("@Ano", obj.Ano), new SqlParameter("@Chapa", obj.Chapa), new SqlParameter("@Tipo", obj.Tipo), new SqlParameter("@Nseq", obj.Nseq) }); return(obj); }
public ProfessionalDevelopment Save(ProfessionalDevelopment obj, AuthUser authUser) { obj.Ano = authUser.ContextoAno; obj.Chapa = authUser.Chapa; //obj.Nseq = GetProfessionalDevelopmentByAnoAndChapa(authUser).Where(x => x.Tipo == obj.Tipo).Max(x => x.Nseq); //TODO: ajustar objeto Observed if (obj.Nseq == null) { obj.Nseq = 1; } else { obj.Nseq = obj.Nseq + 1; } var sql = "INSERT INTO CTJ_PROFESSIONALDEVELOPMENT (CHAPA, ANO, NSEQ, TIPO, DATA, DESCRIPTION, DETAILS, IMAGEMID) VALUES(@Chapa, @Ano, @Nseq, @Tipo, @Data, @Description, @Details, @Imagemid)"; int nRowInserted = Db.Database.ExecuteSqlCommand(sql, new[] { new SqlParameter("@Chapa", obj.Chapa), new SqlParameter("@Ano", obj.Ano), new SqlParameter("@Nseq", obj.Nseq), new SqlParameter("@Tipo", obj.Tipo), new SqlParameter("@Data", obj.Data), new SqlParameter("@Description", obj.Description == null ? (object)DBNull.Value : obj.Description), new SqlParameter("@Details", obj.Details ?? (object)DBNull.Value), new SqlParameter("@Imagemid", obj.ImagemId == null ? (object)DBNull.Value : obj.ImagemId) }); return(obj); }
public ProfessionalDevelopment Remove(ProfessionalDevelopment obj, AuthUser authUser) { return(_selfEvaluationRepository.Remove(obj, authUser)); }
public ProfessionalDevelopment Save(ProfessionalDevelopment obj, AuthUser authUser) { return(obj.Nseq != null?_selfEvaluationRepository.Update(obj, obj.Ano, obj.Tipo, obj.Nseq, authUser) : _selfEvaluationRepository.Save(obj, authUser)); }
public ProfessionalDevelopment Remove(ProfessionalDevelopment obj, AuthUser authUser) { return(_selfEvaluationService.Remove(obj, authUser)); }