Example #1
0
 public bool RemoveLine(LineCart line)
 {
     try
     {
         _lines.Remove(line);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #2
0
 public bool InsertArtigo(Artigo art, double imp, double qtd)
 {
     try
     {
         LineCart line = _lines.FirstOrDefault(a => a.IdArtigo == art.Id);
         if (line != null)
         {
             line.Qtd = qtd;
         }
         else
         {
             line = new LineCart(art.Id, qtd, imp, art.DescCurta, art.PvpSImp);
             _lines.Add(line);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
        public bool RemoveQtd(Artigo art, double qtd)
        {
            bool     result = false;
            LineCart line   = _lines.FirstOrDefault(a => a.IdArtigo == art.Id);

            try
            {
                if (line != null)
                {
                    line.Qtd = qtd * -1;
                }
                result = true;
            }
            catch
            {
                result = false;
            }
            if (line != null && line.Qtd == 0)
            {
                Lines.Remove(line);
            }
            return(result);
        }