Пример #1
0
        public ActionResult CompleteRequest(int id)
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var coopService = new CooperatorService(userId);

            ViewBag.cooperators = coopService.GetCooperators(userId).Where(e => e.ContactType == contact.Employee);

            var locService = new LocationService(userId);

            ViewBag.locations = locService.GetLocations(userId);

            var service = CreateMessageService();
            var detail  = service.GetMessageEditById(id, userId);
            var model   = new MessageEdit
            {
                MessageId        = detail.MessageId,
                LocationId       = detail.LocationId,
                LocationCode     = detail.LocationCode,
                Comment          = detail.Comment,
                CooperatorId     = detail.CooperatorId,
                DateCreated      = detail.DateCreated,
                OwnerId          = detail.OwnerId,
                JobOne           = detail.JobOne,
                JobTwo           = detail.JobTwo,
                JobThree         = detail.JobThree,
                IsRequest        = detail.IsRequest,
                HumanGrowthStage = detail.HumanGrowthStage,
                Rating           = detail.Rating
            };

            return(View(model));
        }
        public ActionResult EditCoop(int id)
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var coopService = new CooperatorService(userId);

            ViewBag.cooperators = coopService.GetCooperators(userId).Where(e => e.ContactType == contact.Cooperator);

            var service = CreateLocationService();
            var detail  = service.GetLocationEditById(id, userId);
            var model   = new LocationEdit
            {
                LocationId      = detail.LocationId,
                LocationName    = detail.LocationName,
                State           = detail.State,
                LocationCode    = detail.LocationCode,
                Longitude       = detail.Longitude,
                Latitude        = detail.Latitude,
                MonthOfPlanting = detail.MonthOfPlanting,
                DayOfPlanting   = detail.DayOfPlanting,
                YearOfPlanting  = detail.YearOfPlanting,
                IsStaked        = detail.IsStaked,
                CooperatorId    = detail.CooperatorId,
                FullName        = detail.FullName
            };

            return(View(model));
        }
Пример #3
0
        public ActionResult Create()
        {
            var userId     = Guid.Parse(User.Identity.GetUserId());
            var locService = new LocationService(userId);

            ViewBag.locations = locService.GetLocations(userId);

            var coopService = new CooperatorService(userId);

            ViewBag.cooperators = coopService.GetCooperators(userId).Where(e => e.ContactType == contact.Employee);

            return(View());
        }
        public ActionResult Edit(int id)
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var coopService = new CooperatorService(userId);

            ViewBag.cooperators = coopService.GetCooperators(userId);

            var messageService = new MessageService(userId);

            ViewBag.messages = messageService.GetMessages(id, userId);

            var documentService = new DocumentService(userId);

            ViewBag.documents = documentService.GetDocuments(id, userId);

            var service = CreateLocationService();
            var detail  = service.GetLocationEditById(id, userId);
            var model   = new LocationEdit
            {
                LocationId      = detail.LocationId,
                LocationName    = detail.LocationName,
                State           = detail.State,
                LocationCode    = detail.LocationCode,
                Longitude       = detail.Longitude,
                Latitude        = detail.Latitude,
                MonthOfPlanting = detail.MonthOfPlanting,
                DayOfPlanting   = detail.DayOfPlanting,
                YearOfPlanting  = detail.YearOfPlanting,
                CooperatorId    = detail.CooperatorId,
                FullName        = detail.FullName,
                CRM             = detail.CRM,
                Messages        = detail.Messages,
                Documents       = detail.Documents,
                Tag             = detail.Tag,
                SearchString    = detail.SearchString,
                DatePlanted     = detail.DatePlanted,
                DateHarvested   = detail.DateHarvested,
                IsPlanted       = detail.IsPlanted,
                IsRowbanded     = detail.IsRowbanded,
                IsStaked        = detail.IsStaked,
                IsHarvested     = detail.IsHarvested,
                DocString       = detail.DocString,
                Rating          = detail.Rating,
                MapLink         = "https://www.google.com/maps/dir/?api=1&destination=" + detail.Latitude + "," + detail.Longitude
            };

            return(View(model));
        }
Пример #5
0
        public ActionResult CreateRequest(MessageCreate model)
        {
            var userId      = Guid.Parse(User.Identity.GetUserId());
            var coopService = new CooperatorService(userId);

            ViewBag.cooperators = coopService.GetCooperators(userId).Where(e => e.ContactType == contact.Employee);

            var locService = new LocationService(userId);

            ViewBag.locations = locService.GetLocations(userId);

            if (ModelState.IsValid)
            {
                var service = new MessageService(Guid.Parse(User.Identity.GetUserId()));
                var result  = service.CreateRequest(model);
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Пример #6
0
        // GET: Cooperator
        public ActionResult Index(string searchString, string toggleView)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new CooperatorService(userId);
            var model   = service.GetCooperators(userId);

            model.OrderBy(s => s.LastName);

            ViewBag.ToggleView   = "viewOne";
            ViewBag.SearchString = searchString;

            if (toggleView != null)
            {
                ViewBag.ToggleView = toggleView;
            }

            if (!String.IsNullOrEmpty(searchString))
            {
                model = model.Where(e => e.SearchString.Contains(searchString.ToUpper()));
            }

            return(View(model.OrderBy(e => e.FullName)));
        }