Exemple #1
0
 public List <Struct_DetalleRemito> GetAndFillDetalle()
 {
     ListaArticulos = new List <Struct_DetalleRemito>();
     Data2.Connection.D_Remito D  = new Connection.D_Remito();
     System.Data.DataTable     DT = D.Get_DetalleRemito(IdRemito);
     if (DT != null)
     {
         foreach (System.Data.DataRow DR in DT.Rows)
         {
             ListaArticulos.Add(new Struct_DetalleRemito(DR, UserId));
         }
         if (ListaArticulos.Count > 0)
         {
             return(ListaArticulos);
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Exemple #2
0
 public static Struct_Remito Get_Remito(int IdRemito, int IdUser)
 {
     Connection.D_Remito R  = new Connection.D_Remito();
     System.Data.DataRow DR = R.Get_RemitoById(IdRemito, IdUser);
     if (DR != null)
     {
         return(new Struct_Remito(DR));
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
        public bool SaveDetalle(int IdRemito)
        {
            Data2.Connection.D_Remito R = new Connection.D_Remito();
            decimal total = 0;

            if (IsDecimal == true)
            {
                total = CANTDEC * P.PrecioCompra;
            }
            else
            {
                total = CANTINT * P.PrecioCompra;
            }
            return(R.insert_DetalleRemito(IdRemito, P.Id, P.PrecioCompra, CANTDEC, CANTINT, total));
        }
Exemple #4
0
        public bool SaveRemito()
        {
            bool falla = true;

            Connection.D_Remito R     = new Connection.D_Remito();
            decimal             total = 0;

            if (ListaArticulos != null && ListaArticulos.Count > 0)
            {
                for (int a = 0; a < ListaArticulos.Count; a++)
                {
                    total = total + ListaArticulos[a].getTotal();
                }
                IdRemito = R.insert_Remito(UserId, Supplier.Id, NumeroRemito, DateTime.Now, total);
                if (IdRemito != 0)
                {
                    for (int a = 0; a < ListaArticulos.Count; a++)
                    {
                        bool detected = ListaArticulos[a].SaveDetalle(IdRemito);

                        if (detected == false)
                        {
                            falla = false;
                            break;
                        }
                        else
                        {
                            ListaArticulos[a].SaveNewStock();
                        }
                    }
                    return(falla);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        public static List <Struct_Remito> GetAllRemitos(int UserId)
        {
            List <Struct_Remito> SR;

            Connection.D_Remito   DR = new Connection.D_Remito();
            System.Data.DataTable DT = DR.Select_allRemitos(UserId);
            if (DT != null && DT.Rows.Count > 0)
            {
                SR = new List <Struct_Remito>();
                for (int a = 0; a < DT.Rows.Count; a++)
                {
                    SR.Add(new Struct_Remito(DT.Rows[a]));
                }
                return(SR);
            }
            else
            {
                return(null);
            }
        }