Exemplo n.º 1
0
        private string getVaretekst(Tblactebisfaktura recActebisfaktura, Tblactebisordre recActebisordre, bool bVareforbrug)
        {
            string Tekst = recActebisordre.Beskrivelse.Trim();

            if (!bOmkostningsVarenr(recActebisordre.Varenr))
            {
                if (bVareforbrug)
                {
                    if ((recActebisfaktura.Ordreref != null) && (recActebisfaktura.Ordreref.Length > 0))
                    {
                        Tekst += ". Indkøbsordre: " + recActebisfaktura.Ordreref.Trim();
                    }
                }
                if ((recActebisordre.Sku != null) && (recActebisordre.Sku.Length > 0))
                {
                    Tekst += ". Producent varenr: " + recActebisordre.Sku.Trim();
                }
                if ((recActebisordre.Serienr != null) && (recActebisordre.Serienr.Length > 0))
                {
                    Tekst += ". Serienr: " + recActebisordre.Serienr.Trim();
                }
                if ((recActebisordre.Producent != null) && (recActebisordre.Producent.Length > 0))
                {
                    Tekst += ". Producent: " + recActebisordre.Producent.Trim();
                }
            }
            if (Tekst.Length > 512)
            {
                return(Tekst.Substring(0, 511));
            }
            else
            {
                return(Tekst);
            }
        }
Exemplo n.º 2
0
        public void load()
        {
            var qry = from w in this
                      where w.Ordrestatus == "lukket"
                      join a in Program.dbDataTransSumma.Tblactebisordre
                      on new
            {
                w.Ordrenr,
                w.Pos,
            }
            equals new
            {
                a.Ordrenr,
                a.Pos,
            }
            into actebisordre
            from a in actebisordre.DefaultIfEmpty(new Tblactebisordre {
                Pid = 0, Ordrenr = null
            })
            where a.Ordrenr == null
            orderby w.Fakturanr, w.Pos
            select w;


            int antal         = qry.Count();
            int?lastFakturanr = null;
            Tblactebisfaktura recActebisfaktura = null;

            foreach (var w in qry)
            {
                if ((w.Fakturanr != lastFakturanr) && (w.Fakturanr != null))
                {
                    try
                    {
                        recActebisfaktura = (from f in Program.dbDataTransSumma.Tblactebisfaktura where f.Fakturanr == w.Fakturanr select f).First();
                    }
                    catch
                    {
                        recActebisfaktura = new Tblactebisfaktura
                        {
                            Import           = true,
                            Ordredato        = w.Ordredato,
                            Fakturanr        = w.Fakturanr,
                            Ordrenr          = w.Ordrenr,
                            Ordreref         = w.Ordreref,
                            Ordrebelob       = w.Ordrebelob,
                            Ordrestatus      = w.Ordrestatus,
                            Leveringsadresse = w.Leveringsadresse,
                        };
                        Program.dbDataTransSumma.Tblactebisfaktura.InsertOnSubmit(recActebisfaktura);
                    }
                }

                Tblactebisordre recActebisordre = new Tblactebisordre
                {
                    Ordrenr        = w.Ordrenr,
                    Pos            = w.Pos,
                    Antal          = w.Antal,
                    Varenr         = w.Varenr,
                    Sku            = w.Sku,
                    Beskrivelse    = w.Beskrivelse,
                    Ordrerefpos    = w.Ordrerefpos,
                    Stkpris        = w.Stkpris,
                    Leveringsnr    = w.Leveringsnr,
                    Serienr        = w.Serienr,
                    Ordrestatuspos = w.Ordrestatuspos,
                    Producent      = w.Producent,
                };
                recActebisfaktura.Tblactebisordre.Add(recActebisordre);
                lastFakturanr = w.Fakturanr;
            }
            Program.dbDataTransSumma.SubmitChanges();
        }