示例#1
0
        private void SetupInitialSettings()
        {
            using (WfpictContext ctx = new WfpictContext())
            {
                var userManager = new UserManager <WfpUser>(new UserStore <WfpUser>(ctx));
                if (userManager.FindByName("kamran.qadir") != null)
                {
                    return;
                }

                var adminUser = new WfpUser
                {
                    Id        = Guid.NewGuid().ToString(),
                    CreatedAt = DateTime.Now,
                    UserName  = "******",
                    Email     = "*****@*****.**",
                    Status    = (int)UserStatus.Active,
                    UserType  = (int)UserType.Admin
                };
                var result = userManager.CreateAsync(adminUser, "P@kistan1");
                if (result.Result == IdentityResult.Success)
                {
                    //Success
                }
            }
        }
示例#2
0
        public static void SendOrderEmailToClient(Campaign campaign, WfpUser loggedInUser)
        {
            string subject = $"Order # {campaign.OrderNumber}, Campaign Date {campaign.BroadcastDate?.ToString("d")}, QTY {campaign.Quantity} , Date Submitted {campaign.CreatedAt:d}";

            string body = $@"<br/><p>Dear {loggedInUser.UserName.ToCapitalLetterString().ToCapitalized()}</p><br/>We have recevied your order.<br/><br/>
                        <table border=""2"">
                        <tr><th align=""left"">Order #:</th><td>{campaign.OrderNumber}</td></tr>
                        <tr><th align=""left"">Status:</th><td>{(CampaignStatus) campaign.Status}</td></tr>
                        <tr><th align=""left"">Username:</th><td>{loggedInUser.UserName}</td></tr>
                        <tr><th align=""left"">User Email:</th><td>{loggedInUser.Email}</td></tr>
                        <tr><th align=""left"">Campaign Name:</th><td>{campaign.CampaignName}</td></tr>
                        <tr><th align=""left"">Broadcast Date:</th><td>{campaign.BroadcastDate.Value.ToString("d")}</td></tr>
                        <tr><th align=""left"">Rebroadcast:</th><td>{(campaign.ReBroadCast? "Yes": "No")}</td></tr>
                        <tr><th align=""left"">Rebroadcast Date:</th><td>{(campaign.ReBroadcastDate.HasValue? campaign.ReBroadcastDate.ToString(): "")}</td></tr>
                        <tr><th align=""left"">From Line:</th><td>{campaign.FromLine}</td></tr>
                        <tr><th align=""left"">Subject Line:</th><td>{campaign.SubjectLine}</td></tr>
                        <tr><th align=""left"">Personalization:</th><td>{(campaign.IsPersonalization? "Yes": "No")}</td></tr>
                        <tr><th align=""left"">Matchback:</th><td>{(campaign.IsMatchback ? "Yes" : "No")}</td></tr>
                        <tr><th align=""left"">Suppression:</th><td>{(campaign.IsSuppression? "Yes": "No")}</td></tr>
                        <tr><th align=""left"">White Label:</th><td>{campaign.WhiteLabel}</td></tr>
                        <tr><th align=""left"">HTML File:</th><td>{campaign.Assets.CreativeUrl}</td></tr>
                        <tr><th align=""left"">Test Seed:</th><td>{campaign.Assets.TestSeedUrl}</td></tr>  
                        <tr><th align=""left"">Live Seed:</th><td>{campaign.Assets.LiveSeedUrl}</td></tr>   
                        <tr><th align=""left"">Special Instructions:</th><td>{campaign.SpecialInstructions}</td></tr>                                     
                        <tr><th align=""left"">Start Time:</th><td>{campaign.CreatedAt.AddMinutes(2).AddSeconds(30)}</td></tr>
                        <tr><th align=""left"">IP:</th><td>{campaign.IP}</td></tr>
                        <tr><th align=""left"">Browser:</th><td>{campaign.Browser}</td></tr>
                        <tr><th align=""left"">OS:</th><td>{campaign.OS}</td></tr>
                        <tr><th align=""left"">Referrer:</th><td>{campaign.Referrer}</td></tr>
                        </table></p> <p>We will soon contact you and update you about your order.</p> {Footer}";

            SendEmail(loggedInUser.Email, subject, body);
        }
示例#3
0
        public static void SendOrderEmailToAds(Campaign campaign, WfpUser loggedInUser, string to, string ccEmails)
        {
            string subject = $"New Order Received, Order # {campaign.OrderNumber}, Campaign Date {campaign.BroadcastDate?.ToString("d")}, QTY {campaign.Quantity} , Date Submitted {campaign.CreatedAt:d}";

            string body = $@"<br/><p>Dear team, <br/><br/> New Order has been entered into system. Order details is as below;</p>
                        <table border=""2"">
                        <tr><th align=""left"">Order #:</th><td>{campaign.OrderNumber}</td></tr>
                        <tr><th align=""left"">Status:</th><td>{(CampaignStatus)campaign.Status}</td></tr>
                        <tr><th align=""left"">Username:</th><td>{loggedInUser.UserName.ToCapitalLetterString().ToCapitalized()}</td></tr>
                        <tr><th align=""left"">User Email:</th><td>{loggedInUser.Email}</td></tr>
                        <tr><th align=""left"">Campaign Name:</th><td>{campaign.CampaignName}</td></tr>
                        <tr><th align=""left"">Broadcast Date:</th><td>{campaign.BroadcastDate.Value.ToString("d")}</td></tr>
                        <tr><th align=""left"">Rebroadcast:</th><td>{(campaign.ReBroadCast ? "Yes" : "No")}</td></tr>
                        <tr><th align=""left"">Rebroadcast Date:</th><td>{(campaign.ReBroadcastDate.HasValue ? campaign.ReBroadcastDate.ToString() : "")}</td></tr>
                        <tr><th align=""left"">From Line:</th><td>{campaign.FromLine}</td></tr>
                        <tr><th align=""left"">Subject Line:</th><td>{campaign.SubjectLine}</td></tr>
                        <tr><th align=""left"">Personalization:</th><td>{(campaign.IsPersonalization ? "Yes" : "No")}</td></tr>
                        <tr><th align=""left"">Matchback:</th><td>{(campaign.IsMatchback ? "Yes" : "No")}</td></tr>
                        <tr><th align=""left"">Suppression:</th><td>{(campaign.IsSuppression ? "Yes" : "No")}</td></tr>
                        <tr><th align=""left"">White Label:</th><td>{campaign.WhiteLabel}</td></tr>
                        <tr><th align=""left"">HTML File:</th><td>{campaign.Assets.CreativeUrl}</td></tr>
                        <tr><th align=""left"">Test Seed:</th><td>{campaign.Assets.TestSeedUrl}</td></tr>  
                        <tr><th align=""left"">Live Seed:</th><td>{campaign.Assets.LiveSeedUrl}</td></tr>   
                        <tr><th align=""left"">Special Instructions:</th><td>{campaign.SpecialInstructions}</td></tr>                                     
                        <tr><th align=""left"">Start Time:</th><td>{campaign.CreatedAt.AddMinutes(2).AddSeconds(30)}</td></tr>
                        <tr><th align=""left"">IP:</th><td>{campaign.IP}</td></tr>
                        <tr><th align=""left"">Browser:</th><td>{campaign.Browser}</td></tr>
                        <tr><th align=""left"">OS:</th><td>{campaign.OS}</td></tr>
                        <tr><th align=""left"">Referrer:</th><td>{campaign.Referrer}</td></tr>
                        </table></p> {Footer}";

            SendEmail(to, subject, body, ccEmails);
        }
示例#4
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                //var user = new WFPUser { UserName = model.UserName, Email = model.Email };
                //var UserManager = new UserManager<Data.Entities.WFPUser>(new UserStore<Data.Entities.WFPUser>(context));

                var appUser = new WfpUser
                {
                    Id               = Guid.NewGuid().ToString(),
                    CreatedAt        = DateTime.Now,
                    CustomerId       = Guid.Parse(model.WhiteLabel),
                    UserName         = model.UserName,
                    Email            = model.Email,
                    Status           = (int)UserStatus.Active,
                    UserType         = model.IsAdminUser ? (int)UserType.Admin: (int)UserType.User,
                    IsUsesApi        = model.IsUsesApi,
                    IsTestsCreatives = model.IsTestsCreatives
                };
                var result = UserManager.CreateAsync(appUser, model.Password);
                if (result.Result == IdentityResult.Success)
                {
                    return(RedirectToAction("Users", "Company"));
                }
                AddErrors(result.Result);
            }
            ViewBag.WhiteLabel = new SelectList(CustomersList, "Value", "Text", model.WhiteLabel);
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#5
0
        protected override void Seed(WfpictContext context)
        {
            // Look for any students.
            if (context.Users.Any())
            {
                return;   // DB has been seeded
            }

            var userManager = new UserManager <WfpUser>(new UserStore <WfpUser>(context));

            var appUser = new WfpUser
            {
                Id        = Guid.NewGuid().ToString(),
                CreatedAt = DateTime.Now,
                UserName  = "******",
                Email     = "*****@*****.**",
                Status    = (int)UserStatus.Active,
                UserType  = (int)UserType.Admin
            };
            var result = userManager.CreateAsync(appUser, "P@kistan1");

            if (result.Result == IdentityResult.Success)
            {
                //Success
            }

            appUser = new WfpUser
            {
                Id        = Guid.NewGuid().ToString(),
                CreatedAt = DateTime.Now,
                UserName  = "******",
                Email     = "*****@*****.**",
                Status    = (int)UserStatus.Active,
                UserType  = (int)UserType.User
            };
            result = userManager.CreateAsync(appUser, "P@kistan1");
            if (result.Result == IdentityResult.Success)
            {
                //Success
            }

            var compaignId = Guid.NewGuid();
            var asset      = new CampaignAsset()
            {
                Id              = Guid.NewGuid(),
                CreatedAt       = DateTime.Now,
                CampaignId      = compaignId,
                ZipCodeFile     = "2500/2500zip.csv",
                CreativeFiles   = "2500/2500_html.zip",
                TestSeedFile    = "2500/2500test.csv",
                LiveSeedFile    = "2500/2500live.csv",
                SuppressionFile = "2500/2500supp.csv",
            };
            var campaigns = new Campaign[]
            {
                new Campaign
                {
                    Id        = compaignId,
                    CreatedAt = DateTime.Now,
                    CreatedBy = "josh.silver",

                    Status              = (int)CampaignStatus.OrderRecevied,
                    CampaignName        = "Car Dealership 123",
                    BroadcastDate       = DateTime.Now.AddDays(5),
                    RepresentativeName  = "Josh Silver",
                    RepresentativeEmail = "*****@*****.**",
                    ReBroadCast         = true,
                    ReBroadcastDate     = DateTime.Now.AddMonths(1),
                    Price               = 10000,
                    TestingUrgency      = (int)TestingUrgency.One_Three_Hour,
                    GeoDetails          = "1 km around 5432",
                    Demographics        = "NY",
                    Quantity            = 100000,
                    FromLine            = "Testing",
                    SubjectLine         = "This is testing",
                    IsPersonalization   = true,
                    IsMatchback         = false,
                    IsSuppression       = true,
                    WhiteLabel          = "reporting.consumermkts.com",
                    OptOut              = "MM",
                    SpecialInstructions = "Hello, this is special instructions, please do it quickly",
                    OrderNumber         = "2500",
                    IsOpenPixel         = true,
                    OpenPixelUrl        = "http://www.opened.com/pix101",
                    DataFileQuantity    = 1800,
                    Assets              = asset
                }
            };

            foreach (var campaign in campaigns)
            {
                context.Campaigns.Add(campaign);
            }
            context.SaveChanges();

            var vendor = new Vendor()
            {
                Id          = Guid.NewGuid(),
                CreatedAt   = DateTime.Now,
                Email       = "*****@*****.**",
                CcEmails    = @"[email protected],[email protected],[email protected],[email protected],[email protected]",
                Name        = "Test Vendor",
                CompanyName = "Vendor Company"
            };

            context.Vendors.Add(vendor);
            context.SaveChanges();
        }