Exemplo n.º 1
0
        public ResponseOut UpdatePlans(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();

            try
            {
                using (PortalEntities _context = new PortalEntities())
                {
                    portal_plan plan = _context.portal_plan.Where(x => x.pk_plan_type_id == model.pk_plan_id).FirstOrDefault();
                    plan.is_active  = model.is_active;
                    plan.is_deleted = false;
                    plan.plan_name  = model.plan_name;
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansCreatedSuccess;
                    }
                }
            }
            catch (Exception ex)
            {
                responseOut.status  = ActionStatus.Fail;
                responseOut.message = ActionMessage.ApplicationException;
            }

            return(responseOut);
        }
Exemplo n.º 2
0
        public JsonResult AddUpdatePlanSelectedByCandidate(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();
            IPlansBL    planBL      = new PlansEngine();

            try
            {
                if (model.pk_plan_id != 0)
                {
                    model.pk_user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut      = planBL.AddUpdateSelectPlanByCandidate(model);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in Candidate Controller/AddUpdatePlanSelectedByVendor", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ResponseOut AddPlans(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();

            try
            {
                using (PortalEntities _context = new PortalEntities())
                {
                    portal_plan plan = new portal_plan();
                    plan.is_active  = model.is_active;
                    plan.is_deleted = false;
                    plan.plan_name  = model.plan_name;
                    _context.portal_plan.Add(plan);
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansCreatedSuccess;
                    }
                }
            }
            catch (Exception ex)
            {
                responseOut.status  = ActionStatus.Fail;
                responseOut.message = ActionMessage.ApplicationException;
            }

            return(responseOut);
        }
Exemplo n.º 4
0
        public PlansPage()
        {
            _ViewModel     = DependencyService.Get <PlansViewModel>();
            BindingContext = _ViewModel;

            InitializeComponent();
        }
Exemplo n.º 5
0
        public ActionResult Index(string query = null)
        {
            var view = new View
            {
                Time = DateTime.Now
            };

            _unitOfWork.Views.Add(view);
            _unitOfWork.Complete();

            var plansToDisplay = _unitOfWork.Plans.GetAllPlans();

            if (!String.IsNullOrWhiteSpace(query))
            {
                plansToDisplay = _unitOfWork.Plans.GetFilteredPlans(query);
            }

            // In UI we display ratings as integers
            foreach (Plan plan in plansToDisplay)
            {
                plan.Rating = Math.Round(plan.Rating, 0);
            }

            var userId     = User.Identity.GetUserId();
            var favourites = _unitOfWork.Favourites.GetUserFavourites(userId)
                             .ToLookup(f => f.PlanId);

            var ratings = _unitOfWork.Ratings.GetUserRatings(userId)
                          .ToLookup(r => r.PlanId);

            var viewModel = new PlansViewModel
            {
                PlansToDisplay = plansToDisplay
                                 .OrderByDescending(p => p.Rating)
                                 .ThenByDescending(p => p.RatingCount)
                                 .ThenByDescending(p => p.DateCreated),
                ShowActions = User.Identity.IsAuthenticated,
                Heading     = "User Plans",
                Favourites  = favourites,
                Ratings     = ratings,
                SearchTerm  = query,
                UserId      = userId
            };

            return(View("Index", viewModel));
        }
Exemplo n.º 6
0
        public ActionResult Favourites()
        {
            var userId = User.Identity.GetUserId();
            var plans  = _unitOfWork.Plans.GetFavouritePlans(userId);

            //In UI we display rating as integer
            foreach (Plan plan in plans)
            {
                plan.Rating = Math.Round(plan.Rating, 0);
            }

            var viewModel = new PlansViewModel
            {
                PlansToDisplay = plans,
                ShowActions    = false,
                Heading        = "My Favourites",
                Favourites     = null
            };

            return(View("Favourites", viewModel));
        }
Exemplo n.º 7
0
        public async Task <ActionResult> Index(PlanQueryViewModel viewModel)
        {
            if (viewModel.PageNumber < 1)
            {
                viewModel.PageNumber = 1;
            }
            if (viewModel.PageSize < 1)
            {
                viewModel.PageSize = 10;
            }

            PlanQueryDTO filter = new PlanQueryDTO
            {
                Keyword         = viewModel.Keyword,
                CpvCode         = viewModel.CpvCode,
                ScgsCode        = viewModel.GsinCode,
                PlanNumbers     = viewModel.PlanNumbers,
                Procurer        = viewModel.Procurer,
                Region          = viewModel.Region,
                ProcedurePeriod = viewModel.ProcedurePeriod?.ToDTO(),
                ProcedureType   = viewModel.ProcedureType
            };

            IPagedList <PlanDTO> plansPagedList =
                await PlanProvider.Value.GetPlansPage(filter, viewModel.PageNumber, viewModel.PageSize);

            var plansViewModel = new PlansViewModel(plansPagedList, viewModel);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Searches/Plans/PlanTable", plansViewModel));
            }
            else
            {
                return(View("Plans", plansViewModel));
            }
        }
Exemplo n.º 8
0
        public ActionResult AddPlanType(PlansViewModel data)
        {
            IPlansBL    planBL      = new PlansEngine();
            ResponseOut responseOut = new ResponseOut();

            try
            {
                if (data.pk_plan_id == 0)
                {
                    responseOut = planBL.AddPlans(data);
                }
                else
                {
                    responseOut = planBL.UpdatePlans(data);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in PlansController/AddPlanType", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
 public PlansTreeViewModel(PlansViewModel plansViewModel)
 {
     PlansViewModel = plansViewModel;
 }
Exemplo n.º 10
0
        public ResponseOut AddUpdateSelectPlanByCandidate(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_userplan_mapping   portal_Userplan           = null;
                    portal_plan_duration_left portal_Plan_Duration_Left = _context.portal_plan_duration_left.Where(x => x.fk_user_id == model.pk_user_id).FirstOrDefault();
                    portal_vendor_plan        portal_Vendor_Plan;
                    portal_Vendor_Plan = _context.portal_vendor_plan.Where(x => x.pk_vendor_plan_id == model.pk_plan_id).FirstOrDefault();

                    if (portal_Plan_Duration_Left != null)
                    {
                        portal_Plan_Duration_Left.fk_plan_id = portal_Vendor_Plan.pk_vendor_plan_id;
                        portal_Plan_Duration_Left.candidate_listing_limit = portal_Vendor_Plan.candidate_listing_limit;
                        portal_Plan_Duration_Left.interest_recived_limit  = portal_Vendor_Plan.interest_recived_limit;
                        portal_Plan_Duration_Left.lead_access_limit       = portal_Vendor_Plan.lead_access_limit;
                        portal_Plan_Duration_Left.technology_limit        = portal_Vendor_Plan.technology_limit;
                        portal_Plan_Duration_Left.technology_count        = portal_Vendor_Plan.technology_count;
                        portal_Plan_Duration_Left.added_date   = DateTime.Now;
                        portal_Plan_Duration_Left.bold_listing = portal_Vendor_Plan.bold_listing;
                        portal_Plan_Duration_Left.top_ranking  = portal_Vendor_Plan.top_ranking;
                        portal_Plan_Duration_Left.fk_user_id   = model.pk_user_id;
                    }
                    else
                    {
                        portal_Plan_Duration_Left            = new portal_plan_duration_left();
                        portal_Plan_Duration_Left.fk_plan_id = portal_Vendor_Plan.pk_vendor_plan_id;
                        portal_Plan_Duration_Left.candidate_listing_limit = portal_Vendor_Plan.candidate_listing_limit;
                        portal_Plan_Duration_Left.interest_recived_limit  = portal_Vendor_Plan.interest_recived_limit;
                        portal_Plan_Duration_Left.lead_access_limit       = portal_Vendor_Plan.lead_access_limit;
                        portal_Plan_Duration_Left.technology_limit        = portal_Vendor_Plan.technology_limit;
                        portal_Plan_Duration_Left.technology_count        = portal_Vendor_Plan.technology_count;
                        portal_Plan_Duration_Left.added_date   = DateTime.Now;
                        portal_Plan_Duration_Left.bold_listing = portal_Vendor_Plan.bold_listing;
                        portal_Plan_Duration_Left.top_ranking  = portal_Vendor_Plan.top_ranking;
                        portal_Plan_Duration_Left.fk_user_id   = model.pk_user_id;
                        _context.portal_plan_duration_left.Add(portal_Plan_Duration_Left);
                    }

                    portal_Userplan = _context.portal_userplan_mapping.Where(x => x.user_id == model.pk_user_id).FirstOrDefault();
                    if (portal_Userplan != null)
                    {
                        portal_Userplan.plan_id   = model.pk_plan_id;
                        portal_Userplan.is_active = false;
                    }
                    else
                    {
                        portal_Userplan           = new portal_userplan_mapping();
                        portal_Userplan.user_id   = model.pk_user_id;
                        portal_Userplan.plan_id   = model.pk_plan_id;
                        portal_Userplan.plan_time = DateTime.Now;
                        portal_Userplan.is_active = false;
                        _context.portal_userplan_mapping.Add(portal_Userplan);
                    }

                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansSelectedSuccess;
                    }
                }
                catch (EntityException ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
            }
            return(responseOut);
        }
Exemplo n.º 11
0
 public PlansView()
 {
     InitializeComponent();
     BindingContext = new PlansViewModel(Navigation);
 }
Exemplo n.º 12
0
 public ActionResult Search(PlansViewModel viewModel)
 {
     return(RedirectToAction("Index", "Plans", new { query = viewModel.SearchTerm }));
 }