Example #1
0
        private void populateDatabase()
        {
            writeMessage("Populating Database");
            using (DataClasses1DataContext dc = new DataClasses1DataContext())
            {
                dc.ExecuteCommand("TRUNCATE TABLE invoicelines");
                foreach (var line in callList)
                {
                    invoiceline objref = new invoiceline();
                    objref.firstname       = line.firstname;
                    objref.lastname        = line.lastname;
                    objref.ref_number      = line.asdReference;
                    objref.hoursthisperiod = 0;
                    dc.invoicelines.InsertOnSubmit(objref);
                    dc.SubmitChanges();
                }
                // remove duplicate entries
                var duplicates = (from r in dc.invoicelines
                                  group r by new { r.firstname, r.lastname } into results
                                  select results.Skip(1)
                                  ).SelectMany(a => a);

                dc.invoicelines.DeleteAllOnSubmit(duplicates);
                dc.SubmitChanges();
            }
        }
Example #2
0
 partial void Updateinvoiceline(invoiceline instance);
Example #3
0
 partial void Deleteinvoiceline(invoiceline instance);
Example #4
0
 partial void Insertinvoiceline(invoiceline instance);