// GET: Distributor

        public ActionResult Distributor()
        {
            isAdminLogged();
            logger.Info("Start controller to load list of distributors....");
            DistributorListViewModel model = new DistributorListViewModel();

            model.listDis = dis_Service.GetList(null, null).ToList();
            return(View(model));
        }
        public ActionResult CreateContract()
        {
            isAdminLogged();
            ContractDistributorVM model = new ContractDistributorVM();

            // Get List of old distributors
            IList <DistributorList>      oldDisList  = dis_Service.GetList(null, false);
            IList <DistributorViewModel> _oldDisList = new List <DistributorViewModel>();
            DistributorViewModel         _oldDis;

            if (oldDisList.Count != 0)
            {
                foreach (DistributorList dis in oldDisList)
                {
                    _oldDis               = new DistributorViewModel();
                    _oldDis.address       = dis.Dis.address;
                    _oldDis.Email         = dis.Dis.Email;
                    _oldDis.idDistributor = dis.Dis.idDistributor;
                    _oldDis.name          = dis.Dis.name;
                    _oldDis.phone         = dis.Dis.phone;
                    _oldDisList.Add(_oldDis);
                }
                model.oldDis = _oldDisList;
            }

            // Get List of approved potential distributor
            IList <PotentialDistributor> pDisList    = pDis_Service.SearchByStatus(3);
            IList <PdisRepViewModel>     pDisRepList = new List <PdisRepViewModel>();
            PdisRepViewModel             pDisRep;

            if (pDisList.Count != 0)
            {
                foreach (PotentialDistributor item in pDisList)
                {
                    pDisRep = new PdisRepViewModel();
                    pDisRep.pDis.address       = item.address;
                    pDisRep.pDis.Email         = item.Email;
                    pDisRep.pDis.idDistributor = item.idDistributor;
                    pDisRep.pDis.name          = item.name;
                    pDisRep.pDis.phone         = item.phone;

                    foreach (Representative rep in item.Representatives)
                    {
                        if (rep.PotentialDistributor.idDistributor == item.idDistributor)
                        {
                            pDisRep.rep.email            = rep.email;
                            pDisRep.rep.idRepresentative = rep.idRepresentative;
                            pDisRep.rep.name             = rep.name;
                            pDisRep.rep.phone            = rep.phone;
                            pDisRep.rep.title            = rep.title;
                        }
                    }
                    pDisRepList.Add(pDisRep);
                }
                model.pDis = pDisRepList;
            }

            return(View(model));
        }
Example #3
0
 private void GetViewModel(AspNetRolesViewModel model)
 {
     model.DistributorListItems = _distributorService.GetList().Select(a => new ListItemEntity()
     {
         ID       = a.DistributorId.ToString(),
         ParentID = "",
         Title    = a.DistributionName,
         Selected = a.DistributorId == model.DistributorId
     }).ToList();
 }
Example #4
0
 public ActionResult BusinessReport()
 {
     ViewBag.Parent      = "Báo Cáo Kinh Doanh";
     ViewBag.Distributor = new SelectList(_distributorService.GetList(), "idDistributor", "name");
     return(View());
 }