Beispiel #1
0
        public ResponseOut UpdatePlanByPlanIDByAdmin(int planId)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_userplan_mapping portal_Userplan = null;
                    portal_Userplan = _context.portal_userplan_mapping.Where(x => x.userplan_id == planId).FirstOrDefault();
                    if (portal_Userplan != null)
                    {
                        portal_Userplan.is_active = true;
                    }
                    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);
        }
Beispiel #2
0
        public ResponseOut AddUpdateSelectPlanByVendor(int plan_id, int vendor_id)
        {
            ResponseOut responseOut = new ResponseOut();

            try
            {
                using (PortalEntities _context = new PortalEntities())
                {
                    portal_userplan_mapping vendor_plan_mapping = null;

                    vendor_plan_mapping = _context.portal_userplan_mapping.Where(x => x.user_id == vendor_id).FirstOrDefault();
                    if (vendor_plan_mapping != null)
                    {
                        vendor_plan_mapping.plan_id   = plan_id;
                        vendor_plan_mapping.is_active = false;
                    }
                    else
                    {
                        vendor_plan_mapping           = new portal_userplan_mapping();
                        vendor_plan_mapping.user_id   = vendor_id;
                        vendor_plan_mapping.plan_id   = plan_id;
                        vendor_plan_mapping.plan_time = DateTime.Now;
                        vendor_plan_mapping.is_active = false;
                        _context.portal_userplan_mapping.Add(vendor_plan_mapping);
                    }
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansSelectedSuccess;
                    }
                }
            }
            catch (Exception ex)
            {
                responseOut.status  = ActionStatus.Fail;
                responseOut.message = ActionMessage.ApplicationException;
            }

            return(responseOut);
        }
Beispiel #3
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);
        }