Ejemplo n.º 1
0
        public ActionResult Index()
        {
            var data = new ViewModel();

            data.ContentPage = Models.Page.LoadOrCreatePageCode("ContactUs");
            if (data.ContentPage == null)
            {
                throw new Exception("Contact Us page not found");
            }

            var companyDetail = Models.CompanyDetail.Load(new Sql("Select Top 1 * from CompanyDetail"));

            if (companyDetail == null)
            {
                companyDetail           = new CompanyDetail();
                companyDetail.Address   = "Lorem ipsum dolor sit amet";
                companyDetail.DateAdded = DateTime.Now;
                companyDetail.Email     = "*****@*****.**";
                companyDetail.Latitude  = 41.4395;
                companyDetail.Longitude = 72.1936;
                companyDetail.Phone     = "00-0000000-00";
                companyDetail.Title     = "Lorem ipsum dolor sit amet";
                companyDetail.Save();
            }

            data.CompanyDetails = companyDetail;

            data.ContactUsTextBlock = TextBlockCache.GetRich("Contact Us Text", "");
            data.ContactDetails     = new ContactUs();
            return(View("ContactUs", data));
        }
Ejemplo n.º 2
0
        private void Save(Models.TextBlock record, bool isNew)
        {
            // add any code to update other fields/tables here
            record.DateModified = DateTime.Now;
            record.Save();
            CheckLock(record);
            lockobj.UnLockTable(record.GetTableName(), record.ID);

            TextBlockCache.Rebuild();
        }
Ejemplo n.º 3
0
        public ActionResult SaveEmail()
        {
            try {
                if (Web.Session["Player"] == null)
                {
                    throw new Exception();
                }

                var player = UserSession.LoadPlayer();

                var isWinner = Request["isWinner"] == "true";
                var email    = Request["email"];

                if (isWinner)
                {
                    var prizeTypeID = Prize.LoadByWinnerPlayerID(player.PlayerID).PrizeTypeID;

                    var tb          = TextBlockCache.Get("WinningEmail", FileSystem.ReadTextFile("~/SiteCustom/email.html"), "Steps to claim your prize");
                    var description = "";

                    if (prizeTypeID == 3)                      // Limited Edition Cider Glasses
                    {
                        description = "Wild Side glasses don’t grow on trees. They’re found underground. And with the help of the farm dog, you dug one up. If you think it looks good now, wait until you pour cider into it - it’ll still look good. All you have to do is reply to this email and let us know what address to send it to. ";
                    }
                    else if (prizeTypeID == 4)                        // $100 Restaurant Voucher
                    {
                        description = "You found a $100 restaurant voucher - possibly the most delicious thing ever to grow in paddock soil. Please reply with your postal address so we can get your prize out to you. ";
                    }
                    else if (prizeTypeID == 5)                        // Wild Side Bottle Opener
                    {
                        description = "You just found a bottle opener in the Paddock of Prizes. Of course, you did have the help of master digger, sheep enthusiast, and current world fetch champion, the farm dog. Please reply to with your postal address so we can get your prize out to you.";
                    }

                    SendEMail.SimpleSendHTMLEmail(email, tb.Title, tb.BodyTextHtml.Replace("[firstname]", player.FirstName).Replace("[description]", description));
                }

                player.Email         = email;
                player.EmailSentDate = DateTime.Now;
                player.Save();
                Web.Session["Player"] = player;
                return(Content("OK"));
            }
            catch { }

            return(Content("ERROR"));
        }
Ejemplo n.º 4
0
        public ActionResult SubmitEntry(string auth, bool wantsToJoin)
        {
            if (!ValidateAuthToken(auth))
            {
                return(Json(new { kind = "display", text = "Sorry, your session has timed out. Please refresh the page and try again." }));
            }

            var c = new CompetitionEntry();

            c.UpdateFromRequest();
            c.UserIPAddress = Security.UserIpV4Address();
            c.Save();

            string thanksGeneral = TextBlockCache.GetRich("Competition Thanks - General").BodyTextHtml;

            return(Json(new { kind = "display", text = thanksGeneral }));
        }
Ejemplo n.º 5
0
        public ActionResult SendComment(int?auctionID, int?buyNowID, string name, string email, string comment, string auth, int?parentID, string optin)
        {
            if (!ValidateAuthToken(auth))
            {
                return(Content("Sorry, your session has timed out. Please refresh the page and try again."));
            }
            var c = new Comment();

            //c.UpdateFromRequest(); //MK why UpdateFromRequest? all values are passed in as parameters right?

            c.CommentText = comment;
            c.CommentDate = DateTime.Now;
            c.Status      = Comment.CommentStatus.Submitted.ToString();
            //	c.AuctionID = auctionID;
            //	c.BuyNowItemID = buyNowID;
            c.CommenterIP     = Security.UserIpV4Address();
            c.ParentCommentID = parentID;
            c.PersonType      = Comment.CommentPersonType.Member.ToString();
            if (Security.IsLoggedIn)
            {
                var p = Person.LoadByPersonID(Security.LoggedInUserID);

                /*if (p.Role == SecurityRoles.Roles.MODERATOR) {
                 *      // a moderator
                 *      c.PersonType = Comment.CommentPersonType.Moderator.ToString();
                 * }
                 */
                //c.CommenterName = p.UserName;
                c.CommenterEmail = p.Email;
                c.PersonID       = p.ID;
            }
            else
            {
                c.CommenterName  = name.Trim();
                c.CommenterEmail = email;
            }
            c.Save();

            if (optin == "true")
            {
                //Beweb.SiteCustom.MailChimp.Subscribe(c.CommenterEmail, Person.GetFirstName(c.CommenterName), Person.GetLastName(c.CommenterName), "", "");
            }
            Models.TextBlock thanksTextBlock = TextBlockCache.GetRich("CommentThankYou");
            return(View("CommentThankYou", thanksTextBlock));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Deletes the given record or displays validation errors if cannot delete
        /// GET: /Admin/TextBlock/Delete/5
        /// </summary>
        public ActionResult Delete(int id, string returnPage)
        {
            var    record = Models.TextBlock.LoadID(id);
            string issues = record.CheckForDependentRecords();

            if (issues != null)
            {
                Web.ErrorMessage = "Cannot delete this record. " + issues; return(RedirectToEdit(record.ID));

                return(View("TextBlockEdit"));
            }
            CheckLock(record);
            lockobj.UnLockTable(record.GetTableName(), record.ID);
            //record.Deals.DeleteAll();
            record.Delete();
            TextBlockCache.Rebuild();
            return(Redirect(returnPage));
        }
Ejemplo n.º 7
0
        public ActionResult TestEmail()
        {
            var prizeTypeID = 3;

            var tb          = TextBlockCache.Get("WinningEmail", FileSystem.ReadTextFile("~/SiteCustom/email.html"), "Claim your prize");
            var description = "";

            if (prizeTypeID == 3)              // $100 Restaurant Voucher
            {
                description = "You found a $100 restaurant voucher - possibly the most delicious thing ever to grow in paddock soil. Please reply with your postal address so we can get your prize out to you. ";
            }
            else if (prizeTypeID == 4)                // Limited Edition Cider Glasses
            {
                description = "Wild Side glasses don’t grow on trees. They’re found underground. And with the help of the farm dog, you dug one up. If you think it looks good now, wait until you pour cider into it - it’ll still look good. All you have to do is reply to this email and let us know what address to send it to. ";
            }
            else if (prizeTypeID == 5)                // Wild Side Bottle Opener
            {
                description = "You just found a bottle opener in the Paddock of Prizes. Of course, you did have the help of master digger, sheep enthusiast, and current world fetch champion, the farm dog. Please reply to with your postal address so we can get your prize out to you.";
            }

            SendEMail.SimpleSendHTMLEmail("*****@*****.**", tb.Title, tb.BodyTextHtml.Replace("[firstname]", "André").Replace("[description]", description));

            return(Content("OK"));
        }