Пример #1
0
        public ActionResult Follow()
        {
            IpCity ipcity = ApiHelper.GetCityForIp(UserAddress.GetUserAddress());

            ViewBag.Weather = ApiHelper.GetCityWeather(ipcity != null?string.IsNullOrEmpty(ipcity.city) ? "福州" : ipcity.city: "福州");
            return(PartialView());
        }
Пример #2
0
        public ActionResult MessageIng(string msg)
        {
            MessageServices     msgServices = new MessageServices();
            JsonResult <string> result      = new JsonResult <string>();
            string userip = UserAddress.GetUserAddress();
            //10分钟内,同一ip只可留言一次
            var newMsg = msgServices.query.Where(q => q.user_ip == userip).OrderByDescending(q => q.msg_time).FirstOrDefault();

            if (newMsg != null && ((TimeSpan)(DateTime.Now - newMsg.msg_time)).TotalMinutes < 10)
            {
                result.Fail("已留言," + (10 - ((TimeSpan)(DateTime.Now - newMsg.msg_time)).TotalMinutes).ToString("F0") + "分钟内无法再次留言");
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            message add = new message();

            add.is_del   = false;
            add.msg_time = DateTime.Now;
            add.content  = msg;
            add.user_ip  = userip;
            if (msgServices.Add(add) > 0)
            {
                result.Success();
            }
            else
            {
                result.Fail("留言失败");
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        /// <summary>
        /// 点赞、踩
        /// </summary>
        /// <param name="msgid"></param>
        /// <param name="is_up"></param>
        /// <returns></returns>
        public ActionResult LikeMsg(int msgid, bool is_up)
        {
            JsonResult <string> result       = new JsonResult <string>();
            CommentLikeServices likeservices = new CommentLikeServices();
            var userAddress = UserAddress.GetUserAddress();
            var lieks       = likeservices.query.Where(q => q.comment_id == msgid).ToList();
            var like        = likeservices.query.Where(q => q.comment_id == msgid).Where(q => q.user_ip == userAddress).FirstOrDefault();

            if (like != null)
            {
                if (like.is_like == is_up)
                {
                    result.Fail("");
                }
                else
                {
                    like.is_like = is_up;
                    if (likeservices.Update(like) > 0)
                    {
                        result.Success();
                    }
                    else
                    {
                        result.Fail("");
                    }
                }
            }
            else
            {
                comment_like add = new comment_like();
                add.is_like = is_up;
                //add.user_id
                add.user_ip    = userAddress;
                add.add_time   = DateTime.Now;
                add.comment_id = msgid;
                if (likeservices.Add(add) > 0)
                {
                    result.Success();
                }
                else
                {
                    result.Fail("");
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        private void SendMassMail(string message)
        {
            _mail = new MailService();

            int totalSent = 0;

            var uas = new UserAccounts();
            uas.GetAll();

            foreach (UserAccount ua1 in uas.OrderBy(x => x.CreateDate))
            {
                var uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua1.UserAccountID);

                if (!uad.EmailMessages) continue;

                // safety
               if (ua1.UserName != "bootlegbaron") continue;

                var userAddress = new UserAddress();
                userAddress.GetUserAddress(ua1.UserAccountID);

                System.Threading.Thread.Sleep(200);

                if (_mail.SendMail("*****@*****.**", ua1.EMail, "Das Klub Kalendar 2017 - Competition!", message))
                {
                    totalSent++;
                }
                else
                {
                    uad.EmailMessages = false;
                    uad.Update();
                }
            }

            HttpContext.Current.Response.Write(totalSent);
        }
Пример #5
0
        public ActionResult UserAddress()
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            UserAddressModel model = new UserAddressModel();

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            if (BootBaronLib.Configs.GeneralConfigs.IsGiveAway && uadress.UserAddressID > 0) return View("NotAllowed");

            if (uadress.UserAddressID == 0)
            {
                model.PostalCode = uad.PostalCode;
                model.Country = uad.Country;
            }
            else
            {
                model.AddressLine1 = uadress.AddressLine1;
                model.AddressLine2 = uadress.AddressLine2;
                model.AddressLine3 = uadress.AddressLine3;
                model.City = uadress.City;
                model.Country = uadress.CountryISO;
                model.FirstName = uadress.FirstName;
                model.LastName = uadress.LastName;
                model.PostalCode = uadress.PostalCode;
                model.RegionState = uadress.Region;
            }

            return View(model);
        }
Пример #6
0
        public ActionResult UserAddress(UserAddressModel model)
        {
            LoadCountries();

            mu = Membership.GetUser();
            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            BootBaronLib.AppSpec.DasKlub.BOL.UserAddress uadress = new UserAddress();

            uadress.GetUserAddress(ua.UserAccountID);

            TryUpdateModel(model);

            if (ModelState.IsValid)
            {
                uadress.AddressLine1 = model.AddressLine1;
                uadress.AddressLine2 = model.AddressLine2;
                uadress.AddressLine3 = model.AddressLine3;
                uadress.City = model.City;
                uadress.CountryISO = model.Country;
                uadress.FirstName = model.FirstName;
                uadress.LastName = model.LastName;
                uadress.PostalCode = model.PostalCode;
                uadress.Region = model.RegionState;
                uadress.UserAccountID = ua.UserAccountID;

                if (uadress.UserAddressID == 0) uadress.AddressStatus = 'U';

                ViewBag.ProfileUpdated = uadress.Set();
            }
            //if (BootBaronLib.AppSpec.DasKlub.BOL.UserAddress.IsBlank(ua.UserAccountID))
            //{
            //    newUAdd.UserAccountID = ua.UserAccountID;
            //    newUAdd.CreatedByUserID = ua.UserAccountID;

            //    if (Request.Form["no_button"] != null &&
            //        Request.Form["no_button"] == "no")
            //    {
            //        newUAdd.AddressStatus = 'N';
            //    }
            //    else
            //    {
            //        newUAdd.AddressStatus = 'U';
            //    }

            //    if (!string.IsNullOrEmpty(newUAdd.PostalCode) && (string.IsNullOrEmpty(newUAdd.City) || string.IsNullOrEmpty(newUAdd.Region)))
            //    {
            //        // for those those who think the system can figure them out
            //        SiteEnums.CountryCodeISO coiso = GeoData.GetCountryISOForCountryCode(newUAdd.CountryISO);

            //        SiteStructs.CityRegion cr = GeoData.GetCityRegionForPostalCodeCountry(newUAdd.PostalCode, coiso);

            //        newUAdd.Region = cr.Region;
            //        newUAdd.City = cr.CityName;
            //    }

            //    newUAdd.Create();
            //}
            ////Response.Redirect("/" + ua.UserName);
            //Response.Redirect("~/thanks.htm");

            //uad = new UserAccountDetail();
            //uad.GetUserAccountDeailForUser(ua.UserAccountID);

            return View(model);
        }
Пример #7
0
        public ActionResult UserAddress()
        {
            LoadCountries();

            if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            _uad = new UserAccountDetail();
            _uad.GetUserAccountDeailForUser(_ua.UserAccountID);

            var model = new UserAddressModel();

            var uadress = new UserAddress();

            uadress.GetUserAddress(_ua.UserAccountID);

            if (GeneralConfigs.IsGiveAway && uadress.UserAddressID > 0) return View("NotAllowed");

            if (uadress.UserAddressID == 0)
            {
                model.PostalCode = _uad.PostalCode;
                model.Country = _uad.Country;
            }
            else
            {
                model.AddressLine1 = uadress.AddressLine1;
                model.AddressLine2 = uadress.AddressLine2;
                model.AddressLine3 = uadress.AddressLine3;
                model.City = uadress.City;
                model.Country = uadress.CountryISO;
                model.FirstName = uadress.FirstName;
                model.LastName = uadress.LastName;
                model.PostalCode = uadress.PostalCode;
                model.RegionState = uadress.Region;
            }

            return View(model);
        }
Пример #8
0
        public ActionResult UserAddress(UserAddressModel model)
        {
            LoadCountries();

            if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            _uad = new UserAccountDetail();
            _uad.GetUserAccountDeailForUser(_ua.UserAccountID);

            var uadress = new UserAddress();

            uadress.GetUserAddress(_ua.UserAccountID);

            TryUpdateModel(model);

            if (ModelState.IsValid)
            {
                uadress.AddressLine1 = model.AddressLine1;
                uadress.AddressLine2 = model.AddressLine2;
                uadress.AddressLine3 = model.AddressLine3;
                uadress.City = model.City;
                uadress.CountryISO = model.Country;
                uadress.FirstName = model.FirstName;
                uadress.LastName = model.LastName;
                uadress.PostalCode = model.PostalCode;
                uadress.Region = model.RegionState;
                uadress.UserAccountID = _ua.UserAccountID;
                //  uadress.Choice1 = "||" + Request.Form["sex"] + "|" + Request.Form["size"];

                if (uadress.UserAddressID == 0) uadress.AddressStatus = 'U';

                ViewBag.ProfileUpdated = uadress.Set();

                Response.Redirect("/account/home");
            }

            return View(model);
        }