/// <summary> /// 添加订单产品 /// </summary> /// <param name="orderID"></param> protected void AddOrderProduct(int orderID) { List <CartInfo> cartList = CartBLL.ReadList(base.UserId); //读取产品 checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart")); int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); cartList = CartBLL.ReadList(base.UserId); cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList(); string strProductID = string.Empty; foreach (CartInfo cart in cartList) { if (strProductID == string.Empty) { strProductID = cart.ProductId.ToString(); } else { strProductID += "," + cart.ProductId.ToString(); } } List <ProductInfo> productList = new List <ProductInfo>(); if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = strProductID; productList = ProductBLL.SearchList(productSearch); } //会员价格 //List<MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); //添加订单产品 Dictionary <string, bool> cartDic = new Dictionary <string, bool>(); Dictionary <int, int> cartOrderDetailDic = new Dictionary <int, int>(); foreach (CartInfo cart in cartList) { ProductInfo product = ProductBLL.ReadProductByProductList(productList, cart.ProductId); OrderDetailInfo orderDetail = new OrderDetailInfo(); orderDetail.OrderId = orderID; orderDetail.ProductId = cart.ProductId; orderDetail.ProductName = cart.ProductName; orderDetail.ProductWeight = product.Weight; orderDetail.SendPoint = product.SendPoint; orderDetail.ProductPrice = ProductBLL.GetCurrentPriceWithStandard(product.Id, base.GradeID, cart.StandardValueList); orderDetail.BuyCount = cart.BuyCount; orderDetail.RandNumber = cart.RandNumber; int orderDetailID = OrderDetailBLL.Add(orderDetail); cartOrderDetailDic.Add(cart.Id, orderDetailID); } CartBLL.Delete(cartIds, base.UserId); //CartBLL.Clear(base.UserId); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); result = RequestHelper.GetQueryString <string>("Result"); errorMessage = RequestHelper.GetQueryString <string>("ErrorMessage"); //短信验证码有效期 string verify_send = CookiesHelper.ReadCookieValue("verify_send"); DateTime tmNow = DateTime.Now; DateTime tm; try { tm = DateTime.Parse(verify_send); } catch { tm = tmNow.AddSeconds(-60); } wait = 60 - Convert.ToInt32((tmNow - tm).TotalSeconds); if (wait < 0) { wait = 0; } if (RequestHelper.GetQueryString <string>("Action") == "Register") { PostBack(); } Title = "会员注册"; }
/// <summary> /// 投票 /// </summary> /// <param name="voteID"></param> protected void Vote(int voteID) { string result = "ok"; if (ShopConfig.ReadConfigInfo().AllowAnonymousVote == (int)BoolType.False && base.UserID == 0) { result = "还未登录"; } else { string voteCookies = CookiesHelper.ReadCookieValue("VoteCookies" + voteID.ToString()); if (ShopConfig.ReadConfigInfo().VoteRestrictTime > 0 && voteCookies != string.Empty) { result = "请不要频繁提交"; } else { VoteRecordInfo voteRecord = new VoteRecordInfo(); voteRecord.VoteID = voteID; voteRecord.ItemID = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("ItemID")); voteRecord.AddDate = RequestHelper.DateNow; voteRecord.UserIP = ClientHelper.IP; voteRecord.UserID = base.UserID; voteRecord.UserName = base.UserName; VoteRecordBLL.AddVoteRecord(voteRecord); if (ShopConfig.ReadConfigInfo().VoteRestrictTime > 0) { CookiesHelper.AddCookie("VoteCookies" + voteID.ToString(), "VoteCookies" + voteID.ToString(), ShopConfig.ReadConfigInfo().VoteRestrictTime, TimeType.Second); } } } ResponseHelper.Write(result); ResponseHelper.End(); }
protected override void PageLoad() { //从Cookies中读取验证码并解密 if (StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSIsChecked"), "SMS") == "true") { checkCode = StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"); } if (string.IsNullOrEmpty(mobile)) { mobile = base.UserMobile; } if (userID <= 0) { userID = base.UserID; } ProductInfo product = ProductBLL.ReadProduct(productID); if (product != null) { vu = product.ProductNumber; videoDic = PolyvBLL.GetVideoDic(product.ProductNumber.Split('|')[0]); } }
/// <summary> /// 检查cookies /// </summary> /// <returns></returns> private static bool CheckCookies() { bool flag = false; string cookiesValue = CookiesHelper.ReadCookieValue(cookiesName); if (cookiesValue != string.Empty) { try { string[] strArray = cookiesValue.Split(new char[] { '|' }); string sign = strArray[0]; string adminID = strArray[1]; string adminName = strArray[2]; string groupID = strArray[3]; string randomNumber = strArray[4]; if (FormsAuthentication.HashPasswordForStoringInConfigFile(adminID + adminName + groupID + randomNumber + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == sign.ToLower()) { flag = true; } else { CookiesHelper.DeleteCookie(cookiesName); } } catch { CookiesHelper.DeleteCookie(cookiesName); } } return(flag); }
///<summary> /// 验证用户是否登陆 ///</summary> private void CheckAdminLogin() { if (Cookies.Admin.GetAdminID(true) == 0) { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } else { if (CookiesHelper.ReadCookie("AdminSign") != null) { AdminInfo admin = AdminBLL.Read(Cookies.Admin.GetAdminID(true)); string signvalue = FormsAuthentication.HashPasswordForStoringInConfigFile(admin.Id.ToString() + admin.Name + admin.GroupId.ToString() + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent + admin.Password, "MD5"); if (signvalue != CookiesHelper.ReadCookieValue("AdminSign")) { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } } else { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } } }
protected override void PageLoad() { base.PageLoad(); base.Title = "¹«Ë¾±à¼"; base.CheckUserPower("ReadCompany,UpdateCompany,UpdateSubCompany", PowerCheckType.OR); string sonCompanyID = CookiesHelper.ReadCookieValue("UserCompanySonCompanyID"); if (companyID > 0) { if (!StringHelper.CompareSingleString(sonCompanyID, companyID.ToString())) { ScriptHelper.Alert("Òì³£"); } } else { companyID = base.UserCompanyID; } company = CompanyBLL.ReadCompany(companyID); if (StringHelper.CompareSingleString(company.BrandId, "0")) { productBrandList = ProductBrandBLL.ReadProductBrandCacheList(); } else { productBrandList = ProductBrandBLL.ReadProductBrandCacheList(company.BrandId); } departmentList = PostBLL.ReadParentPostListByPostId(company.Post); postList = PostBLL.ReadPostListByPostId(company.Post); if (company.GroupId == (int)CompanyType.SubCompany || company.GroupId == (int)CompanyType.SubGroup) { parentCompanyPath = CompanyBLL.ReadParentCompanyName(company.ParentId); } }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { //读取用户信息 userID = Cookies.User.GetUserID(true); string userName = Cookies.User.GetUserName(false); string userEmail = CookiesHelper.ReadCookieValue("UserEmail"); //添加团购记录 int id = RequestHelper.GetQueryString <int>("ID"); groupBuy = GroupBuyBLL.ReadGroupBuy(id); UserGroupBuyInfo userGroupBuy = new UserGroupBuyInfo(); userGroupBuy.GroupBuyID = id; userGroupBuy.Date = RequestHelper.DateNow; userGroupBuy.IP = ClientHelper.IP; userGroupBuy.BuyCount = RequestHelper.GetForm <int>("BuyCount"); userGroupBuy.OrderID = 0; userGroupBuy.UserID = userID; userGroupBuy.UserName = userName; userGroupBuy.Consignee = StringHelper.AddSafe(RequestHelper.GetForm <string>("Consignee")); userGroupBuy.RegionID = RegionID.ClassID; userGroupBuy.Address = StringHelper.AddSafe(RequestHelper.GetForm <string>("Address")); userGroupBuy.ZipCode = StringHelper.AddSafe(RequestHelper.GetForm <string>("ZipCode")); userGroupBuy.Tel = StringHelper.AddSafe(RequestHelper.GetForm <string>("Tel")); userGroupBuy.Email = userEmail; userGroupBuy.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); UserGroupBuyBLL.AddUserGroupBuy(userGroupBuy); UserAccountRecordBLL.AddUserAccountRecord(-groupBuy.Price * userGroupBuy.BuyCount, 0, "参加团购活动:" + groupBuy.Name, userID, userName); ScriptHelper.Alert("购买成功!", "GroupBuyDetail.aspx?ID=" + userGroupBuy.GroupBuyID); }
private bool CheckSMSCode(string Mobile, string CheckCode, int TimeOutSeconds) { bool IsOK = false; //从Cookies中读取验证码并解密 string SrcCheckCode = StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"); //如果验证码值不为空(cookies的有效期只有几分钟) if (!string.IsNullOrEmpty(SrcCheckCode)) { if (SrcCheckCode == CheckCode) { IsOK = true; } CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), SMSConfig.CodeTimeOut, TimeType.Minute); } else { SMSRecordInfo SMSRecordModel = SMSRecordBLL.ReadSMSRecord(Mobile, CheckCode); if (SMSRecordModel != null) { if ((DateTime.Now - SMSRecordModel.DataCreateDate).TotalSeconds <= TimeOutSeconds) { if (SMSRecordModel.VerCode == CheckCode) { IsOK = true; } CookiesHelper.AddCookie("SMSCheckCode", StringHelper.Encode(CheckCode, "SMS"), (SMSConfig.CodeTimeOut - (int)(DateTime.Now - SMSRecordModel.DataCreateDate).TotalMinutes), TimeType.Minute); CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), (SMSConfig.CodeTimeOut - (int)(DateTime.Now - SMSRecordModel.DataCreateDate).TotalMinutes), TimeType.Minute); } } } return(IsOK); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); user = UserBLL.Read(base.UserId); //userGradeName = UserGradeBLL.Read(base.GradeID).Name; //短信验证码有效期 string verify_send = CookiesHelper.ReadCookieValue("verify_send"); DateTime tmNow = DateTime.Now; DateTime tm; try { tm = DateTime.Parse(verify_send); } catch { tm = tmNow.AddSeconds(-60); } wait = 60 - Convert.ToInt32((tmNow - tm).TotalSeconds); if (wait < 0) { wait = 0; } if (RequestHelper.GetQueryString <string>("Action") == "UpdateMobile") { UpdateUserMobile(); } }
protected void Vote(int voteID) { string content = "ok"; if ((ShopConfig.ReadConfigInfo().AllowAnonymousVote == 0) && (base.UserID == 0)) { content = "»¹Î´µÇ¼"; } else { string str2 = CookiesHelper.ReadCookieValue("VoteCookies" + voteID.ToString()); if ((ShopConfig.ReadConfigInfo().VoteRestrictTime > 0) && (str2 != string.Empty)) { content = "Ç벻ҪƵ·±Ìá½»"; } else { VoteRecordInfo voteRecord = new VoteRecordInfo(); voteRecord.VoteID = voteID; voteRecord.ItemID = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("ItemID")); voteRecord.AddDate = RequestHelper.DateNow; voteRecord.UserIP = ClientHelper.IP; voteRecord.UserID = base.UserID; voteRecord.UserName = base.UserName; VoteRecordBLL.AddVoteRecord(voteRecord); if (ShopConfig.ReadConfigInfo().VoteRestrictTime > 0) { CookiesHelper.AddCookie("VoteCookies" + voteID.ToString(), "VoteCookies" + voteID.ToString(), ShopConfig.ReadConfigInfo().VoteRestrictTime, TimeType.Second); } } } ResponseHelper.Write(content); ResponseHelper.End(); }
/// <summary> /// 检查cookies /// </summary> /// <returns></returns> private void ReadUserCookies() { string cookiesName = ShopConfig.ReadConfigInfo().UserCookies; string cookiesValue = CookiesHelper.ReadCookieValue(cookiesName); if (cookiesValue != string.Empty) { try { string[] strArray = cookiesValue.Split(new char[] { '|' }); string sign = strArray[0]; string userID = strArray[1]; string userName = strArray[2]; if (FormsAuthentication.HashPasswordForStoringInConfigFile(userID + userName + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == sign.ToLower()) { UserId = Convert.ToInt32(userID); UserName = HttpContext.Current.Server.UrlDecode(userName); } else { CookiesHelper.DeleteCookie(cookiesName); } } catch { CookiesHelper.DeleteCookie(cookiesName); } } }
public void AddProductReply(ref string result) { int queryString = RequestHelper.GetQueryString <int>("ProductID"); int num2 = RequestHelper.GetQueryString <int>("CommentID"); string str = CookiesHelper.ReadCookieValue("ReplytCookies" + num2.ToString()); if ((ShopConfig.ReadConfigInfo().ReplyRestrictTime > 0) && (str != string.Empty)) { result = "Ç벻ҪƵ·±Ìá½»"; } else { ProductReplyInfo productReply = new ProductReplyInfo(); productReply.ProductID = queryString; productReply.CommentID = num2; productReply.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productReply.UserIP = ClientHelper.IP; productReply.PostDate = RequestHelper.DateNow; productReply.UserID = base.UserID; productReply.UserName = base.UserName; ProductReplyBLL.AddProductReply(productReply); if (ShopConfig.ReadConfigInfo().ReplyRestrictTime > 0) { CookiesHelper.AddCookie("ReplytCookies" + num2.ToString(), "ReplytCookies" + num2.ToString(), ShopConfig.ReadConfigInfo().ReplyRestrictTime, TimeType.Second); } } }
protected override void PageLoad() { base.PageLoad(); topNav = 12; step = RequestHelper.GetQueryString <int>("step"); if (step < 1) { step = 1; } errorMsg = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("msg")); string userName = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("u")); if (!string.IsNullOrEmpty(userName)) { user = UserBLL.Read(userName); } if (step == 3) { string[] verify = StringHelper.Decode(CookiesHelper.ReadCookieValue("verify"), "sms").Split('|'); code = verify.Length > 1 ? verify[1] : ""; } Title = "找回密码"; }
protected override void PageLoad() { base.PageLoad(); if (base.UserID > 0) { ExistsSonCompany = IsGroupCompany(int.Parse(CookiesHelper.ReadCookieValue("UserCompanyType"))); } //根据当前用户判断并给页面公司列表加载数据 if (ExistsSonCompany) { SonCompanyList = CompanyBLL.ReadCompanyListByCompanyId(SonCompanyID); } //防止通过修改CompanyID值来非法获取其他公司信息 string companyID = Request["CompanyID"]; if (!string.IsNullOrEmpty(companyID) && companyID != "0" && companyID != int.MinValue.ToString() && !string.IsNullOrEmpty(StringHelper.SubString(companyID, this.SonCompanyID))) { ScriptHelper.Alert("公司信息有误!"); } isBase = IsCurrentMenu("UserAdd.aspx,ChangePassword.aspx,CompanyAdd.aspx,CompanyList.aspx,UserList.aspx,UserAdd.aspx"); if (!isBase) { isEMS = IsCurrentMenu("HRReport.aspx,PostPlanReport.aspx,ZongHeReport.aspx,TestPaperRecord.aspx,CourseReport.aspx,PostPlanRate.aspx,Training.aspx,TrainingAdd.aspx,TrainingCourseAdd.aspx"); if (!isEMS) { isTPR = IsCurrentMenu("KPI.aspx,KPIAdd.aspx,WorkingPost.aspx,WorkingPostAdd.aspx,EvaluateNameAdd.aspx,EvaluateName.aspx,EvaluateAdd.aspx,EvaluateShow.aspx,StaffEvaluateAdd.aspx,EvaluateReport.aspx,StaffEvaluateReport.aspx"); } } }
protected override void PageLoad() { base.PageLoad(); topNav = 7; int count = 0; int currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 12; //浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); if (strHistoryProduct.StartsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(1); } if (strHistoryProduct.EndsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(0, strHistoryProduct.Length - 1); } if (!string.IsNullOrEmpty(strHistoryProduct)) { proHistoryList = ProductBLL.SearchList(currentPage, pageSize, new ProductSearchInfo { IsSale = 1, InProductId = strHistoryProduct }, ref count); } commonPagerClass.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile)); }
protected void Page_Load(object sender, EventArgs e) { bool isVerify = false; if (StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSIsChecked"), "SMS") == "true" && !string.IsNullOrEmpty(StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"))) { isVerify = true; } //if (!isVerify && base.UserID > 0) //{ // if (!string.IsNullOrEmpty(base.UserMobile)) // { // SMSRecordInfo smsRecord = SMSRecordBLL.ReadSMSRecord(base.UserMobile); // if (smsRecord != null) // { // if ((DateTime.Now - smsRecord.DataCreateDate).TotalSeconds <= SMSConfig.CodeTimeOut * 60) // { // isVerify = true; // CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), (SMSConfig.CodeTimeOut - (int)(DateTime.Now - smsRecord.DataCreateDate).TotalMinutes), TimeType.Minute); // } // } // } //} if (isVerify) { ResponseHelper.Redirect("CourseVideo.aspx?CateId=" + productID.ToString()); } }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); //不带任何参数访问则跳至验证身份页面 if (string.IsNullOrEmpty(loginName) && string.IsNullOrEmpty(action) && string.IsNullOrEmpty(result)) { ResponseHelper.Redirect("/mobile/user/findpasswordinit.html"); } Title = "找回密码"; //短信验证码有效期 string verify_send = CookiesHelper.ReadCookieValue("verify_send"); DateTime tmNow = DateTime.Now; DateTime tm; try { tm = DateTime.Parse(verify_send); } catch { tm = tmNow.AddSeconds(-60); } wait = 60 - Convert.ToInt32((tmNow - tm).TotalSeconds); if (wait < 0) { wait = 0; } if (action == "Post") { Post(); } }
/// <summary> /// 添加回复 /// </summary> /// <param name="result"></param> public void AddProductReply(ref string result) { int productID = RequestHelper.GetQueryString <int>("ProductID"); int commentID = RequestHelper.GetQueryString <int>("CommentID"); string replytCookies = CookiesHelper.ReadCookieValue("ReplytCookies" + commentID.ToString()); if (ShopConfig.ReadConfigInfo().ReplyRestrictTime > 0 && replytCookies != string.Empty) { result = "请不要频繁提交"; } else { ProductReplyInfo productReply = new ProductReplyInfo(); productReply.ProductID = productID; productReply.CommentID = commentID; productReply.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productReply.UserIP = ClientHelper.IP; productReply.PostDate = RequestHelper.DateNow; productReply.UserID = base.UserID; productReply.UserName = base.UserName; ProductReplyBLL.AddProductReply(productReply); if (ShopConfig.ReadConfigInfo().ReplyRestrictTime > 0) { CookiesHelper.AddCookie("ReplytCookies" + commentID.ToString(), "ReplytCookies" + commentID.ToString(), ShopConfig.ReadConfigInfo().ReplyRestrictTime, TimeType.Second); } } }
/// <summary> /// 添加评论 /// </summary> /// <param name="result"></param> public void AddProductComment(ref string result) { int productID = RequestHelper.GetQueryString <int>("ProductID"); int orderID = RequestHelper.GetQueryString <int>("OrderID"); string commentCookies = CookiesHelper.ReadCookieValue("CommentCookies" + productID.ToString()); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0 && commentCookies != string.Empty) { result = "请不要频繁提交"; } else { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductId = productID; productComment.Title = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Title")); productComment.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = RequestHelper.GetQueryString <int>("Rank"); productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserId = base.UserId; productComment.UserName = base.UserName; productComment.OrderId = orderID; ProductCommentBLL.Add(productComment); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) { CookiesHelper.AddCookie("CommentCookies" + productID.ToString(), "CommentCookies" + productID.ToString(), ShopConfig.ReadConfigInfo().CommentRestrictTime, TimeType.Second); } } }
private ArrayList GetAutoComplete() { string Keyword = StringHelper.SearchSafe(RequestHelper.GetForm <string>("word")); int RowCount = RequestHelper.GetForm <int>("rowCount"); //List<TestCateInfo> TestCateList = BLLTestCate.ReadTestCateCacheList().FindAll(delegate(TestCateInfo TempModel) { return (!string.IsNullOrEmpty(TempModel.CateCode) || !string.IsNullOrEmpty(TempModel.CourseContent)) && TempModel.CompanyId==0 && CompareStr.comparebrand(TempModel.BrandId, BLLCompany.BrandId) && TempModel.CateName.Contains(Keyword); }); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = Keyword; productSearch.IsSale = 1; //productSearch.InProductID=PostBLL.ReadPostCourseID(base.UserCompanyID,CookiesHelper.ReadCookieValue("UserStudyPostId")); productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString(); productSearch.InBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); ArrayList ResultCateList = new ArrayList(); for (int i = 0; i < productList.Count; i++) { if (!ResultCateList.Contains(productList[i].Name)) { if (i >= RowCount) { break; } ResultCateList.Add(productList[i].Name); } } return(ResultCateList); }
private static bool CheckCookies() { string str = CookiesHelper.ReadCookieValue(cookiesName); if (str != string.Empty) { try { string[] strArray = str.Split(new char[] { '|' }); string str2 = strArray[0]; string str3 = strArray[1]; string str4 = strArray[2]; string str5 = strArray[3]; string str6 = strArray[4]; if (FormsAuthentication.HashPasswordForStoringInConfigFile(str3 + str4 + str5 + str6 + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == str2.ToLower()) { return(true); } CookiesHelper.DeleteCookie(cookiesName); } catch { CookiesHelper.DeleteCookie(cookiesName); } } return(false); }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "SelectShipping") { this.SelectShipping(); } string idList = CookiesHelper.ReadCookieValue("usr_region"); if (string.IsNullOrEmpty(idList)) { string city = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("city")); if (!string.IsNullOrEmpty(city)) { idList = RegionBLL.ReadRegionIdList(city); CookiesHelper.AddCookie("usr_region", idList, 1, TimeType.Year); } } singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); singleUnlimitClass.ClassID = idList; singleUnlimitClass.FunctionName = "readShippingMoney()"; }
public void AgainstComment() { string content = string.Empty; if ((ShopConfig.ReadConfigInfo().AllowAnonymousCommentOperate == 0) && (base.UserID == 0)) { content = "»¹Î´µÇ¼"; } else { int queryString = RequestHelper.GetQueryString <int>("CommentID"); string str2 = CookiesHelper.ReadCookieValue("CommentOperateCookies" + queryString.ToString()); if ((ShopConfig.ReadConfigInfo().CommentOperateRestrictTime > 0) && (str2 != string.Empty)) { content = "Ç벻ҪƵ·±Ìá½»"; } else { ProductCommentBLL.ChangeProductCommentAgainstCount(queryString.ToString(), ChangeAction.Plus); if (ShopConfig.ReadConfigInfo().CommentOperateRestrictTime > 0) { CookiesHelper.AddCookie("CommentOperateCookies" + queryString.ToString(), "CommentOperateCookies" + queryString.ToString(), ShopConfig.ReadConfigInfo().CommentOperateRestrictTime, TimeType.Second); } content = "ok"; } } ResponseHelper.Write(content); ResponseHelper.End(); }
public void AddTags(ref string result) { int queryString = RequestHelper.GetQueryString <int>("ProductID"); string str = CookiesHelper.ReadCookieValue("TagsCookies" + queryString.ToString()); if ((ShopConfig.ReadConfigInfo().AddTagsRestrictTime > 0) && (str != string.Empty)) { result = "Ç벻ҪƵ·±Ìá½»"; } else { TagsInfo tags = new TagsInfo(); tags.ProductID = queryString; tags.Word = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Word")); tags.Color = "#4C5A62"; tags.Size = 12; tags.IsTop = 0; tags.UserID = base.UserID; tags.UserName = base.UserName; TagsBLL.AddTags(tags); if (ShopConfig.ReadConfigInfo().AddTagsRestrictTime > 0) { CookiesHelper.AddCookie("TagsCookies" + queryString.ToString(), "TagsCookies" + queryString.ToString(), ShopConfig.ReadConfigInfo().AddTagsRestrictTime, TimeType.Second); } } }
public void AddProductComment(ref string result) { int queryString = RequestHelper.GetQueryString <int>("ProductID"); string str = CookiesHelper.ReadCookieValue("CommentCookies" + queryString.ToString()); if ((ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) && (str != string.Empty)) { result = "Ç벻ҪƵ·±Ìá½»"; } else { ProductCommentInfo productComment = new ProductCommentInfo(); productComment.ProductID = queryString; productComment.Title = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Title")); productComment.Content = StringHelper.AddSafe(RequestHelper.GetQueryString <string>("Content")); productComment.UserIP = ClientHelper.IP; productComment.PostDate = RequestHelper.DateNow; productComment.Support = 0; productComment.Against = 0; productComment.Status = ShopConfig.ReadConfigInfo().CommentDefaultStatus; productComment.Rank = RequestHelper.GetQueryString <int>("Rank"); productComment.ReplyCount = 0; productComment.AdminReplyContent = string.Empty; productComment.AdminReplyDate = RequestHelper.DateNow; productComment.UserID = base.UserID; productComment.UserName = base.UserName; ProductCommentBLL.AddProductComment(productComment); if (ShopConfig.ReadConfigInfo().CommentRestrictTime > 0) { CookiesHelper.AddCookie("CommentCookies" + queryString.ToString(), "CommentCookies" + queryString.ToString(), ShopConfig.ReadConfigInfo().CommentRestrictTime, TimeType.Second); } } }
/// <summary> /// 返回考试设置信息 /// </summary> /// <param name="companyId"></param> /// <returns></returns> public static TestSettingInfo ReadTestSetting(int companyId, int courseId) { //string parentCompanyID = CookiesHelper.ReadCookieValue("UserCompanyParentCompanyID"); //if (string.IsNullOrEmpty(parentCompanyID)) parentCompanyID = companyId.ToString(); //else parentCompanyID = companyId.ToString() + "," + parentCompanyID; return(ReadTestSetting(CookiesHelper.ReadCookieValue("UserCompanyParentCompanyID"), courseId)); }
//private void VerSMS() //{ // string Mobile = RequestHelper.GetQueryString<string>("Mobile"); // string CheckCode = RequestHelper.GetQueryString<string>("CheckCode"); // int productID = RequestHelper.GetQueryString<int>("CateId"); // int Part = RequestHelper.GetQueryString<int>("Part"); // int UserId = RequestHelper.GetQueryString<int>("UserId"); // bool IsSend = false; // try // { // ProductInfo product = ProductBLL.ReadProduct(productID); // //从Cookies中读取验证码并解密 // string SrcCheckCode = StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"); // //如果验证码值不为空(cookies的有效期只有几分钟) // if (!string.IsNullOrEmpty(SrcCheckCode)) // { // if (SrcCheckCode == CheckCode) IsSend = true; // } // else // { // int TimeOutSeconds = SMSConfig.CodeTimeOut * 60; // //if (TestCateModel.CateCode.Contains("|")) // //{ // // //多个视频,验证有效期延长至五个小时 // // TimeOutSeconds = 5 * 3600; // //} // SMSRecordInfo SMSRecordModel = SMSRecordBLL.ReadSMSRecord(Mobile, CheckCode); // if (SMSRecordModel != null) // { // if ((DateTime.Now - SMSRecordModel.DataCreateDate).TotalSeconds <= TimeOutSeconds) // { // if (SMSRecordModel.VerCode == CheckCode) IsSend = true; // } // } // } // if (IsSend) // { // //添加已验证的cookies标志 // CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), SMSConfig.CodeTimeOut, TimeType.Minute); // if (UserId == int.MinValue) UserId = base.UserID; // if (Part < 0) Part = 0; // product.ProductNumber = "a5b7f39294fe8738289db2ae88ccc896_a|a5b7f39294ccd4aa12c69403ad6287ec_a"; // string[] CateCodeArray = product.ProductNumber.Split('|'); // for (int i = 0; i < CateCodeArray.Length; i++) // { // if (Part == i) // ResponseHelper.Write("<li class=\"current\"><a href=\"javascript:compareMoveCode(" + productID.ToString() + "," + i.ToString() + ",'" + Mobile + "','" + CheckCode + "');\">第 " + (i + 1).ToString() + " 集</a></li>"); // else // ResponseHelper.Write("<li><a href=\"javascript:compareMoveCode(" + productID.ToString() + "," + i.ToString() + ",'" + Mobile + "','" + CheckCode + "');\">第 " + (i + 1).ToString() + " 集</a></li>"); // } // ResponseHelper.Write("|http://player.polyv.net/videos/player.swf?vid=" + CateCodeArray[Part] + "&code=" + UserId.ToString() + "_" + CheckCode); // //ResponseHelper.Write("|http://yuntv.letv.com/bcloud.html?uu=debb2235d3&vu=" + CateCodeArray[Part] + "&auto_play=1&gpcflag=1&width=800&height=475&payer_name=" + Mobile + "&check_code=" + UserId.ToString() + "_" + CheckCode + "_" + productID.ToString() + "&extend=0&share=0"); // } // else // { // ResponseHelper.Write("验证码不正确"); // } // } // catch // { // ResponseHelper.Write("异常错误!"); // } //} private void VerSMS() { string Mobile = RequestHelper.GetQueryString <string>("Mobile"); string CheckCode = RequestHelper.GetQueryString <string>("CheckCode"); int productID = RequestHelper.GetQueryString <int>("CateId"); int Part = RequestHelper.GetQueryString <int>("Part"); int UserId = RequestHelper.GetQueryString <int>("UserId"); bool IsSend = false; try { //从Cookies中读取验证码并解密 string SrcCheckCode = StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"); //如果验证码值不为空(cookies的有效期只有几分钟) if (!string.IsNullOrEmpty(SrcCheckCode)) { if (SrcCheckCode == CheckCode) { IsSend = true; } CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), SMSConfig.CodeTimeOut, TimeType.Minute); } else { int TimeOutSeconds = SMSConfig.CodeTimeOut * 60; SMSRecordInfo SMSRecordModel = SMSRecordBLL.ReadSMSRecord(Mobile, CheckCode); if (SMSRecordModel != null) { if ((DateTime.Now - SMSRecordModel.DataCreateDate).TotalSeconds <= TimeOutSeconds) { if (SMSRecordModel.VerCode == CheckCode) { IsSend = true; } CookiesHelper.AddCookie("SMSCheckCode", StringHelper.Encode(CheckCode, "SMS"), (SMSConfig.CodeTimeOut - (int)(DateTime.Now - SMSRecordModel.DataCreateDate).TotalMinutes), TimeType.Minute); CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), (SMSConfig.CodeTimeOut - (int)(DateTime.Now - SMSRecordModel.DataCreateDate).TotalMinutes), TimeType.Minute); } } } if (IsSend) { //添加已验证的cookies标志 //CookiesHelper.AddCookie("SMSIsChecked", StringHelper.Encode("true", "SMS"), SMSConfig.CodeTimeOut, TimeType.Minute); ResponseHelper.Write("true"); } else { ResponseHelper.Write("验证码不正确"); } } catch { ResponseHelper.Write("异常错误!"); } }
//计算商品优惠金额 protected void SelectProductFavor() { decimal favorMoney = 0; int favorId = RequestHelper.GetQueryString <int>("favorId"); if (favorId > 0) { var theFavor = FavorableActivityBLL.Read(favorId); checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart")); int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); cartList = CartBLL.ReadList(base.UserId); cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList(); //关联的商品 int count = 0; int[] ids = cartList.Select(k => k.ProductId).ToArray(); var productList = ProductBLL.SearchList(1, ids.Length, new ProductSearchInfo { InProductId = string.Join(",", ids) }, ref count); decimal tmoney = 0; foreach (var tmpcart in cartList) { tmpcart.Product = productList.FirstOrDefault(k => k.Id == tmpcart.ProductId) ?? new ProductInfo(); if (tmpcart.Product.ClassId.IndexOf(theFavor.ClassIds) > -1) { if (!string.IsNullOrEmpty(tmpcart.StandardValueList)) { //使用规格的库存 var standardRecord = ProductTypeStandardRecordBLL.Read(tmpcart.ProductId, tmpcart.StandardValueList); tmpcart.LeftStorageCount = standardRecord.Storage - standardRecord.OrderCount; tmpcart.Price = ProductBLL.GetCurrentPrice(standardRecord.SalePrice, base.GradeID); tmoney += tmpcart.Price * tmpcart.BuyCount; } else { tmpcart.Price = ProductBLL.GetCurrentPrice(tmpcart.Product.SalePrice, base.GradeID); tmoney += tmpcart.Price * tmpcart.BuyCount; } } } switch (theFavor.ReduceWay) { case (int)FavorableMoney.Money: favorMoney += theFavor.ReduceMoney; break; case (int)FavorableMoney.Discount: favorMoney += tmoney * (100 - theFavor.ReduceDiscount) / 100; break; default: break; } ResponseHelper.Write("ok|" + Math.Round(favorMoney, 2)); } ResponseHelper.End(); }
public static string ReadUserPhoto(string size) { string str = CookiesHelper.ReadCookieValue("UserPhoto"); if (str == string.Empty) { return("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/Style/Images/NoImage.gif"); } return(str.Replace("Original", size)); }