コード例 #1
0
        public ActionResult PremiumPaymentHistory(string month)
        {
            ProfileBusiness pb = new ProfileBusiness();

            if (User.IsInRole("Policy Holder"))
            {
                if (!String.IsNullOrEmpty(month))
                {
                    if (pb.getPaymentByMonth(HttpContext.User.Identity.Name, month) != null)
                    {
                        PersonalPaymentHistory found = pb.getPaymentByMonth(HttpContext.User.Identity.Name, month);
                        var toList = new List <PersonalPaymentHistory>();
                        toList.Add(found);
                        return(View(toList));
                    }
                    else
                    {
                        TempData["Error"] = "No Premium payments were found under " + month;
                        return(View(new List <PersonalPaymentHistory>()));
                    }
                }
                return(View(pb.getPaymentHistory(HttpContext.User.Identity.Name)));
            }
            TempData["Error"] = "You are not recognized as a Policy Holder, Therefore some content was hiden for privacy";
            return(View(new List <PersonalPaymentHistory>()));
        }
コード例 #2
0
 public ActionResult applyToAddBeneficiary(BeneficiaryViewModel model, string reason)
 {
     if (ModelState.IsValid)
     {
         var pb       = new PackageBusiness();
         var profileB = new ProfileBusiness();
         for (int x = 0; x < pb.GetAll().Count; x++)
         {
             //find the Policy Holder's package
             if (pb.GetAll()[x].PackageId == pb.GetByName(profileB.getPolicyDetails(HttpContext.User.Identity.Name).packageName).PackageId)
             {
                 //if we haven't reached the maximum number the package can cover, add the beneficiary
                 if (profileB.getBeneficiaries(HttpContext.User.Identity.Name).Count < pb.GetByName(profileB.getPolicyDetails(HttpContext.User.Identity.Name).packageName).maxBeneficiary)
                 {
                     TempData["Error"] = profileB.applyToAddBen(HttpContext.User.Identity.Name, model, reason);
                     break;
                 }
                 else //otherwise return an alert to the user
                 {
                     TempData["Error"] = pb.GetAll()[x].Name + " package can cover up to " + pb.GetAll()[x].maxBeneficiary + " beneficiaries";
                 }
             }
         }
         return(RedirectToAction("attachDocuments"));
     }
     return(View(model));
 }
コード例 #3
0
ファイル: CampaignController.cs プロジェクト: dsamueza/Engine
 public CampaignController(
     UserManager <ApplicationUser> userManager,
     IHttpContextAccessor httpContextAccessor,
     MardisContext mardisContext,
     ILogger <CampaignController> logger,
     ILogger <ServicesFilterController> loggeFilter,
     IDataProtectionProvider protectorProvider,
     IMemoryCache memoryCache,
     IHostingEnvironment hostingEnvironment,
     RedisCache distributedCache) :
     base(userManager, httpContextAccessor, mardisContext, logger)
 {
     Protector                         = protectorProvider.CreateProtector(GetType().FullName);
     _campaignBusiness                 = new CampaignBusiness(mardisContext);
     TableName                         = CCampaign.TableName;
     ControllerName                    = CCampaign.Controller;
     _taskCampaignBusiness             = new TaskCampaignBusiness(mardisContext, distributedCache);
     _commonBusiness                   = new CommonBusiness(mardisContext);
     _customerBusiness                 = new CustomerBusiness(mardisContext);
     _statusCampaignBusiness           = new StatusCampaignBusiness(mardisContext, memoryCache);
     _userBusiness                     = new UserBusiness(mardisContext);
     _channelBusiness                  = new ChannelBusiness(mardisContext);
     _serviceBusiness                  = new ServiceBusiness(mardisContext, distributedCache);
     _statusTaskBusiness               = new StatusTaskBusiness(mardisContext, distributedCache);
     _taskNotImplementedReasonBusiness = new TaskNotImplementedReasonBusiness(mardisContext);
     _hostingEnv                       = hostingEnvironment;
     _profileBusiness                  = new ProfileBusiness(mardisContext);
     if (ApplicationUserCurrent.UserId != null)
     {
         _userId   = new Guid(ApplicationUserCurrent.UserId);
         _Profile  = ApplicationUserCurrent.ProfileId;
         _typeuser = _profileBusiness.GetById(_Profile).IdTypeUser;
     }
 }
コード例 #4
0
        public async Task <PlayerProfile> Get(string id)
        {
            var player = await ProfileBusiness.GetPlayer(id);

            await _context.CommitChanges();

            return(player);
        }
コード例 #5
0
 public HomeBusiness(MardisContext mardisContext) : base(mardisContext)
 {
     _campaignBusiness    = new CampaignBusiness(mardisContext);
     _userBusiness        = new UserBusiness(mardisContext);
     _taskCampaignDao     = new TaskCampaignDao(mardisContext);
     _profileBusiness     = new ProfileBusiness(mardisContext);
     _coreFilterDetailDao = new CoreFilterDetailDao(mardisContext);
     _coreFilterDao       = new CoreFilterDao(mardisContext);
 }
コード例 #6
0
        public RoleStore(string conn)
        {
            var optionsBuilder = new DbContextOptionsBuilder <MardisContext>();

            optionsBuilder.UseSqlServer(conn);

            var mardisContext = new MardisContext(optionsBuilder.Options);

            _profileBusiness = new ProfileBusiness(mardisContext);
        }
コード例 #7
0
        public ActionResult attachDocuments()
        {
            var pb = new ProfileBusiness();

            if (User.IsInRole("Policy Holder"))
            {
                return(View(pb.OutstandingDocList(HttpContext.User.Identity.Name)));
            }
            return(View(new List <ProfileApplicationDocuments>()));
        }
コード例 #8
0
        public void GetProfileOptionsTest()
        {
            ProfileBusiness        target   = new ProfileBusiness(); // TODO: Initialize to an appropriate value
            List <MA_USER_PROFILE> expected = null;                  // TODO: Initialize to an appropriate value
            List <MA_USER_PROFILE> actual;

            actual = target.GetProfileOptions();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #9
0
        public ActionResult AddDocuments(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var pb = new ProfileBusiness();

            return(View(pb.getPersonIn_Docs((int)id)));
        }
コード例 #10
0
 public ActionResult EditContactDetails(ContactDetailsViewModel model)
 {
     if (ModelState.IsValid)
     {
         ProfileBusiness pb = new ProfileBusiness();
         ViewBag.Feedback = pb.updateContactDetails(HttpContext.User.Identity.Name, model);
         return(RedirectToAction("ContactDetails"));
     }
     return(View(model));
 }
コード例 #11
0
        public ActionResult ReplaceDoc(int?idDoc)
        {
            if (idDoc == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var pb = new ProfileBusiness();

            pb.replace((int)idDoc);
            return(RedirectToAction("AddDocuments", new { id = idDoc }));
        }
コード例 #12
0
        public ActionResult EditContactDetails()
        {
            ProfileBusiness pb = new ProfileBusiness();

            if (User.IsInRole("Policy Holder"))
            {
                return(View(pb.getContactDetails(HttpContext.User.Identity.Name)));
            }
            TempData["Error"] = "You are not recognized as a Policy Holder, Therefore some content was hiden for privacy";
            return(View());
        }
コード例 #13
0
        public ActionResult applyToRemoveBeneficiary(string benefIDNum)
        {
            ProfileBusiness pb = new ProfileBusiness();

            if (!String.IsNullOrEmpty(benefIDNum))
            {
                Session["benefIDNum"] = benefIDNum;
                return(View(pb.getOneBeneficiary(benefIDNum)));
            }
            ViewBag.Feedback = "Please select a beneficiary to remove by navigating to Benefiaries under your Profile";
            return(View(new BeneficiariesViewModel()));
        }
コード例 #14
0
        public void CreateUserProfileTest()
        {
            ProfileBusiness target      = new ProfileBusiness(); // TODO: Initialize to an appropriate value
            SessionInfo     sessioninfo = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE userprofile = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE expected    = null;                  // TODO: Initialize to an appropriate value
            MA_USER_PROFILE actual;

            actual = target.CreateUserProfile(sessioninfo, userprofile);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #15
0
 public ActionResult EventViewer(string date)
 {
     if (User.IsInRole("Policy Holder"))
     {
         var pb = new ProfileBusiness();
         if (!String.IsNullOrEmpty(date))
         {
             return(View(pb.getEventsByDate(HttpContext.User.Identity.Name, date)));
         }
         return(View(pb.eventLog(HttpContext.User.Identity.Name)));
     }
     return(View(new List <EventLogViewModel>()));
 }
コード例 #16
0
        public void GetProfileByFilterTest()
        {
            ProfileBusiness        target      = new ProfileBusiness(); // TODO: Initialize to an appropriate value
            SessionInfo            sessioninfo = null;                  // TODO: Initialize to an appropriate value
            string                 name        = string.Empty;          // TODO: Initialize to an appropriate value
            int                    startIndex  = 0;                     // TODO: Initialize to an appropriate value
            int                    count       = 0;                     // TODO: Initialize to an appropriate value
            string                 sorting     = string.Empty;          // TODO: Initialize to an appropriate value
            List <MA_USER_PROFILE> expected    = null;                  // TODO: Initialize to an appropriate value
            List <MA_USER_PROFILE> actual;

            actual = target.GetProfileByFilter(sessioninfo, name, startIndex, count, sorting);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
コード例 #17
0
ファイル: ProfileUIP.cs プロジェクト: Theeranit/DealMarker
        public static object GetProfileOptions(SessionInfo sessioninfo)
        {
            try
            {
                ProfileBusiness _profileBusiness = new ProfileBusiness();
                //Get data from database
                var profiles = _profileBusiness.GetProfileOptions().Select(c => new { DisplayText = c.LABEL, Value = c.ID });

                //Return result to jTable
                return(new { Result = "OK", Options = profiles });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
コード例 #18
0
ファイル: ProfileUIP.cs プロジェクト: Theeranit/DealMarker
 public static object UpdateProfile(SessionInfo sessioninfo, MA_USER_PROFILE record)
 {
     try
     {
         ProfileBusiness _profileBusiness = new ProfileBusiness();
         record.ID       = record.ID;
         record.LABEL    = record.LABEL;
         record.ISACTIVE = record.ISACTIVE;
         var addedStudent = _profileBusiness.UpdateUserProfile(sessioninfo, record);
         return(new { Result = "OK" });
     }
     catch (Exception ex)
     {
         return(new { Result = "ERROR", Message = ex.Message });
     }
 }
コード例 #19
0
 public ActionResult applyToRemoveBeneficiary(string reason, int x = 0)
 {
     if (!String.IsNullOrEmpty(Session["benefIDNum"].ToString()))
     {
         ProfileBusiness pb = new ProfileBusiness();
         ViewBag.Feedback = pb.applyToRemoveBen(HttpContext.User.Identity.Name, Session["benefIDNum"].ToString(), reason);
         var EB = new EmailBusiness();
         EB.to   = new MailAddress(pb.getContactDetails(HttpContext.User.Identity.Name).emailAdress);
         EB.sub  = "Application Recieved - Mpiti Funeral Undertakers";
         EB.body = "This is to confirm that your application for uncovering one beneficiary was recieved for our kind consideration."
                   + "<br/>Look forward to recieve a report in 3 to 5 working days.. "
                   + "<br/><br/> Regards<br/><b>Mpiti Funeral Undertakers - Communications Team</b>";
         EB.Notification();
         return(RedirectToAction("Feedback", new { message = ViewBag.Feedback }));
     }
     ViewBag.Feedback = "Please select a beneficiary to remove by navigating to Benefiaries under your Profile";
     return(View());
 }
コード例 #20
0
 public ActionResult Index(ChangePasswordViewModel model)
 {
     if (ModelState.IsValid)
     {
         IdentityUser   user   = UserManager.FindByName(HttpContext.User.Identity.Name);
         IdentityResult result = UserManager.ChangePassword(user.Id, model.OldPassword, model.NewPassword);
         if (result.Succeeded)
         {
             IAuthenticationManager authenticationManager = HttpContext.GetOwinContext().Authentication;
             //Record this in the event log
             try
             {
                 ProfileActivityLog pal = new ProfileActivityLog()
                 {
                     IDNumber  = HttpContext.User.Identity.Name,
                     EventDate = DateTime.Now,
                     Activity  = "Changed your password"
                 };
                 db.ProfileActivityLogs.Add(pal);
                 db.SaveChanges();
                 var pb = new ProfileBusiness();
                 var EB = new EmailBusiness();
                 EB.to   = new MailAddress(pb.getContactDetails(HttpContext.User.Identity.Name).emailAdress);
                 EB.sub  = "Password Changed";
                 EB.body = "This is to alert you that your password was recently changed."
                           + "<br/><br/> Regards<br/><b>Mpiti Funeral Undertakers - Security Team</b>";
                 EB.Notification();
             }
             catch (Exception ex) { }
             authenticationManager.SignOut();
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "changing the password.");
         }
     }
     return(View(model));
 }
コード例 #21
0
        public TaskController(UserManager <ApplicationUser> userManager,
                              IHttpContextAccessor httpContextAccessor,
                              MardisContext mardisContext,
                              ILogger <TaskController> logger,
                              ILogger <ServicesFilterController> loggeFilter,
                              IDataProtectionProvider protectorProvider,
                              IMemoryCache memoryCache,
                              RedisCache distributedCache, IHostingEnvironment envrnmt)
            : base(userManager, httpContextAccessor, mardisContext, logger)
        {
            _protector                        = protectorProvider.CreateProtector(GetType().FullName);
            _logger                           = logger;
            ControllerName                    = CTask.Controller;
            TableName                         = CTask.TableName;
            _taskCampaignBusiness             = new TaskCampaignBusiness(mardisContext, distributedCache);
            _statusTaskBusiness               = new StatusTaskBusiness(mardisContext, distributedCache);
            _taskNotImplementedReasonBusiness = new TaskNotImplementedReasonBusiness(mardisContext);
            _branchImageBusiness              = new BranchImageBusiness(mardisContext);
            _userBusiness                     = new UserBusiness(mardisContext);
            _questionBusiness                 = new QuestionBusiness(mardisContext);
            _questionDetailBusiness           = new QuestionDetailBusiness(mardisContext);
            _cache            = memoryCache;
            _campaignBusiness = new CampaignBusiness(mardisContext);
            _serviceBusiness  = new ServiceBusiness(mardisContext, distributedCache);
            _profileBusiness  = new ProfileBusiness(mardisContext);
            _Env = envrnmt;
            if (ApplicationUserCurrent.UserId != null)
            {
                _userId          = new Guid(ApplicationUserCurrent.UserId);
                Global.UserID    = _userId;
                Global.AccountId = ApplicationUserCurrent.AccountId;
                Global.ProfileId = ApplicationUserCurrent.ProfileId;
                Global.PersonId  = ApplicationUserCurrent.PersonId;

                _typeuser = _profileBusiness.GetById(Global.ProfileId).IdTypeUser;
            }

            _idAccount = ApplicationUserCurrent.AccountId;
        }
コード例 #22
0
ファイル: ProfileUIP.cs プロジェクト: Theeranit/DealMarker
        public static object GetProfileByFilter(SessionInfo sessioninfo, string name, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                //Return result to jTable
                ProfileBusiness _profilebusiness = new ProfileBusiness();
                //Get data from database
                List <MA_USER_PROFILE> status = _profilebusiness.GetProfileByFilter(sessioninfo, name, jtSorting);

                //Return result to jTable
                return(new { Result = "OK",
                             Records = jtPageSize > 0 ? status.Skip(jtStartIndex).Take(jtPageSize).ToList() : status,
                             TotalRecordCount = status.Count });
            }
            catch (BusinessWorkflowsException bex)
            {
                return(new { Result = "ERROR", Message = bex.Message });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
コード例 #23
0
 public ActionResult AddDocuments(DocumentViewModel model, HttpPostedFileBase upload)
 {
     if (ModelState.IsValid)
     {
         byte[] uploadedFile = new byte[upload.InputStream.Length];
         upload.InputStream.Read(uploadedFile, 0, uploadedFile.Length);
         model.document = uploadedFile;
         var pb = new ProfileBusiness();
         pb.UploadDocument(model);
         if (pb.NumberOfOutstandingDocs(HttpContext.User.Identity.Name) == 0)
         {
             var EB = new EmailBusiness();
             EB.to   = new MailAddress(pb.getContactDetails(HttpContext.User.Identity.Name).emailAdress);
             EB.sub  = "Application Recieved - Mpiti Funeral Undertakers";
             EB.body = "This is to confirm that your application for adding one more beneficiary was recieved for our kind consideration."
                       + "<br/>Look forward to recieve a report in 3 to 5 working days.. "
                       + "<br/><br/> Regards<br/><b>Mpiti Funeral Undertakers - Communications Team</b>";
             EB.Notification();
             ViewBag.Feedback = "Application submitted, look forward to recieve a report in 3 to 5 working days..";
             return(RedirectToAction("Feedback", new { message = ViewBag.Feedback }));
         }
     }
     return(RedirectToAction("attachDocuments"));
 }
コード例 #24
0
        public void ProfileBusinessConstructorTest()
        {
            ProfileBusiness target = new ProfileBusiness();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }