protected void CommitDayButton_Click(Object sender, EventArgs e) { try { var rows = DpdTrackingNumberCsv.Read(this.DpdImportFile.PostedFile.InputStream); DpdImportController.Import(rows); Mailing.GenerateAutoTrackingNumber(); SyncProcessRemote.StartSyncProcess(SyncProcessRemote.SyncTypes.TrackingNumber); } catch (Exception ex) { this.Master.ShowError(ex); } }
public void ImportCsv() { using (MyDataContext.Default = new MyDataContext(Effort.EntityConnectionFactory.CreateTransient("name=MyDataContext"))) { byte[] buffer = Encoding.UTF8.GetBytes(Shopper.Tests.Properties.Resources.DpdLieferungen); MemoryStream stream = new MemoryStream(buffer); var rows = DpdTrackingNumberCsv.Read(stream); var sale = CreateTestSale(); DpdImportController.Import(rows); Assert.AreEqual("01505076177381", sale.Mailing.TrackingNumber); Assert.AreEqual(true, sale.Mailing.MustSyncTrackingNumber); Assert.AreEqual(DateTime.Now.Date, sale.Mailing.DateOfShipping); } }