public ActionResult GetFileInformations()
        {
            var fileInformations = new FileInformationRepository().Items.ToList();
            var res = Mapper.Map <IList <FileInformation>, IList <FileInformationModel> >(fileInformations);

            return(PartialView("FileInformationView", res));
        }
        public ActionResult EditFileInformation(int id)
        {
            var _fileInformation = new FileInformationRepository().FileInformationObjectById(id);

            if (_fileInformation == null)
            {
                return(View("Error"));
            }

            var fileInformation = Mapper.Map <FileInformationModel>(_fileInformation);

            return(PartialView("EditFileInformationView", fileInformation));
        }
Exemplo n.º 3
0
        public void AddInformationToTheDb(string fileName)
        {
            AddLog("start add information");
            try
            {
                var records = new Reader(fileName).Read();

                var parser = new Parser();
                var fileInformation = parser.ParseFileName(fileName);

                using (var fileInformationRepository = new FileInformationRepository())
                {
                    fileInformationRepository.Add(fileInformation);
                    fileInformation = fileInformationRepository.FileObjectByName(fileInformation.Name);

                    using (var saleInfoRepository = new SaleInfoRepository())
                    {
                        foreach (var record in records)
                        {
                            var saleInfo = parser.ParseRecord(record);
                            saleInfo.FileInformation = fileInformation;
                            lock (Locker)
                            {
                                saleInfoRepository.Add(saleInfo);
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine("exception " + ex.Message);
                //throw;
            }
            AddLog("add infromation OK ");
        }
Exemplo n.º 4
0
        public void AddInformationToTheDb(string fileName)
        {
            AddLog("start add information");
            try
            {
                var records = new Reader(fileName).Read();

                var parser          = new Parser();
                var fileInformation = parser.ParseFileName(fileName);

                using (var fileInformationRepository = new FileInformationRepository())
                {
                    fileInformationRepository.Add(fileInformation);
                    fileInformation = fileInformationRepository.FileObjectByName(fileInformation.Name);

                    using (var saleInfoRepository = new SaleInfoRepository())
                    {
                        foreach (var record in records)
                        {
                            var saleInfo = parser.ParseRecord(record);
                            saleInfo.FileInformation = fileInformation;
                            lock (Locker)
                            {
                                saleInfoRepository.Add(saleInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("exception " + ex.Message);
                //throw;
            }
            AddLog("add infromation OK ");
        }
 public ActionResult GetFileInformations()
 {
     var fileInformations = new FileInformationRepository().Items.ToList();
     var res = Mapper.Map<IList<FileInformation>, IList<FileInformationModel>>(fileInformations);
     return PartialView("FileInformationView", res);
 }
        public ActionResult EditFileInformation(int id)
        {
            var _fileInformation = new FileInformationRepository().FileInformationObjectById(id);
            if (_fileInformation == null)
                return View("Error");

            var fileInformation = Mapper.Map<FileInformationModel>(_fileInformation);
            return PartialView("EditFileInformationView", fileInformation);
        }