示例#1
0
        public ActionResult Invite(string Email)
        {
            Invitee         newInvitee = new Invitee();
            var             apiKey     = ConfigurationManager.AppSettings["SendGridAPIKey"];
            var             from       = ConfigurationManager.AppSettings["ContactEmail"];
            ApplicationUser currUser   = db.Users.Find(User.Identity.GetUserId());
            SendGridMessage myMessage  = new SendGridMessage();

            myMessage.AddTo(Email);
            myMessage.From    = new System.Net.Mail.MailAddress("*****@*****.**");
            myMessage.Subject = "An Invitation From Saffron1: Budgeting and Financial Management";


            newInvitee.Email       = Email;
            newInvitee.BeenUsed    = false;
            newInvitee.HouseholdId = (int)currUser.HouseholdId;
            if (currUser.HouseholdId.HasValue)
            {
                newInvitee.HouseholdId = (int)currUser.HouseholdId;
            }

            if (ModelState.IsValid)
            {
                db.Invitee.Add(newInvitee);
                db.SaveChanges();
                int Id = newInvitee.Id;
                myMessage.Html = "You have been invited to join " + currUser.DisplayName + "'s household.  Click this link to Register and Join: <a href = \"http://arowan-budgeter.azurewebsites.net/Account/ExternalRegister/ " + Id + "\"> Join the Household </a>";
                var transportWeb = new Web(ConfigurationManager.AppSettings["SendGridAPIKey"]);
                transportWeb.DeliverAsync(myMessage);
                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("Index", "Home"));
        }
示例#2
0
        public ActionResult DeleteInvitee(int eventId, int inviteesId)
        {
            Event selectedEvent = Event.Find(eventId);

            selectedEvent.DeleteInvitee(Invitee.Find(inviteesId));
            return(RedirectToAction("Show"));
        }
        private void LoadData()
        {
            Invitee inv = invRepos.GetDetail(physicianID);

            if (inv != null)
            {
                this.txtFirstName.Text  = inv.FirstName;
                this.txtLastName.Text   = inv.LastName;
                this.txtClinic.Text     = inv.PrimaryWorkplace;
                this.txtAddress.Text    = inv.Address;
                this.txtCity.Text       = inv.City;
                this.txtPostalCode.Text = inv.PostalCode;
                this.txtPhone.Text      = inv.Phone;
                this.txtFax.Text        = inv.Fax;
                this.txtEmail.Text      = inv.OptInEmail;
                this.txtComments.Text   = inv.Comments;
                this.txtUnique.Text     = inv.RegistrationCode;

                //squaredThree.Checked = inv.OptInEmail;

                if (inv.Province.ID.HasValue)
                {
                    ddProvince.SelectedValue = inv.Province.ID.Value.ToString();
                }
                else
                {
                    ddProvince.SelectedValue = Constants.NOID.ToString();
                }
            }
        }
示例#4
0
        public void GetAll_ReturnsAllInviteeObjects_InviteeList()
        {
            //Arrange
            string  inviteeName1         = "Jane Doe";
            string  inviteeEmailAddress1 = "*****@*****.**";
            Invitee newInvitee1          = new Invitee(inviteeName1, inviteeEmailAddress1);

            newInvitee1.Save();

            string  inviteeName2         = "John Smith";
            string  inviteeEmailAddress2 = "*****@*****.**";
            Invitee newInvitee2          = new Invitee(inviteeName2, inviteeEmailAddress2);

            newInvitee2.Save();

            List <Invitee> newList = new List <Invitee> {
                newInvitee1, newInvitee2
            };

            //Act
            List <Invitee> result = Invitee.GetAll();

            //Assert
            CollectionAssert.AreEqual(newList, result);
        }
        public ActionResult DeleteEvent(int inviteeId, int eventId)
        {
            Invitee invitee = Invitee.Find(inviteeId);

            invitee.DeleteEvent(Event.Find(eventId));
            return(RedirectToAction("Show"));
        }
        public ActionResult Delete(int inviteeId)
        {
            Invitee invitee = Invitee.Find(inviteeId);

            invitee.Delete();
            return(RedirectToAction("Index"));
        }
示例#7
0
        public void Edit_UpdatesInviteeToDatabase()
        {
            //Arrange
            string  inviteeName         = "Jane Doe";
            string  inviteeEmailAddress = "*****@*****.**";
            Invitee newInvitee          = new Invitee(inviteeName, inviteeEmailAddress);

            newInvitee.Save();

            //Act
            Invitee foundInvitee           = Invitee.Find(newInvitee.GetId());
            string  newInviteeName         = "John Smith";
            string  newInviteeEmailAddress = "*****@*****.**";

            foundInvitee.Edit(newInviteeName, newInviteeEmailAddress);
            Invitee updatedInvitee = Invitee.Find(newInvitee.GetId());

            List <Invitee> result   = Invitee.GetAll();
            List <Invitee> testList = new List <Invitee> {
                updatedInvitee
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
示例#8
0
        public void Update_UpdatesInstanceOfInvitee_True()
        {
            _invitee.Save();
            ActionResult updatePost = _controller.Update(_invitee.GetId(), "NewName", "*****@*****.**");

            Assert.AreEqual("NewName", Invitee.Find(_invitee.GetId()).GetInviteeName());
        }
示例#9
0
        public void Delete_DeletesEventInviteeFromDatabase()
        {
            //Arrange
            string   eventName     = "July 4th BBQ";
            DateTime eventDate     = new DateTime(2019, 07, 04);
            string   eventLocation = "Capitol Hill";
            int      menusId       = 1;
            Event    newEvent      = new Event(eventName, eventDate, eventLocation, menusId);

            newEvent.Save();

            string  inviteeName         = "Jane Doe";
            string  inviteeEmailAddress = "*****@*****.**";
            Invitee newInvitee          = new Invitee(inviteeName, inviteeEmailAddress);

            newInvitee.Save();

            //Act
            Event   foundEvent   = Event.Find(newEvent.GetId());
            Invitee foundInvitee = Invitee.Find(newInvitee.GetId());

            foundInvitee.AddEvent(foundEvent);

            List <Event> result = foundInvitee.GetEvents();

            foundInvitee.DeleteEvent(foundEvent);
            List <Event> testList = foundInvitee.GetEvents();

            //Assert
            CollectionAssert.AreNotEqual(testList, result);
        }
示例#10
0
        public async Task <IActionResult> Invite([Bind("Email,IsAdmin")] Invitee invitee)
        {
            if (ModelState.IsValid)
            {
                var http = await _rest.GetClientAsync();

                var role       = invitee.IsAdmin ? "admin" : "member";
                var replyUrl   = $"{Request.Scheme}://{Request.Host}/members/redeem";
                var invitation = new { inviteEmail = invitee.Email, postRedeemUrl = replyUrl, additionalClaims = new Dictionary <string, string>()
                                       {
                                           { "role", role }
                                       } };
                var resp = await http.PostAsync($"{RESTService.Url}/tenant/oauth2/invite",
                                                new StringContent(
                                                    JsonConvert.SerializeObject(invitation),
                                                    System.Text.Encoding.UTF8,
                                                    "application/json"));

                if (resp.IsSuccessStatusCode)
                {
                    invitee.InvitationUrl = await resp.Content.ReadAsStringAsync();
                }
                return(View(invitee));
                //return RedirectToAction(nameof(Invite));
            }
            return(View(new Invitee()));
        }
示例#11
0
        public ActionResult Edit(int?id)
        {
            List <SelectListItem> items = new List <SelectListItem>();

            items.Add(new SelectListItem {
                Text = "Accept", Value = "Accepted"
            });
            items.Add(new SelectListItem {
                Text = "Not sure", Value = "Pending"
            });
            items.Add(new SelectListItem {
                Text = "Decline", Value = "Declined"
            });
            ViewBag.Status = items;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Invitee invitee = db.Invitees.Find(id);

            if (invitee.Email != UserManager.GetEmail(User.Identity.GetUserId()))
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (invitee == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.InvitationId = new SelectList("accepted", "pending", "declined");
            return(View(invitee));
        }
        public ActionResult Create(string inviteeName, string inviteeEmailAddress)
        {
            Invitee newInvitee = new Invitee(inviteeName, inviteeEmailAddress);

            newInvitee.Save();
            return(RedirectToAction("Index"));
        }
        public ActionResult Update(int inviteeId, string inviteeName, string inviteeEmailAddress)
        {
            Invitee invitee = Invitee.Find(inviteeId);

            invitee.Edit(inviteeName, inviteeEmailAddress);
            return(RedirectToAction("Index"));
        }
        public void Save_SavesEventInviteeToDatabase_InviteeList()
        {
            //Arrange
            string   eventName     = "July 4th BBQ";
            DateTime eventDate     = new DateTime(2019, 04, 04);
            string   eventLocation = "Capitol Hill";
            int      menusId       = 1;
            Event    newEvent      = new Event(eventName, eventDate, eventLocation, menusId);

            newEvent.Save();

            string  inviteeName         = "Jane Doe";
            string  inviteeEmailAddress = "*****@*****.**";
            Invitee newInvitee          = new Invitee(inviteeName, inviteeEmailAddress);

            newInvitee.Save();

            //Act
            Event   foundEvent   = Event.Find(newEvent.GetId());
            Invitee foundInvitee = Invitee.Find(newInvitee.GetId());

            foundEvent.AddInvitee(foundInvitee);

            List <Invitee> result   = newEvent.GetInvitees();
            List <Invitee> testList = new List <Invitee> {
                foundInvitee
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
        public async Task <IActionResult> Edit(int id, [Bind("InviteeId,Name")] Invitee invitee)
        {
            if (id != invitee.InviteeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invitee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InviteeExists(invitee.InviteeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(invitee));
        }
示例#16
0
        private void LoadData()
        {
            Invitee inv = invRepos.GetInviteeData(physicianID);

            if (inv != null)
            {
                this.txtInvRank.Text = inv.InvitationTier;
                txtFirstName.Text    = inv.FirstName;
                txtLastName.Text     = inv.LastName;
                this.txtAddress.Text = inv.Address;
                this.txtClinic.Text  = inv.Clinic;
                this.txtCity.Text    = inv.City;

                if (inv.Province.ID.HasValue)
                {
                    ddProvince.SelectedValue = inv.Province.ID.Value.ToString();
                }
                else
                {
                    ddProvince.SelectedValue = Constants.NOID.ToString();
                }

                //this.ddProvince.SelectedValue = inv.Province.ID.Value.ToString();
                this.txtPostal.Text    = inv.PostalCode;
                this.txtTelephone.Text = inv.Phone;
                // this.txtCellPhone.Text = inv.CellPhone;
                this.txtFax.Text      = inv.Fax;
                this.txtEmail.Text    = inv.Email;
                this.txtComments.Text = inv.Comments;
                this.txtRegCode.Text  = inv.RegistrationCode;
                this.txtUserName.Text = inv.UserName;

                ViewState[Constants.LASTNAME] = inv.LastName;
            }
        }
示例#17
0
        public async Task <IActionResult> fromCsv(IList <IFormFile> files)
        {
            using (System.IO.StreamWriter outputFile = new System.IO.StreamWriter(@"csv\inv_tmp.csv"))
            {
                using (var reader = new System.IO.StreamReader(files[0].OpenReadStream()))
                {
                    while (reader.Peek() >= 0)
                    {
                        outputFile.WriteLine(reader.ReadLine());
                    }
                }
            }

            Csv             csv = new Csv();
            Category        cat;
            var             result             = csv.read(@"csv\inv_tmp.csv");
            List <Category> list_of_categories = new List <Category>();

            foreach (var invitee in result)
            {
                var  firstName     = invitee.Item1;
                var  lastName      = invitee.Item2;
                int  numShouldCome = invitee.Item3;
                var  phoneNumber   = invitee.Item4;
                var  address       = invitee.Item5;
                int  numIsComing   = invitee.Item6;
                var  category      = invitee.Item7;
                bool new_cat       = true;

                cat = GetCategoryByName(category);
                Category tmpCat = new Category(category, GetEventByID(MyGlobals.GlobalEventID));
                if (cat == null)
                {
                    foreach (Category existCat in list_of_categories)
                    {
                        if ((existCat.Name == tmpCat.Name) && (existCat.Event.Id == tmpCat.Event.Id))
                        {
                            cat = existCat;
                            break;
                        }
                    }
                    if (cat == null)
                    {
                        cat = tmpCat;
                        list_of_categories.Add(cat);
                    }
                    _context.Add(cat);
                }

                //await _context.SaveChangesAsync();


                Invitee inv = new Invitee(firstName, lastName, phoneNumber, address, numIsComing, GetEventByID(MyGlobals.GlobalEventID), cat);
                _context.Add(inv);
            }
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "Invitees"));
        }
示例#18
0
        public async Task <bool> SentInvitation(Guid topicsId, InviteeSentRequest inviteeRequest, string GetUserId)
        {
            var topicOwn = await _context.Topics
                           .Where(s => s.AppUserId.Equals(GetUserId) && s.Id.Equals(topicsId)).SingleOrDefaultAsync();

            if (topicOwn == null)
            {
                return(false);
            }

            var findUser = await _userManager.Users
                           .SingleOrDefaultAsync(s => s.UserName == inviteeRequest.UserName);

            if (findUser == null)
            {
                return(false);
            }

            var inviteeExist = await _context.Invitees
                               .AnyAsync(x => x.AppUserId.Equals(findUser.Id) && x.TopicsId.Equals(topicsId));

            if (inviteeExist)
            {
                return(false);
            }

            var inviteeSent = new Invitee
            {
                Id            = Guid.NewGuid(),
                RequestStatus = false,
                RoleStatus    = inviteeRequest.RoleStatus,
                AcceptedDate  = DateTime.Now,
                AppUserId     = findUser.Id,
                TopicsId      = topicsId
            };

            _context.Invitees.Add(inviteeSent);

            var created = await _context.SaveChangesAsync();

            var User = await _userManager.Users
                       .SingleOrDefaultAsync(s => s.Id == GetUserId);

            var newNottification = new Notification()
            {
                Id                  = Guid.NewGuid(),
                AppUserId           = findUser.Id,
                CreatedTime         = DateTime.Now,
                NotificationMessage = $"#{User.UserName} Sent Collaboration on {topicOwn.Name} ",
                Url                 = topicsId,
                ReadStatus          = false
            };

            _context.Notifications.Add(newNottification);

            await _notificationService.CreateAsync(newNottification);

            return(created > 0);
        }
示例#19
0
        public ActionResult DeleteConfirmed(int id)
        {
            Invitee invitee = db.Invitees.Find(id);

            db.Invitees.Remove(invitee);
            db.SaveChanges();
            return(RedirectToAction("Index", "Invitees"));
        }
        public ActionResult ExternalRegister(int Id)
        {
            Invitee           currInvitee = db.Invitee.Find(Id);
            RegisterViewModel viewModel   = new RegisterViewModel();

            viewModel.currInvitee = currInvitee;
            return(View(viewModel));
        }
示例#21
0
            public void CreateInvite(string boardId, Invitee invite)
            {
                var filter = Builders <Board> .Filter.Eq(c => c.BId, boardId);

                var update = Builders <Board> .Update.Push(c => c.BoardInvites, invite);

                context.Boards.FindOneAndUpdate(filter, update);
            }
示例#22
0
        public void Delete_DeletesInviteeObject_True()
        {
            _invitee.Save();
            ActionResult deletePost = _controller.Delete(_invitee.GetId());

            Assert.IsInstanceOfType(deletePost, typeof(ActionResult));
            CollectionAssert.AreEqual(new List <Invitee> {
            }, Invitee.GetAll());
        }
示例#23
0
        public void runMutation()
        {
            int     randomeIndividualId = algoUtils.AlgoRandom(this.population.Length);
            int     randomeGenId        = algoUtils.AlgoRandom(this.population[randomeIndividualId].gens.Length);
            int     randomeTableId      = algoUtils.AlgoRandom(algoDb.tables.Count);
            Invitee genInvitee          = this.population[randomeIndividualId].gens[randomeGenId].invitee;

            this.population[randomeIndividualId].gens[randomeGenId] = new Gen(genInvitee, algoDb.tables[randomeTableId]);
        }
        private void LoadStep1Data()
        {
            Invitee invitee = invRepos.GetInviteeData(regCode);

            this.txtLastName.Text  = invitee.LastName;
            this.txtFirstName.Text = invitee.FirstName;
            this.txtCity.Text      = invitee.City;
            this.txtProvince.Text  = invitee.Province.Name;
        }
示例#25
0
        public void CreateInvite(string boardId, Invitee invite)
        {
            invite.InviteId = ObjectId.GenerateNewId().ToString();
            var filter = Builders <Board> .Filter.Eq(c => c.BoardId, boardId);

            var update = Builders <Board> .Update.Push(c => c.BoardInvites, invite);

            context.Boards.FindOneAndUpdate(filter, update);
        }
示例#26
0
        private void LoadData()
        {
            SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session);

            Invitee inv = invRepos.GetDetail(physicianID);

            if (inv != null)
            {
                this.txtFirstName.Text  = inv.FirstName;
                this.txtLastName.Text   = inv.LastName;
                this.txtClinic.Text     = inv.PrimaryWorkplace;
                this.txtAddress.Text    = inv.Address;
                this.txtCity.Text       = inv.City;
                this.txtPostalCode.Text = inv.PostalCode;
                this.txtPhone.Text      = inv.Phone;
                this.txtFax.Text        = inv.Fax;
                this.txtEmail.Text      = inv.OptInEmail;
                this.txtComments.Text   = inv.Comments;
                this.txtUnique.Text     = inv.RegistrationCode;

                lblFN.Text         = inv.YourFirstName;
                lblLN.Text         = inv.YourLastName;
                lblAdderEmail.Text = inv.YourEmail;

                if (inv.BITerritoryID.HasValue)
                {
                    this.txtBI.Text = inv.BITerritoryID.Value.ToString();
                }

                this.txtLilly.Text    = inv.LillyID;
                lblType.Text          = inv.PhysicianType == Enums.PhysicianType.PCP ? "PCP" : "CS";
                this.lblUserName.Text = inv.UserName;

                //squaredThree.Checked = inv.OptInEmail;

                if (inv.Province.ID.HasValue)
                {
                    ddProvince.SelectedValue = inv.Province.ID.Value.ToString();
                }
                else
                {
                    ddProvince.SelectedValue = Constants.NOID.ToString();
                }

                if (!user.IsAdmin)
                {
                    if (inv.PhysicianType == Enums.PhysicianType.PCP)
                    {
                        pnlEmail.Visible = inv.Invited;
                    }
                    else
                    {
                        pnlEmail.Visible = false;
                    }
                }
            }
        }
示例#27
0
 public void Dispose()
 {
     Event.ClearAll();
     Invitee.ClearAll();
     Menu.ClearAll();
     MenuItem.ClearAll();
     MenuItemIngredient.ClearAll();
     Store.ClearAll();
     Task.ClearAll();
 }
示例#28
0
        public bool UpdateInvite(string cardId, string inviteID, Invitee invite)
        {
            var filter = Builders <Card> .Filter.Where(n => n.CardId == cardId && n.CardInvites.Any(t => t.InviteId == inviteID));

            var updateInviteeOfCard = Builders <Card> .Update.Set(x => x.CardInvites[-1], invite);

            var updatedResult = context.Cards.UpdateOne(filter, updateInviteeOfCard);

            return(updatedResult.IsAcknowledged && updatedResult.ModifiedCount > 0);
        }
        public ActionResult Edit(int inviteeId)
        {
            Invitee      invitee = Invitee.Find(inviteeId);
            List <Event> events  = invitee.GetEvents();
            Dictionary <string, object> model = new Dictionary <string, object>();

            model.Add("invitee", invitee);
            model.Add("events", events);
            return(View(model));
        }
示例#30
0
        public void inviteeConstructor_CreatesInstanceOfInvitee_Invitee()
        {
            //Arrange, Act
            string  inviteeName         = "Jane Doe";
            string  inviteeEmailAddress = "*****@*****.**";
            Invitee newInvitee          = new Invitee(inviteeName, inviteeEmailAddress);

            //Assert
            Assert.AreEqual(typeof(Invitee), newInvitee.GetType());
        }
示例#31
0
        public static void inviteeAddContact(int taskID, int? contactID, int? userID, int? leadID)
        {
            Invitee invitee = null;

            if (taskID > 0) {
                invitee = new Invitee();
                invitee.TaskID = taskID;
                invitee.ContactID = contactID;
                invitee.UserID = userID;
                invitee.LeadID = leadID;

                using (InviteeManager repository = new InviteeManager()) {
                    repository.Save(invitee);
                }
            }
        }
示例#32
0
        public Invitee Save(Invitee invitee)
        {
            if (invitee.InviteeID == 0)
                claimRulerDBContext.Invitee.Add(invitee);

            claimRulerDBContext.SaveChanges();

            return invitee;
        }