Ejemplo n.º 1
0
        public MotivoN2 ParseToDTO(DataRow row)
        {
            MotivoN2 m = new MotivoN2();

            m.ID        = row.ParseToInt64("id");
            m.Descricao = row.ParseToString("descMotivoN2");
            m.DataRI    = row.ParseToDatetime("dataRI");
            return(m);
        }
Ejemplo n.º 2
0
 public Dictionary <string, object> ParseToParameters(MotivoN2 t)
 {
     return(new Dictionary <string, object>()
     {
         { "ID", t.ID },
         { "IDN1", t.MotivoN1Parent?.ID },
         { "DESCRICAO", t.Descricao },
         { "DATARI", DateTime.Now }
     });
 }
Ejemplo n.º 3
0
        public MotivoN2 SaveUpdate(MotivoN2 t)
        {
            using (DataTable dt = this.GetDataTable("spSaveUpdateMotivosN2 @ID, @IDN1, @DESCRICAO, @DATARI", this.ParseToParameters(t)))
            {
                foreach (DataRow row in dt.Rows)
                {
                    t.ID = row.ParseToInt64("id");
                    return(t);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        public MotivoN2 Delete(MotivoN2 t)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>()
            {
                { "ID", t.ID }
            };

            using (DataTable dt = this.GetDataTable("spDeleteMotivoN2 @ID", dic))
            {
                this.CheckPatternError(dt.Rows);

                foreach (DataRow row in dt.Rows)
                {
                    return(t);
                }
            }
            return(null);
        }
Ejemplo n.º 5
0
        public IActionResult DeleteMotivoN2([FromServices] DAOFactory dao, [FromBody] MotivoN2 motivo)
        {
            if (motivo.ID <= 0)
            {
                return(this.WriteErrorInfo("Erro ao deletar MotivoN2, ID não pode ser nulo."));
            }

            try
            {
                var result = dao.InitMotivoN2DAO().Delete(motivo);

                return(this.WriteSucess(result));
            }
            catch (Exception ex)
            {
                return(this.WriteErrorInfo(ex?.Message));
            }
        }