Beispiel #1
0
        public void Test()
        {
            var dto = new AutoParkingDto
            {
                Filled        = DateTime.Now,
                AutoName      = "Nissan X-Trail",
                Type          = Body.Кроссовер,
                AutoNumber    = "В339КУ",
                ParkingNumber = 9,
                TimeOut       = DateTime.Now,
                Price         = 1499,
            };
            var tempFileName = Path.GetTempFileName();

            try
            {
                AutoParkingHelper.WriteToFile(tempFileName, dto);
                var readDto = AutoParkingHelper.LoadFromFile(tempFileName);
                Assert.AreEqual(dto.Filled, readDto.Filled);
            }
            finally
            {
                File.Delete(tempFileName);
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog()
            {
                Filter = "Файл заказа|*.prkng"
            };
            var result = ofd.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                var dto = AutoParkingHelper.LoadFromFile(ofd.FileName);
                SetModelToUI(dto);
            }
        }