public void FecharComanda(Comanda comanda)
 {
     _connection.ExecuteProcedure(Procedure.UpdComanda);
     _connection.AddParameter("NumSeql_Cmd",comanda.NumSeql_Cmd);
     _connection.AddParameter("VlrTotal_Cmd", comanda.VlrTotal_Cmd);
     _connection.AddParameter("CodFormaPgto_Cmd", comanda.CodFormaPgto_Cmd);
     _connection.ExecuteNonQuery();
 }
        public Comanda GetComanda(int numComanda)
        {
            _connection.ExecuteProcedure(Procedure.BuscaComanda);
            _connection.AddParameter("NumSeql_Cmd", numComanda);
            using (var reader = _connection.ExecuteReader())
            {
                var ListaItem = new List<ComandaItem>();
                while (reader.Read())
                {
                    ListaItem.Add(new ComandaItem()
                    {
                        Cod_ItemCmd = (int)reader["Cod_ItemCmd"],
                        Cod_Prod = (int)reader["Cod_Prod"],
                        Nome_Prod = (string)reader["Nome_Prod"],
                        Data_ItemCmd = (DateTime)reader["Data_ItemCmd"],
                        Qtd_ItemCmd = (int)reader["Qtd_ItemCmd"],
                        Vlr_ItemCmd = (decimal)reader["Vlr_ItemCmd"]
                    });
                }

                if (reader.NextResult())
                {
                    var comanda = new Comanda();
                    if (reader.Read())
                    {
                        comanda.Itens = ListaItem;
                        comanda.VlrTotal_Cmd = (decimal)reader["VlrTotal_Cmd"];
                    }

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            comanda.DataAbert_Cmd = (DateTime)reader["DataAbert_Cmd"];
                        }
                    }

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            var dateFechamento = reader["DataFecha_Cmd"];

                            comanda.Desc_Pgto = (string)reader["Desc_Pgto"];
                            comanda.CodFormaPgto_Cmd = (int)reader["CodFormaPgto_Cmd"];
                            comanda.DataFecha_Cmd = dateFechamento.GetType().Name == "DBNull" ? new DateTime() : Convert.ToDateTime(dateFechamento);
                        }
                        return comanda;

                    }

                }

                return null;
            }
        }