Beispiel #1
0
        private static Invitation SeedDpInvitation(IPOContext dbContext, string plant)
        {
            var mcPkg = new McPkg(plant, KnownTestData.ProjectName, KnownTestData.CommPkgNo,
                                  KnownTestData.McPkgNo, "Description", KnownTestData.System);
            var invitationRepository = new InvitationRepository(dbContext);
            var dpInvitation         = new Invitation(
                plant,
                KnownTestData.ProjectName,
                $"{KnownTestData.InvitationTitle} DP",
                KnownTestData.InvitationDescription,
                DisciplineType.DP,
                new DateTime(2020, 9, 1, 10, 0, 0, DateTimeKind.Utc),
                new DateTime(2020, 9, 1, 11, 0, 0, DateTimeKind.Utc),
                null,
                new List <McPkg> {
                mcPkg
            },
                null)
            {
                MeetingId = KnownTestData.MeetingId
            };

            invitationRepository.Add(dpInvitation);
            dbContext.SaveChangesAsync().Wait();

            return(dpInvitation);
        }
Beispiel #2
0
        private static Invitation SeedMdpInvitation(IPOContext dbContext, string plant)
        {
            var commPkg = new CommPkg(plant, KnownTestData.ProjectName, KnownTestData.CommPkgNo, "Description", "OK",
                                      "1|2");
            var invitationRepository = new InvitationRepository(dbContext);
            var seedMdpInvitation    = new Invitation(
                plant,
                KnownTestData.ProjectName,
                $"{KnownTestData.InvitationTitle} MDP",
                KnownTestData.InvitationDescription,
                DisciplineType.MDP,
                new DateTime(2020, 9, 1, 10, 0, 0, DateTimeKind.Utc),
                new DateTime(2020, 9, 1, 11, 0, 0, DateTimeKind.Utc),
                null,
                null,
                new List <CommPkg> {
                commPkg
            })
            {
                MeetingId = KnownTestData.MeetingId
            };

            invitationRepository.Add(seedMdpInvitation);
            dbContext.SaveChangesAsync().Wait();

            return(seedMdpInvitation);
        }
Beispiel #3
0
        public void DbAddTest()
        {
            var options = new DbContextOptionsBuilder <InvitationsDbContext>()
                          .UseInMemoryDatabase(databaseName: "DbAddTestDatabase")
                          .Options;

            using (var context = new InvitationsDbContext(options))
            {
                context.Invitations.Add(new Invitation {
                    Phone = "79998887766", Author = 4
                });
                context.Invitations.Add(new Invitation {
                    Phone = "79998887765", Author = 4
                });
                context.Invitations.Add(new Invitation {
                    Phone = "79998887764", Author = 4
                });
                context.SaveChanges();
            }

            using (var context = new InvitationsDbContext(options))
            {
                var invitationRepository = new InvitationRepository(context);

                var invitation = new Invitation {
                    Phone = "78888888888", Author = 4
                };

                Invitation addedInvitation = invitationRepository.Add(invitation);

                Assert.Equal(4, context.Invitations.Count());
            }
        }
Beispiel #4
0
        public ActionResult AddNewInvitation(MeetingViewModel model)
        {
            Invitation newInvitation = new Invitation();

            newInvitation.Meeting  = MeetingRepository.Get(model.MeetingId);
            newInvitation.Notified = false;
            newInvitation.User     = UserRepository.Get(model.UserId);
            newInvitation.Status   = 0;
            InvitationRepository.Add(newInvitation);
            return(RedirectToAction("Profile", new { id = model.MeetingId }));
        }
        public void Add_Invitation_ShouldCallAddForInvitation()
        {
            _dut.Add(_dpInviation);

            _dbInvitationSetMock.Verify(x => x.Add(_dpInviation), Times.Once);
        }
        public int AddInvitationInDB(string fname, string lname, string email)
        {
            int res = 0;

            try
            {
                if (Session["LoggedUser"] != null)
                {
                    SocioBoard.Domain.User user = (User)Session["LoggedUser"];


                    MailHelper mailhelper   = new MailHelper();
                    string     mailpath     = HttpContext.Current.Server.MapPath("~/Layouts/Mails/FriendInvitation.htm");
                    string     html         = File.ReadAllText(mailpath);
                    string     fromemail    = ConfigurationManager.AppSettings["fromemail"];
                    string     usernameSend = ConfigurationManager.AppSettings["username"];
                    string     host         = ConfigurationManager.AppSettings["host"];
                    string     port         = ConfigurationManager.AppSettings["port"];
                    string     pass         = ConfigurationManager.AppSettings["password"];
                    string     website      = ConfigurationManager.AppSettings["MailSenderDomain"];



                    string urllogin = website + "Default.aspx";
                    //string registrationurl = "http://dev.socioboard.com/Registration.aspx?refid=256f9c69-6b6a-4409-a309-b1f6d1f8e43b";

                    string registrationurl = website + "Registration.aspx?refid=" + user.Id;
                    html = html.Replace("%replink%", registrationurl);
                    string Body = mailhelper.InvitationMailByCloudSponge(html, fname + " " + lname, user.EmailId, "", urllogin, registrationurl);

                    string Subject = "You have been invited to Socioboard by " + user.EmailId;

                    InviteMember(fname, lname, email);
                    #region Add Records in Invitation Table
                    Invitation           objInvitation           = new Invitation();
                    InvitationRepository objInvitationRepository = new InvitationRepository();

                    objInvitation.Id                = Guid.NewGuid();
                    objInvitation.InvitationBody    = Body;
                    objInvitation.Subject           = Subject;
                    objInvitation.FriendEmail       = email;
                    objInvitation.SenderEmail       = user.EmailId;  //"*****@*****.**";
                    objInvitation.FriendName        = fname + " " + lname;
                    objInvitation.SenderName        = user.UserName; //"Abhaykumar";
                    objInvitation.Status            = "0";
                    objInvitation.LastEmailSendDate = DateTime.Now;

                    res = objInvitationRepository.Add(objInvitation);
                    #endregion
                }
                //else
                //{
                //    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Plaese login for this activity!');", true);

                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return(res);
        }