Example #1
0
        public async Task <JsonResult> ApproveUser(IEnumerable <string> Id)
        {
            string ids;

            if (Id != null)
            {
                if (Id.Count() > 0)
                {
                    foreach (var id in Id)
                    {
                        try
                        {
                            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];
                            ids = id.Replace("$25", "/");
                            ids = ids.Replace("$24", "+");
                            string          refID = Cryptoclass.DecryptStringAES(ids, s);
                            ApplicationUser b     = db.Users.First(r => r.Id == refID);
                            b.NotifyStatus = 1;
                            await db.SaveChangesAsync();
                        }
                        catch (Exception ex)
                        {
                            return(Json("error occured" + ex, JsonRequestBehavior.AllowGet));

                            throw ex;
                        }
                    }
                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult Edit(string id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            id = id.Replace("$25", "/");
            id = id.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(id, s);

            var user = UserManager.FindById(DecryptId);

            if (user == null)
            {
                return(HttpNotFound("Error: Requested user not found"));
            }

            //     ApplicationUser usr = user;
            return(View(new EditViewModel
            {
                ID = user.Id,
                Name = user.FullName,
                Nationality = user.Nationality,
                Phone = user.PhoneNumber,
                // username = user.UserName,
                TrackingID = user.MyRefferalCode
            }));
        }
Example #3
0
        public async Task <ActionResult> HelpDesk(string hlpids, FormCollection f)
        {
            Random rd       = new Random();
            int    TicketNo = rd.Next(10000);
            string s        = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            hlpids = hlpids.Replace("$25", "/");
            hlpids = hlpids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(hlpids, s);
            var    usr       = await UserManager.FindByNameAsync(DecryptId);

            string  Name  = usr.FirstName + " " + usr.LastName;
            Support suprt = new Support();

            suprt.Subject                 = f["subject"];
            suprt.Content                 = Server.HtmlEncode(sanitizer.Sanitize(f["Message"], "", null));
            suprt.Support_createdDate     = DateTime.Now;
            suprt.Support_Requestor_Name  = Name;
            suprt.Support_Requestor_Email = usr.Email;
            suprt.support_status          = "Fresh";
            suprt.TicketId                = TicketNo;
            db.supports.Add(suprt);
            await db.SaveChangesAsync();

            string body = em.Notification_Email_Body_Creator("Admin", Name +
                                                             ", with the following email address <a href=\"mailto:" + usr.Email + "\">"
                                                             + usr.Email + "</a> just requested for support on our platform. Below is his/her message content: <br/><br/>" +
                                                             "<div style=\"text-align:justify; border-left: 6px outset #0094ff;background-color: #00ffff; padding-left:5px; padding-right:5px\">" + f["Message"]
                                                             + "</div><br/><br/> Kindly, attend to him/her ASAP.");
            await ems.SubcribersMailSender(mailFrom : usr.Email, subject : f["subject"], Body : body, senderName : Name);

            TempData["success"] = "Message sent successfully, our team will get back to you via email shortly.";
            return(Redirect(Request.UrlReferrer.ToString()));
        }
Example #4
0
        public async Task <ActionResult> unsubnewsletter(string sbn)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            sbn = sbn.Replace("$25", "/");
            sbn = sbn.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(sbn, s);
            var    usr       = db.Users.Find(DecryptId);

            try
            {
                usr.newsletterStatus = 0;
                await db.SaveChangesAsync();

                TempData["msg"] = "You have successfully unsubscribe to our Newsletter.";
                return(View("newsletter"));
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
                return(View());
            }
        }
Example #5
0
        public async Task <ActionResult> Requery_trs(string txnref)
        {
            try
            {
                var    trstb        = db.InterswtichTransactionsTables.Single(t => t.Transaction_Id == txnref);
                var    input        = string.Concat(product_id, txnref, "D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F");
                var    hash         = Cryptoclass.GenerateSHA512String(input);
                string response_url = "https://sandbox.interswitchng.com/collections/api/v1/gettransaction.json?productid=1076&transactionreference=" + txnref + "&amount=" + trstb.Transaction_Amount + "";
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
                var client = new WebClient();
                client.Headers.Add("Hash", hash);
                var content = client.DownloadString(response_url);
                // Create the Json serializer and parse the response
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(PaymentResponse));
                using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(content)))
                {
                    var pmtData = (PaymentResponse)serializer.ReadObject(ms);

                    if (pmtData.ResponseCode == "00")
                    {
                        var iswtb = db.InterswtichTransactionsTables.Single(s => s.Transaction_Id == txnref);
                        iswtb.Transaction_ResponseCode = pmtData.ResponseCode;
                        iswtb.Transaction_Response     = pmtData.ResponseDescription;
                        await db.SaveChangesAsync();
                    }
                }
                return(RedirectToAction("All_Transaction"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
 public JsonResult Delete(string id)
 {
     try
     {
         // TODO: Add delete logic here
         string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];
         id = id.Replace("$25", "/");
         id = id.Replace("$24", "+");
         string          DecryptId = Cryptoclass.DecryptStringAES(id, s);
         ApplicationUser user      = UserManager.FindById(DecryptId);
         var             result    = UserManager.Delete(user);
         if (result.Succeeded)
         {
             return(Json(true, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(false, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #7
0
        public ActionResult Edituser(string Id, [Bind(Exclude = "ID, Email, username,TrackingID")] EditViewModel apuser)
        {
            if (Id == null)
            {
                return(HttpNotFound("Error: Requested user not found!"));
            }
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            Id = Id.Replace("$25", "/");
            Id = Id.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(Id, s);
            var    usr       = UserManager.FindById(DecryptId);

            if (ModelState.IsValid)
            {
                //   usr.FirstName = apuser.Name;
                usr.PhoneNumber = apuser.Phone;
                UserManager.Update(usr);
                TempData["Success"] = "Your Details has been Updated Successfully";

                String EncryptId = Cryptoclass.EncryptStringAES(usr.UserName, s);
                EncryptId = EncryptId.Replace("/", "$25");
                EncryptId = EncryptId.Replace("+", "$24");
                return(RedirectToAction("Profiles", "users", new { ids = EncryptId }));
            }
            String EId = Cryptoclass.EncryptStringAES(usr.Id, s);

            EId = EId.Replace("/", "$25");
            EId = EId.Replace("+", "$24");
            TempData["error"] = "Check that the Phone Number field is correclty typed PHONE NUMBR FORMAT";
            // ModelState.AddModelError("", "validate the error field");
            return(RedirectToAction("Edit", new { id = EId }));
        }
Example #8
0
        public async Task <ActionResult> Become_a_service_booster(string j)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            j = j.Replace("$25", "/");
            j = j.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(j, s);
            var    usr       = db.Users.Find(DecryptId);

            usr.isClientBooster = true;
            await db.SaveChangesAsync();

            var    urlClientBooster = Url.Action("ClientBooster", "ing", null, protocol: Request.Url.Scheme);
            var    urlRegBiz        = Url.Action("create_biz", "business", null, protocol: Request.Url.Scheme);
            string body             = "<p>Thanks for choosing to join others as a service boosters on our platform. <br/>" +
                                      "Our service booster package is design to further expose you to both our new and existing subscribers. <a href=\"" + urlClientBooster + "\" target=\"_blank\"> click here  </a> to find out more.<br/>" +
                                      "We will like to know about your product/service. Kindly, <a href=\"" + urlRegBiz + "\" target=\"_blank\"> register </a> your business/company profile with us.<br/>" +
                                      "We welcome you on board once again.<br/><br/>" +
                                      "Thanks.<br/><br/>" +
                                      "Best Regards,<br/><br/>" +
                                      "IhealthGSFM Team </p>";
            await em.serviceBoosterSignupEmail(usr.LastName, usr.Email, "iHealth Service Boosters", body);

            TempData["success"] = "Your subscription to become a service booster is successfull";
            return(RedirectToAction("UserpanelCarreer"));
        }
Example #9
0
        public async Task <ActionResult> activate_promo(string p)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            p = p.Replace("$25", "/");
            p = p.Replace("$24", "+");
            string DecryptId          = Cryptoclass.DecryptStringAES(p, s);
            INISubcriberExtraDetail u = db.INISubcriberExtraDetails.Find(DecryptId);

            if (u.Promotional_Target_Subscription_Status != "Active")
            {
                u.Promotional_Target_Subscription_Status = "Active";
                u.Promo_start_date = DateTime.UtcNow;
                u.Promo_end_date   = DateTime.UtcNow.AddDays(30);
                await db.SaveChangesAsync();

                TempData["success"] = "iHealth Networking Group Promo Activation is successful";
            }
            else
            {
                TempData["error"] = "ERROR: Your promotional period is still active.";
            }

            return(View("UserpanelCarreer"));
        }
Example #10
0
        public async Task <ActionResult> BizDetails(string id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            id = id.Replace("$25", "/");
            id = id.Replace("$24", "+");
            int          refID = Convert.ToInt32(Cryptoclass.DecryptStringAES(id, s));
            BusinessInfo b     = await db.BusinessInfoes.FindAsync(refID);

            return(View(b));
        }
Example #11
0
        public ActionResult Premium_Referral(string dm)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            dm = dm.Replace("$25", "/");
            dm = dm.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(dm, s);
            int    rid       = Convert.ToInt32(DecryptId);

            return(View(db.premium_user.Where(p => p.sponsorID == rid).OrderByDescending(p => p.Register_Date).ToList()));
        }
Example #12
0
        public ActionResult Direct_Members(string dm)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            dm = dm.Replace("$25", "/");
            dm = dm.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(dm, s);
            var    downline  = db.INISubcriberExtraDetails.Where(d => d.My_Sponsor_Referral_Code == DecryptId && d.PaymentStatus == "Paid");

            return(View(downline.ToList()));
        }
Example #13
0
        public ActionResult my_blog_posts(string post_by_id)//this method allows post creator to view all his/her blogpost
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            post_by_id = post_by_id.Replace("$25", "/");
            post_by_id = post_by_id.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(post_by_id, s);
            var    bp        = db.blog_posts.Where(ps => ps.published_by_Id == DecryptId).OrderByDescending(pd => pd.publish_date);

            return(View(bp));
        }
Example #14
0
        //admin view list of service boosters businesses
        public ActionResult sp_Service_Booster_Biz_List(string sbid)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            sbid = sbid.Replace("$25", "/");
            sbid = sbid.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(sbid, s);
            var    sb        = db.BusinessInfoes.Where(b => b.UserID == DecryptId).ToList();

            return(View(sb));
        }
Example #15
0
        /// <summary>
        /// Profile management session
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public ActionResult Profiles(string ids)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindByName(DecryptId);

            if (usr == null)
            {
                return(HttpNotFound("Requested user not found"));
            }
            //sr = db.Users.ToList();
            //{
            //    id = data.Id,
            //    name = data.Name,
            //    TrackingID = data.TrackingID,
            //    Email = data.Email,
            //    phone = data.PhoneNumber

            //};
            if (usr.Photo != null)
            {
                return(View(new profileViewModel
                {
                    Id = usr.Id,
                    Name = usr.FullName,
                    Email = usr.Email,
                    phone = usr.PhoneNumber,
                    tID = usr.MyRefferalCode,

                    photo =
                        "data:image/png;base64," + Convert.ToBase64String(usr.Photo)
                }));
            }
            else
            {
                return(View(new profileViewModel
                {
                    Id = usr.Id,
                    Name = usr.FullName,
                    Email = usr.Email,
                    phone = usr.PhoneNumber,
                    tID = usr.MyRefferalCode,
                    state = usr.State,
                    Nationality = usr.Nationality,
                    city = usr.City,
                    Address = usr.Address
                }));
            }
        }
Example #16
0
        public async Task <ActionResult> Direct_Members(string dm)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            dm = dm.Replace("$25", "/");
            dm = dm.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(dm, s);
            var    u         = await UserManager.FindByNameAsync(DecryptId);

            var downline = db.IHealthUsersMLM.Where(d => d.MySponsorRefCode == u.MyRefferalCode.ToString());

            return(View(downline.ToList()));
        }
Example #17
0
        // GET: SuperAdm/Modify User Role/5 :
        public ActionResult ModifyRole(string id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            id = id.Replace("$25", "/");
            id = id.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(id, s);
            var    user      = db.Users.Find(DecryptId);

            return(View(new ModifyRoleViewModel {
                FirstName = user.FirstName,
                LastName = user.LastName,
                Id = user.Id,
                CurrentRole = user.UserType
            }));
        }
Example #18
0
        public ActionResult BenefitHistory(string ids)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindByName(DecryptId);

            if (usr == null)
            {
                return(HttpNotFound("Requested user not found"));
            }
            var bHist = db.BenefitClaimersTb.Where(u => u.SubRefCode == usr.MyRefferalCode && u.BenefitProcessStatus == "Settled").ToList().OrderByDescending(d => d.ProcessedDate);

            return(View(bHist));
        }
Example #19
0
        public ActionResult myProducts(string Id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            Id = Id.Replace("$25", "/");
            Id = Id.Replace("$24", "+");
            string ID  = Cryptoclass.DecryptStringAES(Id, s);
            var    pro = db.ProductTb.Where(p => p.UserID == ID);

            if (pro.Count() > 0)
            {
                return(View(pro));
            }
            else
            {
                TempData["error"] = "You don't have any registered product(s).";
                return(View(pro));
            }
        }
Example #20
0
        public ActionResult MyBusiness(string Id)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            Id = Id.Replace("$25", "/");
            Id = Id.Replace("$24", "+");
            string ID  = Cryptoclass.DecryptStringAES(Id, s);
            var    bus = db.BusinessInfoes.Where(b => b.UserID == ID);

            if (bus.Count() > 0)
            {
                return(View(bus));
            }
            else
            {
                TempData["error"] = "You don't have any registered Business(es).";
                return(View(bus));
            }
        }
Example #21
0
        public async Task <ActionResult> generateSettledRPT(string bpd)// this will generate a settlement report foreach beneficiary of benefits
        {
            double cash_bonus;
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            bpd = bpd.Replace("$25", "/");
            bpd = bpd.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(bpd, s);
            int    Id        = Convert.ToInt32(DecryptId);
            var    bc        = await db.BenefitClaimersTb.FindAsync(Id);

            var bf = db.Users.Join(db.BenefitClaimersTb.Where(b => b.SubRefCode == bc.SubRefCode),
                                   u => u.MyRefferalCode,
                                   b => b.SubRefCode,
                                   (u, b) => new { ApplicationUser = u, BenefitClaimersTb = b }).Single(u => u.BenefitClaimersTb.ID == bc.ID);

            if (bf.BenefitClaimersTb.Meet_promo_target == true)
            {
                cash_bonus = bf.BenefitClaimersTb.totalCashBenefits; //+ (bf.BenefitClaimersTb.CashBenefits * 0.1);
            }
            else
            {
                cash_bonus = bf.BenefitClaimersTb.totalCashBenefits;
            }
            return(View("BSReport", new BPReportViewModel
            {
                MembershipID = bf.BenefitClaimersTb.SubRefCode.ToString(),
                Name = bf.ApplicationUser.FirstName + " " + bf.ApplicationUser.LastName,
                Phone = bf.ApplicationUser.PhoneNumber,
                Email = bf.ApplicationUser.Email,
                AccountName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountName)) ? bf.BenefitClaimersTb.AccountName : "",
                AccountNo = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountNumber)) ? bf.BenefitClaimersTb.AccountNumber : "",
                BankName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.BankName)) ? bf.BenefitClaimersTb.BankName : "",
                Benefit = (bf.BenefitClaimersTb.BenefitCategory == "Cash") ? cash_bonus.ToString() : bf.BenefitClaimersTb.HealthBenefits,
                ProcessingId = bf.BenefitClaimersTb.ProcessingId,
                Stage = bf.BenefitClaimersTb.BenefitStage,
                BenefitCat = bf.BenefitClaimersTb.BenefitCategory,
                CurrentStatus = bf.BenefitClaimersTb.BenefitProcessStatus,
                SignedBy = bf.BenefitClaimersTb.SignedBy,
                ProcessedDate = bf.BenefitClaimersTb.ProcessedDate
            }));
        }
Example #22
0
        public ActionResult ref_bonus(string dm)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            dm = dm.Replace("$25", "/");
            dm = dm.Replace("$24", "+");
            string DecryptId       = Cryptoclass.DecryptStringAES(dm, s);
            var    usr             = UserManager.FindByName(DecryptId);
            var    ref_bonus_model = from b in db.referral_bonus_tb
                                     where b.user_ID == usr.Id
                                     select new referral_bonus_view_model()
            {
                downline_name   = b.Downline_Name,
                subcription_fee = b.Subscription_Fee,
                my_bonus        = b.Bonus,
                created_date    = b.Bonus_created_date,
                bonus_type      = b.Bonus_Type
            };

            return(View(ref_bonus_model.ToList().OrderByDescending(b => b.created_date)));
        }
Example #23
0
        public async Task <ActionResult> ModifyRole(string id, FormCollection collection)
        {
            try
            {
                string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];
                id = id.Replace("$25", "/");
                id = id.Replace("$24", "+");
                string DecryptId = Cryptoclass.DecryptStringAES(id, s);
                //TODO: Add update logic here
                var user = db.Users.Find(DecryptId);
                user.UserType = collection["roles"];
                await db.SaveChangesAsync();

                TempData["warning"] = "Role modificaton successfull";
                return(RedirectToAction("ViewAdmins"));
            }
            catch
            {
                return(View());
            }
        }
Example #24
0
        public ActionResult UgradeForm(string ids)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindByName(DecryptId);

            if (usr == null)
            {
                return(HttpNotFound("Requested user not found"));
            }
            return(View(new UpgradeFormViewModel
            {
                FirstName = usr.FirstName,
                LastName = usr.LastName,
                Email = usr.Email,
                PhoneNumber = usr.PhoneNumber,
                Username = usr.UserName,
            }));
        }
Example #25
0
        public ActionResult BankInfo(string ids)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindById(DecryptId);

            if (usr == null)
            {
                return(HttpNotFound("Requested user not found"));
            }
            Bank_Account_Info bk = db.bank_info.SingleOrDefault(b => b.Account_holder_id == usr.Id);

            if (bk != null)
            {
                var model = new BankInfoFormModel
                {
                    AccountName  = bk.AccountName,
                    AcountNumber = bk.AccountNumber,
                    BankName     = bk.BankName,
                    // SubcriberRefCode = usr.MyRefferalCode,
                    Id = bk.Account_holder_id
                };
                return(View(model));
            }
            else
            {
                var model = new BankInfoFormModel
                {
                    Id = usr.Id
                };
                return(View(model));
            }
        }
Example #26
0
        public ActionResult Profiles(string ids)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindByName(DecryptId);

            if (usr == null)
            {
                return(HttpNotFound("Requested user not found"));
            }

            if (usr.Photo != null)
            {
                return(View(new profileViewModel
                {
                    Id = usr.Id,
                    Name = usr.FullName,
                    Email = usr.Email,
                    phone = usr.PhoneNumber,
                    tID = usr.MyRefferalCode,
                    FName = usr.FirstName,
                    LName = usr.LastName,
                    Nationality = usr.Nationality,
                    state = usr.State,
                    city = usr.City,
                    Address = usr.Address,
                    profession = usr.Profession,
                    backgroundinfo = usr.backgroundinfo,
                    fbUrl = usr.facebookUrl,
                    lnUrl = usr.linkedinUrl,
                    twUrl = usr.twitterUrl,
                    User_type = usr.UserType,
                    photo =
                        "data:image/png;base64," + Convert.ToBase64String(usr.Photo)
                }));
            }
            else
            {
                return(View(new profileViewModel
                {
                    Id = usr.Id,
                    Name = usr.FullName,
                    Email = usr.Email,
                    phone = usr.PhoneNumber,
                    tID = usr.MyRefferalCode,
                    FName = usr.FirstName,
                    LName = usr.LastName,
                    Nationality = usr.Nationality,
                    state = usr.State,
                    city = usr.City,
                    Address = usr.Address,
                    profession = usr.Profession,
                    backgroundinfo = usr.backgroundinfo,
                    fbUrl = usr.facebookUrl,
                    lnUrl = usr.linkedinUrl,
                    twUrl = usr.twitterUrl,
                    User_type = usr.UserType
                }));
            }
        }
Example #27
0
        public async Task <ActionResult> edprofile(string ids, [Bind(Exclude = "ID,TrackingID,Email")] profileViewModel apuser, FormCollection f)
        {
            if (ids == null)
            {
                return(HttpNotFound("Error: Requested user not found!"));
            }
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            ids = ids.Replace("$25", "/");
            ids = ids.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(ids, s);
            var    usr       = UserManager.FindById(DecryptId);

            if (ModelState.IsValid)
            {
                var A_O_S = f["other_Profession"];
                if (!string.IsNullOrEmpty(f["subCat1"]))
                {
                    int subcatId1 = Convert.ToInt32(f["subCat1"]);
                    var sbcat1    = await db.SubCategory1.FindAsync(subcatId1);

                    A_O_S = (A_O_S != "") ? A_O_S + ", " + sbcat1.SubCat1Name : sbcat1.SubCat1Name;
                }
                if (!string.IsNullOrEmpty(f["subCat2"]))
                {
                    int subcatId2 = Convert.ToInt32(f["subCat2"]);
                    var sbcat2    = await db.SubCategory2.FindAsync(subcatId2);

                    A_O_S = (A_O_S != "") ? A_O_S + ", " + sbcat2.SubCat2name : sbcat2.SubCat2name;
                }
                //string Username = model.UserName;
                int profVal = (!string.IsNullOrEmpty(f["Profession"])) ? Convert.ToInt32(f["Profession"]) : 0;
                var prof    = (profVal != 0) ? await db.Profession.FindAsync(profVal) : null;

                if (f["Country"] != "")
                {
                    int conid = Convert.ToInt32(f["Country"]); var con3 = await db.country.FindAsync(conid); usr.Nationality = con3.CountryName;
                }
                if (apuser.state != null)
                {
                    int stid = Convert.ToInt32(apuser.state); var st = await db.State.FindAsync(stid); usr.State = st.StateName;
                }
                usr.City                    = apuser.city;
                usr.Address                 = apuser.Address;
                usr.PhoneNumber             = apuser.phone;
                usr.backgroundinfo          = (f["summary"] != "") ? f["summary"] : usr.backgroundinfo;
                usr.facebookUrl             = (f["fbUrl"] != "") ? f["fbUrl"] : usr.facebookUrl;
                usr.twitterUrl              = (f["twUrl"] != "") ? f["twUrl"] : usr.twitterUrl;
                usr.linkedinUrl             = (f["lnUrl"] != "") ? f["lnUrl"] : usr.linkedinUrl;
                usr.Health_Service_Provider = f["HSP"];
                usr.Profession              = (f["HSP"] == "Yes" && prof != null) ? prof.Nomenclature : "Information_Seeker";
                usr.AreaOfSpecialization    = A_O_S;
                UserManager.Update(usr);
                TempData["Success"] = "Your Details has been Updated Successfully";
                String EncryptId = Cryptoclass.EncryptStringAES(usr.UserName, s);
                EncryptId = EncryptId.Replace("/", "$25");
                EncryptId = EncryptId.Replace("+", "$24");
                return(RedirectToAction("Profiles", new { ids = EncryptId }));
            }
            String EId = Cryptoclass.EncryptStringAES(usr.Id, s);

            EId = EId.Replace("/", "$25");
            EId = EId.Replace("+", "$24");
            ids = EId;
            TempData["error"] = "Check that the Phone Number field is correclty typed PHONE NUMBR FORMAT";
            ModelState.AddModelError("", "validate the error field");
            return(RedirectToAction("profiles", new { ids = EId }));
        }
Example #28
0
        public async Task <ActionResult> Choose_Benefits(string type, string claimer)
        {
            string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            claimer = claimer.Replace("$25", "/");
            claimer = claimer.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(claimer, s);
            var    user      = await db.INISubcriberExtraDetails.FindAsync(DecryptId);

            Random rd           = new Random();
            int    RD           = rd.Next(100000);
            string ProcessingID = string.Concat("PID-", RD.ToString());

            #region //Cash_Benefits
            if (type == "Cash_Benefit")
            {
                var bank_details = db.bank_info.Where(bd => bd.Account_holder_id == user.UserID);
                if (bank_details.Count() > 0)
                {
                    //Check if claim has already been submitted: this will help eliminate
                    //double claims submission for a single claim
                    var checkClaims = db.BenefitClaimersTb.Where(c => c.SubRefCode == user.User.MyRefferalCode && c.BenefitProcessStatus != "Settled");
                    if (checkClaims.Count() > 0)
                    {
                        TempData["warning"] = "Oops! You still have an active benefit that is currently being process. Do not click the  claim Benefit link again.";
                        return(RedirectToAction("UserpanelCarreer"));
                    }
                    BenefitClaimersTb bctb = new BenefitClaimersTb();
                    bctb.SubRefCode      = user.User.MyRefferalCode;
                    bctb.Name            = string.Concat(user.User.FirstName, " ", user.User.LastName);
                    bctb.DownlineSize    = user.promo_dl_size + user.Non_promo_dl_size;
                    bctb.BankName        = user.User.bank_acct_info.BankName;
                    bctb.AccountName     = user.User.bank_acct_info.AccountName;
                    bctb.AccountNumber   = user.User.bank_acct_info.AccountNumber;
                    bctb.BenefitCategory = "Cash";
                    //  bctb.MaxDateToMeetTarget = usr.INISubcriberExtraDetails.MaxDT2MtTarget;
                    bctb.B_applicationDate    = DateTime.UtcNow;
                    bctb.CashBenefits         = user.CurrentBonus;
                    bctb.cashBonus            = user.CurrentBonus * 0.1;
                    bctb.totalCashBenefits    = bctb.CashBenefits + bctb.cashBonus;
                    bctb.BenefitProcessStatus = "Fresh";
                    // bctb.BenefitStage = "Career";
                    bctb.ProcessingId      = ProcessingID;
                    bctb.Meet_promo_target = true;
                    // bctb.username = usr.UserName;
                    db.BenefitClaimersTb.Add(bctb);
                    await db.SaveChangesAsync();

                    //Todo : Send mail to Admin on new benefit claims
                    // body1 contain email content that will be sent to beneficiary of claims by the ihealth mail server
                    string body1 = ems.Notification_Email_Body_Creator(user.User.FullName, "Please, be informed that your request to claim " +
                                                                       "benefit has been recieved. <br/><br/>  We will notify you as soon as your benefit is ready." +
                                                                       "<br/><br/> Thank you for choosing iHealth Nigeria GSFM <br/><br/> Best Regards, <br/><br/> iHeath Nigeria GSFM Team.");
                    // body2 will contain message notifying admin of new benefit request.
                    string body2 = ems.Notification_Email_Body_Creator("Admin", "Please, be informed that a fresh request for benefits has been submitted.<br/><br/> Kindly, login to the portal for processing." +
                                                                       "<br/><br/>Thanks.<br/><br/>From: iHealth Nigeria GSFM Mail Sender. ");
                    await em.FreshBenefitClaimNotificationRequest(user.User.Email, "Fresh Benefit Claim Request", body1, body2);

                    TempData["success"] = "Congratulations, Your application for benefit claims having been submitted successfully. We will get back to you shortly";
                    return(RedirectToAction("UserpanelCarreer"));
                }
                else
                {
                    String UserID = iHealth2.CustomClasses.Cryptoclass.EncryptStringAES(user.UserID, s);
                    UserID = UserID.Replace("/", "$25");
                    UserID = UserID.Replace("+", "$24");
                    return(RedirectToAction("BankInfo", "ING", new { ids = UserID }));
                }
            }
            #endregion
            #region //Health_Benefits
            else
            {
                //Check if claim has already been submitted: this will help eliminate
                //double claims submission for a single claim
                var checkClaims = db.BenefitClaimersTb.Where(c => c.SubRefCode == user.User.MyRefferalCode && c.BenefitProcessStatus != "Settled");
                if (checkClaims.Count() > 0)
                {
                    TempData["warning"] = "Oops! You still have an active benefit that is currently being process. Do not click the  claim Benefit link again.";
                    return(RedirectToAction("UserpanelCarreer"));
                }
                BenefitClaimersTb bctb = new BenefitClaimersTb();
                bctb.SubRefCode        = user.User.MyRefferalCode;
                bctb.Name              = string.Concat(user.User.FirstName, " ", user.User.LastName);
                bctb.DownlineSize      = user.promo_dl_size;
                bctb.BenefitCategory   = "Health";
                bctb.B_applicationDate = DateTime.UtcNow;
                if (user.promo_dl_size >= 2 && user.promo_dl_size < 5)
                {
                    bctb.HealthBenefits = "Health Insurance of 2 to 4 referrals";
                }
                else if (user.promo_dl_size >= 4 && user.promo_dl_size < 10)
                {
                    bctb.HealthBenefits = "Health Insurance of 4 to 8 referrals";
                }
                else if (user.promo_dl_size >= 10)
                {
                    bctb.HealthBenefits = "High-Class-Networkers";
                }
                bctb.BenefitProcessStatus = "Fresh";
                bctb.CashBenefits         = user.CurrentBonus;
                // bctb.BenefitStage = "Career";
                bctb.ProcessingId      = ProcessingID;
                bctb.Meet_promo_target = true;
                // bctb.username = usr.UserName;
                db.BenefitClaimersTb.Add(bctb);
                await db.SaveChangesAsync();

                //Todo : Send mail to Admin on new benefit claims
                // body1 contain email content that will be sent to beneficiary of claims by the ihealth mail server
                string body1 = ems.Notification_Email_Body_Creator(user.User.FullName, "Please, be informed that your request to claim " +
                                                                   "benefit has been recieved. <br/><br/>  We will notify you as soon as your benefit is ready." +
                                                                   "<br/><br/> Thank you for choosing iHealth Nigeria GSFM <br/><br/> Best Regards, <br/><br/> iHeath Nigeria GSFM Team.");
                // body2 will contain message notifying admin of new benefit request.
                string body2 = ems.Notification_Email_Body_Creator("Admin", "Please, be informed that a fresh request for benefits has been submitted.<br/><br/> Kindly, login to the portal for processing." +
                                                                   "<br/><br/>Thanks.<br/><br/>From: iHealth Nigeria GSFM Mail Sender. ");
                await em.FreshBenefitClaimNotificationRequest(user.User.Email, "Fresh Benefit Claim Request", body1, body2);

                TempData["success"] = "Congratulations, Your application for benefit claims having been submitted successfully. We will get back to you shortly";
                return(RedirectToAction("UserpanelCarreer"));
            }
            #endregion
            //return View("UserpanelCarreer");
        }
Example #29
0
        public async Task <ActionResult> BPReport(string bpd)// this will generate a
        //report whenever the admin click PROCESS benefit button
        {
            var    ReturnUrl = Request.UrlReferrer;
            double cash_bonus;

            try
            {
                string s = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];
                bpd = bpd.Replace("$25", "/");
                bpd = bpd.Replace("$24", "+");
                string DecryptId = Cryptoclass.DecryptStringAES(bpd, s);
                int    Id        = Convert.ToInt32(DecryptId);
                var    bc        = db.BenefitClaimersTb.Find(Id);
                bc.BenefitProcessStatus = "Being Processed";
                bc.ProcessedDate        = DateTime.UtcNow;
                bc.SignedBy             = Session["Name"].ToString();
                await db.SaveChangesAsync();

                var    getUser = db.Users.Single(x => x.MyRefferalCode == bc.SubRefCode);
                string mailto  = getUser.Email;
                var    subject = "RE: Benefit Claim Request";
                var    body    = em.Notification_Email_Body_Creator(getUser.FullName,
                                                                    "<p style=\"line-height: 150%;\">This is to inform you that your iHealth bonuses is currently been process.<br/>" +
                                                                    "You will be notify via email once your benefit is ready. <br/> Thank you for choosing <a href=\"http://" + url + "\">iHealth Nigeria GSFM</a></p> " +
                                                                    "<br/><br/>Best Regards, <br/><br/> iHealth Nigeria Team.");
                await ems.AdminMailSender(mailto : mailto, Subject : subject, Body : body);

                var bf = db.Users.Join(db.BenefitClaimersTb.Where(b => b.SubRefCode == bc.SubRefCode),
                                       u => u.MyRefferalCode,
                                       b => b.SubRefCode,
                                       (u, b) => new { ApplicationUser = u, BenefitClaimersTb = b }).Single(u => u.BenefitClaimersTb.ID == bc.ID);
                if (bf.BenefitClaimersTb.Meet_promo_target == true)
                {
                    cash_bonus = bf.BenefitClaimersTb.totalCashBenefits /*+ (bf.BenefitClaimersTb.CashBenefits * 0.1)*/;
                }
                else
                {
                    cash_bonus = bf.BenefitClaimersTb.totalCashBenefits;
                }

                return(View(new BPReportViewModel
                {
                    MembershipID = bf.BenefitClaimersTb.SubRefCode.ToString(),
                    Name = bf.ApplicationUser.FirstName + " " + bf.ApplicationUser.LastName,
                    Phone = bf.ApplicationUser.PhoneNumber,
                    Email = bf.ApplicationUser.Email,
                    AccountName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountName)) ? bf.BenefitClaimersTb.AccountName : "",
                    AccountNo = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountNumber)) ? bf.BenefitClaimersTb.AccountNumber : "",
                    BankName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.BankName)) ? bf.BenefitClaimersTb.BankName : "",
                    Benefit = (bf.BenefitClaimersTb.BenefitCategory == "Cash") ? cash_bonus.ToString() : bf.BenefitClaimersTb.HealthBenefits,
                    ProcessingId = bf.BenefitClaimersTb.ProcessingId,
                    //Stage = bf.BenefitClaimersTb.BenefitStage,
                    BenefitCat = bf.BenefitClaimersTb.BenefitCategory,
                    CurrentStatus = bf.BenefitClaimersTb.BenefitProcessStatus,
                    SignedBy = bf.BenefitClaimersTb.SignedBy,
                    ProcessedDate = bf.BenefitClaimersTb.ProcessedDate
                }));
            }
            catch (Exception ex)
            {
                TempData["error"] = "Operation fail due to the following exceptions " + ex;
                return(Redirect(ReturnUrl.ToString()));
            }
        }
Example #30
0
        }// this will generate a processing report foreach beneficiary of benefits

        public async Task <ActionResult> BSReport(string bpd)// this will generate a report whenever the admin click SETTLE benefit button
        {
            double cash_bonus;
            var    ReturnUrl = Request.UrlReferrer;
            string s         = System.Configuration.ConfigurationManager.AppSettings["MaxLevel"];

            bpd = bpd.Replace("$25", "/");
            bpd = bpd.Replace("$24", "+");
            string DecryptId = Cryptoclass.DecryptStringAES(bpd, s);
            int    Id        = Convert.ToInt32(DecryptId);
            var    bc        = await db.BenefitClaimersTb.FindAsync(Id);

            try
            {
                var getUser = db.Users.Single(x => x.MyRefferalCode == bc.SubRefCode);
                getUser.INISubcriberExtraDetails.Promotional_Target_Subscription_Status = "Active";
                getUser.INISubcriberExtraDetails.Promo_start_date  = DateTime.UtcNow.Date;
                getUser.INISubcriberExtraDetails.Promo_end_date    = DateTime.UtcNow.Date.AddDays(30);
                getUser.INISubcriberExtraDetails.promo_dl_size     = 0;
                getUser.INISubcriberExtraDetails.Non_promo_dl_size = 0;
                double currt_bonus = getUser.INISubcriberExtraDetails.CurrentBonus - bc.CashBenefits;
                if (currt_bonus <= 0)
                {
                    getUser.INISubcriberExtraDetails.CurrentBonus = 0;
                }
                else
                {
                    getUser.INISubcriberExtraDetails.CurrentBonus = currt_bonus;
                }
                await db.SaveChangesAsync();

                var refbonus = db.referral_bonus_tb.Where(r => r.user_ID == getUser.Id);
                foreach (referral_BonusTb userbonus in refbonus)
                {
                    var      refb                   = db.referral_bonus_tb.Find(userbonus.id);
                    DateTime bonusCreatedTime       = default(DateTime).Add(userbonus.Bonus_created_date.Value.TimeOfDay);
                    DateTime benefitApplicationTime = default(DateTime).Add(bc.B_applicationDate.Value.TimeOfDay);
                    if (refb.Bonus_created_date < bc.B_applicationDate)
                    {
                        refb.Bonus           = 0;
                        refb.Bonus_Used_Date = DateTime.UtcNow.Date;
                    }
                    else if (refb.Bonus_created_date == bc.B_applicationDate)
                    {
                        if (bonusCreatedTime.Hour < benefitApplicationTime.Hour)
                        {
                            refb.Bonus           = 0;
                            refb.Bonus_Used_Date = DateTime.UtcNow.Date;
                        }
                        else if (bonusCreatedTime.Hour == benefitApplicationTime.Hour)
                        {
                            if (bonusCreatedTime.Minute < benefitApplicationTime.Minute)
                            {
                                refb.Bonus           = 0;
                                refb.Bonus_Used_Date = DateTime.UtcNow.Date;
                            }
                            else if (bonusCreatedTime.Minute == benefitApplicationTime.Minute)
                            {
                                if (bonusCreatedTime.Second < benefitApplicationTime.Second)
                                {
                                    refb.Bonus           = 0;
                                    refb.Bonus_Used_Date = DateTime.UtcNow.Date;
                                }
                                else if (bonusCreatedTime.Second == benefitApplicationTime.Second)
                                {
                                    if (bonusCreatedTime.Millisecond < benefitApplicationTime.Millisecond)
                                    {
                                        refb.Bonus           = 0;
                                        refb.Bonus_Used_Date = DateTime.UtcNow.Date;
                                    }
                                }
                            }
                        }
                    }
                }
                await db.SaveChangesAsync();

                bc.BenefitProcessStatus = "Settled";
                bc.ProcessedDate        = DateTime.UtcNow;
                bc.SignedBy             = Session["Name"].ToString();
                if (bc.Meet_promo_target == true)
                {
                    bc.CashBenefits = bc.CashBenefits; // + (bc.CashBenefits * 0.1);
                }
                await db.SaveChangesAsync();

                string mailto  = getUser.Email;
                var    subject = "RE: Benefit Claim Request";
                var    body    = em.Notification_Email_Body_Creator(getUser.FullName,
                                                                    "<p style=\"line-height: 150%;\">Congratulations! This is to inform you that your benefit claim request has been processed and a new promotional period has been activated for you automatically.<br/>" +
                                                                    "Kindly, refer more people using your referral link or code to get more out of iHealth.<br/>" +
                                                                    "Thank you for choosing <a href=\"http://" + url + "\">iHealth Nigeria GSFM</a></p> " +
                                                                    "<br/><br/>Best Regards, <br/><br/> iHealth Nigeria Team.");
                await ems.AdminMailSender(mailto : mailto, Subject : subject, Body : body);

                ///*
                // TODO: UPDATE iniSubscriberExtraDetails where benefit has been claim and set current benefit to SETTLED
                // */
                //Check iniUserExtraDetails

                //INISubcriberExtraDetail Inisub = db.INISubcriberExtraDetails.Single(u => u.User.MyRefferalCode == bc.SubRefCode);
                //if (bc.BenefitCategory == "CarreerBenefit")
                //{
                //    Inisub.CurrentBenefit = "Settled";
                //    await db.SaveChangesAsync();
                //}
            }
            catch (Exception ex)
            {
                TempData["error"] = "Operation fail due to the following exceptions " + ex;
                return(Redirect(ReturnUrl.ToString()));
            }
            var bf = db.Users.Join(db.BenefitClaimersTb.Where(b => b.SubRefCode == bc.SubRefCode),
                                   u => u.MyRefferalCode,
                                   b => b.SubRefCode,
                                   (u, b) => new { ApplicationUser = u, BenefitClaimersTb = b }).Single(u => u.BenefitClaimersTb.ID == bc.ID);

            if (bf.BenefitClaimersTb.Meet_promo_target == true)
            {
                cash_bonus = bf.BenefitClaimersTb.totalCashBenefits; /*+ (bf.BenefitClaimersTb.CashBenefits * 0.1)*/;
            }
            else
            {
                cash_bonus = bf.BenefitClaimersTb.totalCashBenefits;
            }
            return(View(new BPReportViewModel
            {
                MembershipID = bf.BenefitClaimersTb.SubRefCode.ToString(),
                Name = bf.ApplicationUser.FirstName + " " + bf.ApplicationUser.LastName,
                Phone = bf.ApplicationUser.PhoneNumber,
                Email = bf.ApplicationUser.Email,
                AccountName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountName)) ? bf.BenefitClaimersTb.AccountName : "",
                AccountNo = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.AccountNumber)) ? bf.BenefitClaimersTb.AccountNumber : "",
                BankName = (!string.IsNullOrEmpty(bf.BenefitClaimersTb.BankName)) ? bf.BenefitClaimersTb.BankName : "",

                Benefit = (bf.BenefitClaimersTb.BenefitCategory == "Cash") ? cash_bonus.ToString() : bf.BenefitClaimersTb.HealthBenefits,
                ProcessingId = bf.BenefitClaimersTb.ProcessingId,
                Stage = bf.BenefitClaimersTb.BenefitStage,
                BenefitCat = bf.BenefitClaimersTb.BenefitCategory,
                CurrentStatus = bf.BenefitClaimersTb.BenefitProcessStatus,
                SignedBy = bf.BenefitClaimersTb.SignedBy,
                ProcessedDate = bf.BenefitClaimersTb.ProcessedDate
            }));
        }