public ActionResult Index()
        {
            //if (User.Identity.IsAuthenticated == false)     //This works, but it's verbose.  Use an attribute!
            //    return RedirectToAction("Login");
            MyAccountModel model = new MyAccountModel();

            model.EmailAddress = User.Identity.Name;

            string publicKey   = ConfigurationManager.AppSettings["Braintree.PublicKey"];
            string privateKey  = ConfigurationManager.AppSettings["Braintree.PrivateKey"];
            string environment = ConfigurationManager.AppSettings["Braintree.Environment"];
            string merchantId  = ConfigurationManager.AppSettings["Braintree.MerchantID"];

            Braintree.BraintreeGateway braintree = new Braintree.BraintreeGateway(environment, merchantId, publicKey, privateKey);
            int userId = -1;

            using (MemberEntities1 e = new MemberEntities1())
            {
                userId = e.CustomerLists.Single(x => x.EmailAddress == User.Identity.Name).ID;
            }
            var customer = braintree.Customer.Find(userId.ToString());

            model.FirstName = customer.FirstName;
            model.LastName  = customer.LastName;
            model.Phone     = customer.Phone;
            model.Company   = customer.Company;
            model.Fax       = customer.Fax;
            model.Website   = customer.Website;
            return(View(model));
        }
        public ActionResult Index(MyAccountModel model)
        {
            string publicKey   = ConfigurationManager.AppSettings["Braintree.PublicKey"];
            string privateKey  = ConfigurationManager.AppSettings["Braintree.PrivateKey"];
            string environment = ConfigurationManager.AppSettings["Braintree.Environment"];
            string merchantId  = ConfigurationManager.AppSettings["Braintree.MerchantId"];

            Braintree.BraintreeGateway braintree = new Braintree.BraintreeGateway(environment, merchantId, publicKey, privateKey);
            int userId = -1;

            using (MemberEntities1 e = new MemberEntities1())
            {
                userId = e.CustomerLists.Single(x => x.EmailAddress == User.Identity.Name).ID;
            }
            Braintree.CustomerRequest update = new Braintree.CustomerRequest();
            update.FirstName = model.FirstName;
            update.LastName  = model.LastName;
            update.Phone     = model.Phone;
            update.Company   = model.Company;
            update.Fax       = model.Fax;
            update.Website   = model.Website;
            braintree.Customer.Update(userId.ToString(), update);

            return(View(model));
        }
Exemplo n.º 3
0
 public ActionResult SaveUpdateTenant(MyAccountModel model)
 {
     try
     {
         return(Json(new { result = 1, ID = model.SaveUpdateTenant(model) }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { error = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 4
0
 public JsonResult GetTenantVehicleLeaseDocuments(MyAccountModel model)
 {
     try
     {
         return(Json(new { model = new MyAccountModel().GetTenantVehicleLeaseDocuments(model) }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception Ex)
     {
         return(Json(new { model = Ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 5
0
 public ActionResult UpdateWorkInfo(MyAccountModel model, long UserId)
 {
     try
     {
         return(Json(new { msg = new MyAccountModel().UpdateWorkInfo(model, UserId) }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { msg = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 6
0
 public ActionResult UpdateEmContactInfo(MyAccountModel model, long UserId)
 {
     try
     {
         return(Json(new { result = 1, ID = model.UpdateEmContactInfo(model, UserId) }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { error = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 7
0
        MyAccountModel MapAccount(AccountInfo accountInfo)
        {
            var myAccountModel = new MyAccountModel {
                Account = _mappingEngine.Map <Account>(accountInfo)
                          //Friends = await GetFriends(context).ConfigureAwait(false),
                          //Groups = await GetGroups().ConfigureAwait(false),
                          //InviteRequests = await GetInviteRequests().ConfigureAwait(false)
            };

            return(myAccountModel);
        }
 public ActionResult SaveProfilePicture(MyAccountModel model)
 {
     try
     {
         return(Json(new { msg = new MyAccountModel().SaveProfilePic(model) }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { msg = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 9
0
        public ActionResult MySettings(MyAccountModel account)
        {
            var userid    = Convert.ToInt32(Session["UserID"]);
            var passmatch = _manageRepository.comparePassword(userid, account.OLDPASSWORD);

            if (!ModelState.IsValid || !passmatch)
            {
                return(View());
            }
            _manageRepository.UpdatePassword(userid, account.PASSWORD);

            return(RedirectToAction("Profile"));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> Profile()
        {
            var ticketsTask         = AppFactory.TicketService.Value.GetTicketsByUserId(User.GetUserId());
            var workshopTicketsTask = AppFactory.TicketService.Value.GetWorkshopsTicketsAsync();

            await Task.WhenAll(ticketsTask, workshopTicketsTask);

            var model = new MyAccountModel();

            var workshops = _workshopService.Value.GetAll().ToList();

            model.Workshops = new List <WorkshopModel>();

            var workshopTickets = workshopTicketsTask.Result;

            foreach (var workshop in workshops)
            {
                var ticketsLeft = workshop.MaxTickets - workshopTickets.Count(x => x.WorkshopId == workshop.Id);
                if (ticketsLeft < 0)
                {
                    ticketsLeft = 0;
                }

                if (ticketsLeft > 0)
                {
                    model.Workshops.Add(new WorkshopModel
                    {
                        Workshop    = workshop,
                        TicketsLeft = ticketsLeft
                    });
                }
            }

            var tickets = ticketsTask.Result;

            if (tickets != null && tickets.Any())
            {
                model.PayedConferenceTicket = tickets.SingleOrDefault(x => x.TicketType == TicketType.Regular);

                model.PayedWorkshopTicket = tickets.SingleOrDefault(x => x.TicketType == TicketType.Workshop);
                if (model.PayedWorkshopTicket != null)
                {
                    model.PayedWorkshop = _workshopService.Value.GetById(model.PayedWorkshopTicket.WorkshopId.Value);
                }
            }

            return(View(model));
        }
Exemplo n.º 11
0
        private MyAccountModel GetMyAccountModel(IConfiguration configuration, MyMeetupUser currentUser = null)
        {
            MyAccountModel model = new MyAccountModel(currentUser ?? CurrentUser);

            model.Payments = Domain.GetPayments(model.CurrentUser?.Id ?? -1, true);
            List <Registration> regs = Domain.GetRegistrations(model.CurrentUser.Id, true)
                                       .Where(x => x.RegistrationStatus <= ERegistrationStatus.Registered)
                                       .OrderBy(x => x.Meetup.StartDate).ToList();

            model.OldMeetups = regs.Where(x => x.Meetup.EndDate <= DateTime.Now).ToList();
            var nextRegistrations = regs.Where(x => x.Meetup.StartDate > DateTime.Now).ToList();

            if (nextRegistrations.Any() == false)
            {
                model.NextRegistrations = "Tu n'as aucune rencontre de prévue !";
            }
            else
            {
                model.NextRegistrations = "Tu es pré-inscrit-e à : <ul> ";
                List <string> texts = new List <string>();
                foreach (var reg in regs)
                {
                    string tmp = $"<li>{reg.Meetup.Title} (qui commence le {reg.Meetup.StartDate:dd MMMM yyyy}) : ";
                    if (reg.RegistrationStatus == ERegistrationStatus.Preregistration)
                    {
                        tmp += $"ton code d'enregistrement sera envoyé à {model.CurrentUser.Email}";
                    }
                    else
                    {
                        tmp += $"ton code d'enregistrement est {reg.RegistrationCode} pour {reg.NumberOfAdults} adultes, {reg.NumberOfChildren} dans {reg.AccomodationId}";
                    }
                    texts.Add(tmp + "</li>");
                }

                model.NextRegistrations += Environment.NewLine + String.Join("", texts) + Environment.NewLine + "</ul>";
            }
            List <Meetup> meetups = Domain.GetNextMeetups(DateTime.Now.Date, true);

            foreach (Meetup m in meetups)
            {
                var vm = new NextMeetupView(m);
                if (!regs.Any(x => x.MeetupId == vm.MeetupId))
                {
                    model.NextMeetups.Add(vm);
                }
            }
            return(model);
        }
Exemplo n.º 12
0
 public ActionResult MyAccount()
 {
     try {
         MyAccountModel model = new MyAccountModel();
         model.customer           = restaurantBAL.FindCustomer((int)Session["userId"]);
         model.activeBookings     = restaurantBAL.GetActiveBookingsOfACustomer((int)Session["userId"]);
         model.orderPlacedBooking = restaurantBAL.GetOrderPlacedBookingsOfACustomer((int)Session["userId"]);
         model.transactions       = restaurantBAL.GetTransactionOfCustomer((int)Session["userId"]);
         model.wallet             = restaurantBAL.FindWallet((int)Session["walletId"]);
         return(View(model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Index", "Error", ex));
     }
 }
Exemplo n.º 13
0
        public ActionResult UploadProfile(MyAccountModel model)
        {
            try
            {
                HttpPostedFileBase fileBaseUpload = null;
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    fileBaseUpload = Request.Files[i];
                }

                return(Json(new { model = new MyAccountModel().UploadProfile(fileBaseUpload, model) }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception Ex)
            {
                return(Json(new { model = Ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// This action returns view model for My Accounts view
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            try
            {
                if (SessionManagement.UserInfo != null)
                {
                    //LoginInformation loginInfo = (LoginInformation)System.Web.HttpContext.Current.Session["UserInfo"];
                    LoginInformation loginInfo = SessionManagement.UserInfo;
                    var      organizationID    = (int)SessionManagement.OrganizationID;
                    string[] currencyIds       = clientAccBo.GetDifferentCurrencyAccountOfUser(loginInfo.LogAccountType, loginInfo.UserID).TrimEnd('/').Split('/');

                    ViewData["AccountCurrency"] = new SelectList(accountCurrencyBO.GetSelectedCurrency(Constants.K_BROKER_LIVE, organizationID), "PK_AccountCurrencyID", "L_CurrencyValue.CurrencyValue");
                    ViewData["AccountCode"]     = new SelectList(accountCodeBO.GetSelectedAccount(Constants.K_BROKER_LIVE), "PK_AccountID", "AccountName");
                    ViewData["TradingPlatform"] = new SelectList(tradingPlatformBO.GetSelectedPlatform(Constants.K_BROKER_LIVE, organizationID), "PK_TradingPlatformID", "L_TradingPlatformValues.TradingValue");

                    var currModel = new MyAccountModel();
                    currModel.CurrencyAccountDetails = new List <MyAccountCurrencyModel>();

                    foreach (var curr in currencyIds)
                    {
                        var model             = new MyAccountCurrencyModel();
                        var landingAccDetails = clientAccBo.GetLandingAccountForCurrencyOfUser(loginInfo.LogAccountType, loginInfo.UserID, Convert.ToInt32(curr));
                        model.CurrencyID     = curr;
                        model.CurrencyName   = lCurrValueBO.GetCurrencySymbolFromID(Convert.ToInt32(curr));
                        model.CurrencyImage  = lCurrValueBO.GetCurrencyImageClass(Convert.ToInt32(curr));
                        model.LandingAccount = landingAccDetails.LandingAccount;
                        model.LAccBalance    = Utility.FormatCurrencyValue((decimal)landingAccDetails.CurrentBalance, "");
                        currModel.CurrencyAccountDetails.Add(model);
                    }

                    return(View(currModel));
                }
                else
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
            catch (Exception ex)
            {
                CurrentDeskLog.Error(ex.Message, ex);
                return(View("ErrorMessage"));
            }
        }
Exemplo n.º 15
0
        public async Task <ActionResult> MyAccount(ToastModel tm = null)
        {
            ViewBag.Fullname = await _user.GetUserFullName(User.Identity.Name);

            if (!string.IsNullOrEmpty(tm.Message))
            {
                ViewBag.tm = tm;
            }
            MyAccountModel myAccountModel = new MyAccountModel();

            myAccountModel.userFamilyMember = await _user.GetUserFamilyMemberData(User.UserId);

            myAccountModel.familyMemberModel.relationships = await _common.GetRelationshipData();

            myAccountModel.familyMemberModel.grades = await _common.GetGradeData();

            myAccountModel.familyMemberModel.genders = await _common.GetGenderData();

            myAccountModel.IsIndividual = await _account.GetIsIndividual(User.UserId);

            ViewBag.CountryList = await _common.GetCountryData();

            DateTime todaysDate = DateTime.Now.Date;
            int      day        = todaysDate.Day;
            int      month      = todaysDate.Month;
            int      year       = todaysDate.Year;

            if (month >= 6)
            {
                myAccountModel.familyMemberModel.Year = year;
            }
            else if (month < 6)
            {
                myAccountModel.familyMemberModel.Year = year - 1;
            }

            return(View("MyAccount", myAccountModel));
        }
Exemplo n.º 16
0
 void UpdateAccount(MyAccountModel myAccount)
 {
     Me.Account = myAccount.Account;
 }
        public ActionResult MyAccount(int?categoryID, int?pageNumber)
        {
            Logs();
            MyAccountModel myAccountModel = new MyAccountModel();
            TAC_User       model          = new TAC_User();

            if (Session["User"] != null)
            {
                model = (TAC_User)Session["User"];
            }
            else
            {
                ModelState.AddModelError("User", "Please Login to continue");
                return(View());
            }

            int totalPageCount = 0;

            myAccountModel.nextButton = 2;
            myAccountModel.prevButton = 1;

            ViewBag.CategoryId = categoryID;
            int pageSize       = 3;
            var lstClassifieds = new List <MyAccountClassifieds>();
            int pagecount      = 0;

            if (pageNumber == null || pageNumber == 1)
            {
                pageNumber = 1;
                myAccountModel.nextButton = 2; myAccountModel.prevButton = 1;
            }
            if (categoryID == null)
            {
                lstClassifieds = GetMyAccountClassifiedFromPosts(ClassifiedApi.GetAllPosts().Where(x => x.CreatedBy.ToString().ToLower() == model.UserId.ToString().ToLower()).ToList()).OrderBy(x => x.PostedDate).Skip(((int)pageNumber - 1) * pageSize).Take((int)pageSize).ToList();
                pagecount      = (int)Math.Ceiling((decimal)ClassifiedApi.GetAllPosts().Where(x => x.CreatedBy.ToString().ToLower() == model.UserId.ToString().ToLower()).ToList().Count / (decimal)pageSize);
            }
            else
            {
                lstClassifieds = GetMyAccountClassifiedFromPosts(ClassifiedApi.GetAllPosts().Where(x => x.CreatedBy.ToString().ToLower() == model.UserId.ToString().ToLower()).ToList()).Where(x => x.CategoryId == categoryID).OrderBy(x => x.PostedDate).Skip(((int)pageNumber - 1) * pageSize).Take((int)pageSize).ToList();
                pagecount      = (int)Math.Ceiling((decimal)ClassifiedApi.GetAllPosts().Where(x => x.CreatedBy.ToString().ToLower() == model.UserId.ToString().ToLower()).ToList().Where(x => x.CategoryId == categoryID).ToList().Count / (decimal)pageSize);
            }
            //if (lstClassifieds.Count % 3 == 0)
            //{
            //    totalPageCount = lstClassifieds.Count / 3;
            //}
            //else
            //{
            //    totalPageCount = (lstClassifieds.Count / 3) + 1;
            //}

            if (pageNumber == pagecount)
            {
                myAccountModel.nextButton = pagecount;
                if (pagecount == 1)
                {
                    myAccountModel.prevButton = 1;
                }
                else
                {
                    myAccountModel.prevButton = Convert.ToInt32(pageNumber) - 1;
                }
            }
            else
            {
                myAccountModel.nextButton = Convert.ToInt32(pageNumber) + 1;
                if (pageNumber == 1)
                {
                    myAccountModel.prevButton = Convert.ToInt32(pageNumber);
                }
                else
                {
                    myAccountModel.prevButton = Convert.ToInt32(pageNumber) - 1;
                }
            }


            myAccountModel.myAccountClassifieds = lstClassifieds;
            myAccountModel.pageCount            = pagecount;
            myAccountModel.lstCategory          = ClassifiedApi.GetAllCategory();
            return(View(myAccountModel));
        }