public ActionResult EvaluationDetails(int id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign model = new ViewModel_Campaign();

            model = obj_ideaSub.AllCommentsforIdeaWithEvaluatonReviewForCampaignDetails(id);
            return(View(model));
        }
        public ActionResult Index(ViewModel_Campaign camp)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            int CampaignId_Id = Convert.ToInt32(camp.Id);

            Session["Campaign_Id"] = null;
            return(RedirectToAction("CampaignInfo"));
        }
        public ActionResult ArchivedCampaigns()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign camp = new ViewModel_Campaign();
            int CustomerId          = Convert.ToInt32(User.Identity.Name);

            camp.MyCampaigns = _cust.getArchivedCustomerCampaign(CustomerId);
            return(View(camp));
        }
        public ActionResult Auditor(int id)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign model = new ViewModel_Campaign();

            model                  = obj_ideaSub.AllCommentsforIdeaWithEvaluatonReviewForCampaignManager(id);
            model.idea             = id;
            Session["Campaign_Id"] = model.Id;
            return(View(model));
        }
        public ActionResult SocialStage()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign data = _cust.GetIdeaEndDate(Convert.ToInt32(Session["Campaign_Id"].ToString()));

            IsAuditAllowed(Convert.ToInt32(Session["Campaign_Id"].ToString()));
            ViewBag.StartDate = ((DateTime)data.StartDate).AddDays(1);
            ViewBag.EndDate   = data.EndDate;
            return(View());
        }
        public ActionResult Audit()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign data = _cust.GetImplementationEndDate(Convert.ToInt32(Session["Campaign_Id"].ToString()));

            IsAuditAllowed(Convert.ToInt32(Session["Campaign_Id"].ToString()));

            ViewBag.StartDate = ((DateTime)data.StartDate).AddDays(1);
            ViewBag.EndDate   = data.EndDate;
            SelectList list = new SelectList(_cust.GetAuditTypes(Convert.ToInt32(User.Identity.Name)), "id", "typename");

            ViewBag.Type = list;

            return(View());
        }
        public ActionResult EvaluationStage()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_CampaignIdeaSubmission _dates = obj.GetInnovation(Convert.ToInt32(Session["Campaign_Id"].ToString()));
            //ViewBag.StartDate = _dates.CampStartDate;
            //ViewBag.EndDate = _dates.CampEndDate;

            ViewModel_Campaign data = _cust.GetSocialStageEndDate(Convert.ToInt32(Session["Campaign_Id"].ToString()));

            IsAuditAllowed(Convert.ToInt32(Session["Campaign_Id"].ToString()));

            ViewBag.StartDate = ((DateTime)data.StartDate).AddDays(1);
            ViewBag.EndDate   = data.EndDate;

            ViewBag.EvaluationTeam = _dates.IsEvaluationTeamCreated;
            return(View());
        }
        public ActionResult CampaignInfo(string Id = null)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            ViewModel_Campaign model = new ViewModel_Campaign();

            if (Session["Campaign_Id"] != null && Id != null)
            {
                //int CampaignId_Id = Convert.ToInt32(Session["Campaign_Id"]);
                if (Id != "0")
                {
                    Session["Campaign_Id"] = Id;
                }
                int CampaignId_Id = Convert.ToInt32(Session["Campaign_Id"]);
                if (Convert.ToInt32(Id) != 0)
                {
                    CampaignId_Id = Convert.ToInt32(Id);
                }
                model = _cust.getCustomerCampaigninfo(CampaignId_Id);
                IsAuditAllowed(Convert.ToInt32(Session["Campaign_Id"]));
            }
            else
            {
                if (Id != null)
                {
                    int CampaignId_Id = Convert.ToInt32(Id);
                    Session["Campaign_Id"] = Id;
                    model = _cust.getCustomerCampaigninfo(CampaignId_Id);
                    IsAuditAllowed(Convert.ToInt32(Session["Campaign_Id"]));
                }
            }
            model.MyTeams = manageTeamRepo.GetTeamsListForDropdown(Convert.ToInt32(User.Identity.Name));

            return(View(model));
        }
        public ActionResult CampaignInfo(ViewModel_Campaign model, HttpPostedFileBase PrimaryImage, HttpPostedFileBase[] AdditionalImages, HttpPostedFileBase Attechment)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectPermanent("/Innovation/Login"));
            }

            model.ModifiedBy = Convert.ToInt32(User.Identity.Name);
            int userId = Convert.ToInt32(User.Identity.Name);

            model.CustomerId = userId;
            bool isnewcamp = _cust.CheckCampaginname(model.Name, userId, 0);

            if (model.Id == 0 && isnewcamp == true)
            {
                model.Id = Convert.ToInt32(Session["Campaign_Id"]);
            }


            bool ret = _cust.CheckCampaginname(model.Name, userId, model.Id);

            if (ret == false)
            {
                if (Attechment != null)
                {
                    Guid   newid         = Guid.NewGuid();
                    string fileExtention = Path.GetExtension(Attechment.FileName);
                    string _FileName     = newid + fileExtention;
                    string _path         = Path.Combine(Server.MapPath("~/Images/CustomerLogo/"), _FileName);
                    Attechment.SaveAs(_path);
                    model.Attechment = "/Images/CustomerLogo/" + _FileName;
                }
                int CampaignId = _cust.SaveCapmaignInfo(model);



                if (CampaignId != 0)
                {
                    Session["Campaign_Id"] = CampaignId;
                    if (PrimaryImage != null)
                    {
                        _cust.DeletePrimaryImage(CampaignId);
                        Guid   newid         = Guid.NewGuid();
                        string fileExtention = Path.GetExtension(PrimaryImage.FileName);
                        string _FileName     = newid + fileExtention;
                        string _path         = Path.Combine(Server.MapPath("~/Images/CustomerLogo/"), _FileName);
                        PrimaryImage.SaveAs(_path);
                        ViewModel_CustomerCampaignImages image = new ViewModel_CustomerCampaignImages();
                        image.CampaignId = CampaignId;
                        image.CreatedBy  = Convert.ToInt32(User.Identity.Name);
                        image.ImagePath  = "/Images/CustomerLogo/" + _FileName;
                        image.IsPrimary  = 1;
                        _cust.SaveCampaignImages(image);
                    }
                    foreach (var _image in AdditionalImages)
                    {
                        if (_image != null)
                        {
                            Guid   neid          = Guid.NewGuid();
                            string newid         = neid.ToString();
                            string fileExtention = Path.GetExtension(_image.FileName);
                            string _FileName     = newid + fileExtention;
                            string _path         = Path.Combine(Server.MapPath("~/Images/CustomerLogo/"), _FileName);
                            _image.SaveAs(_path);
                            ViewModel_CustomerCampaignImages image = new ViewModel_CustomerCampaignImages();
                            image.CampaignId = CampaignId;
                            image.CreatedBy  = Convert.ToInt32(User.Identity.Name);
                            image.ImagePath  = "/Images/CustomerLogo/" + _FileName;
                            image.IsPrimary  = 0;
                            _cust.SaveCampaignImages(image);
                        }
                    }
                    _cust.RemoveExistingUser(CampaignId);

                    if (model.TargetUsers != "")
                    {
                        string[] TU = model.TargetUsers.Split(',');
                        foreach (string item in TU)
                        {
                            ViewModel_Customers_Campaigns_TargetUser _tu = new ViewModel_Customers_Campaigns_TargetUser();
                            _tu.CampaignId = CampaignId;
                            _tu.CreateBy   = Convert.ToInt32(User.Identity.Name);
                            _tu.userid     = Convert.ToInt32(item);
                            _cust.SaveCampaignTargetUsers(_tu);
                        }

                        TempData["Campiagn1"] = "Data Saved Successfully.";
                    }



                    return(RedirectToAction("CampaignIdeaSubmission"));
                }
                model.MyTeams = manageTeamRepo.GetTeamsList(userId);
                return(View(model));
            }
            else
            {
                TempData["Campiagnerr"] = "Campaign already exists.";
                return(RedirectToAction("CampaignInfo"));
            }
        }