コード例 #1
0
        public ActionResult GetSaleInfos()
        {
            var saleInfos = new SaleInfoRepository().Items.ToList();
            var res       = Mapper.Map <IList <SaleInfo>, IList <SaleInfoModel> >(saleInfos);

            return(PartialView("SaleInfoView", res));
        }
コード例 #2
0
        public ActionResult GetManagerGraphic()
        {
            var srep = new SaleInfoRepository();
            var mrep = new ManagerRepository();

            var saleInfos = srep.Items.ToList();
            var managers  = mrep.Items.ToList();
            var dict      = managers.ToDictionary(manager => manager.Id, manager => 0);


            int total = saleInfos.Count;

            foreach (var saleInfo in saleInfos)
            {
                var _manager = saleInfo.FileInformation.Manager;
                try
                {
                    dict[_manager.Id]++;
                }
                catch (Exception e)
                { }
            }


            var res = new List <KeyValuePair <string, int> >();

            foreach (var entry in dict)
            {
                var manag = managers.FirstOrDefault(manager => manager.Id == entry.Key);
                res.Add(new KeyValuePair <string, int>(manag.SecondName, entry.Value));
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult EditSaleInfo(int id)
        {
            var _saleInfo = new SaleInfoRepository().SaleInfoObjectById(id);

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

            var saleInfo = Mapper.Map <SaleInfoModel>(_saleInfo);

            return(PartialView("EditSaleInfoView", saleInfo));
        }
コード例 #4
0
ファイル: Tracker.cs プロジェクト: IIITanbI/EpamProjects
        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 ");
        }
コード例 #5
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 ");
        }
コード例 #6
0
 public ActionResult GetSaleInfos()
 {
     var saleInfos = new SaleInfoRepository().Items.ToList();
     var res = Mapper.Map<IList<SaleInfo>, IList<SaleInfoModel>>(saleInfos);
     return PartialView("SaleInfoView", res);
 }
コード例 #7
0
        public ActionResult GetManagerGraphic()
        {
            var srep = new SaleInfoRepository();
            var mrep = new ManagerRepository();

            var saleInfos = srep.Items.ToList();
            var managers = mrep.Items.ToList();
            var dict = managers.ToDictionary(manager => manager.Id, manager => 0);

            int total = saleInfos.Count;
            foreach (var saleInfo in saleInfos)
            {
                var _manager = saleInfo.FileInformation.Manager;
                try
                {
                    dict[_manager.Id]++;
                }
                catch (Exception e)
                { }
            }

            var res = new List<KeyValuePair<string, int>>();

            foreach (var entry in dict)
            {
                var manag = managers.FirstOrDefault(manager => manager.Id == entry.Key);
                res.Add(new KeyValuePair<string, int>(manag.SecondName, entry.Value));
            }
            return Json(res, JsonRequestBehavior.AllowGet);
        }
コード例 #8
0
        public ActionResult EditSaleInfo(int id)
        {
            var _saleInfo = new SaleInfoRepository().SaleInfoObjectById(id);
            if (_saleInfo == null)
                return View("Error");

            var saleInfo = Mapper.Map<SaleInfoModel>(_saleInfo);
            return PartialView("EditSaleInfoView", saleInfo);
        }