protected void BTN_Add_Click(object sender, EventArgs e) { if (CheckNull()) { SiteInfo info = new SiteInfo(TB_SiteName.Text.Trim(), TB_SiteUrl.Text.Trim()); adsSiteDal.AddSite(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEINFO); Response.Redirect("AddSite.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["istongji"])) { CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); string nick = Request.QueryString["nick"]; string session = Request.QueryString["session"]; if (Request.Cookies["nick"] == null) { IList <TaoBaoGoodsClassInfo> classList = TopAPI.GetGoodsClassInfoList(nick, session); if (classList != null) { TaoBaoGoodsClassService tbgcDal = new TaoBaoGoodsClassService(); foreach (TaoBaoGoodsClassInfo cinfo in classList) { tbgcDal.InsertGoodsClass(cinfo, nick); } } GoodsService goodsDal = new GoodsService(); IList <TaoBaoGoodsInfo> list = TopAPI.GetGoodsInfoListByNick(nick, session); foreach (TaoBaoGoodsInfo info in list) { goodsDal.InsertGoodsInfo(info, nick); } } HttpCookie cookie = new HttpCookie("nick", HttpUtility.UrlEncode(nick)); HttpCookie cooksession = new HttpCookie("nicksession", session); cookie.Expires = DateTime.Now.AddDays(1); cooksession.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); LogInfo.Add("添加了cookie", nick); Session["snick"] = nick; Session["ssession"] = session; Response.Cookies.Add(cooksession); HttpCookie tongji = new HttpCookie("istongji", Request.QueryString["istongji"]); tongji.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(tongji); Response.Redirect("http://www.7fshop.com/top/index.html"); } } }
protected void BTN_Up_Click(object sender, EventArgs e) { if (CheckNull()) { SiteInfo info = new SiteInfo(TB_SiteName.Text.Trim(), TB_SiteUrl.Text.Trim()); info.SiteId = new Guid(ViewState["siteid"].ToString()); adsSiteDal.UpdateSite(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEINFO); Response.Redirect("AddSite.aspx"); } }
protected void BTN_Up_Click(object sender, EventArgs e) { if (CheckNull()) { AdsInfo info = new AdsInfo(); info.AdsId = new Guid(ViewState["adsid"].ToString()); info.AdsName = TB_AdsName.Text.Trim(); info.AdsSize = TB_AdsSize.Text.Trim(); info.AdsType = int.Parse(DDL_AdsType.SelectedValue); adsSiteDal.UpdateAds(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO); Response.Redirect("AddAds.aspx?siteid=" + Request.QueryString["siteid"]); } }
protected void BTN_Up_Click(object sender, EventArgs e) { SiteAdsInfo info = new SiteAdsInfo(); info.Id = new Guid(ViewState["siteadsId"].ToString()); info.AdsId = new Guid(DDL_AdsList.SelectedValue); info.SiteId = new Guid(DDL_SiteList.SelectedValue); info.AdsPosition = TB_AdsName.Text.Trim(); info.AdsCount = int.Parse(TB_Count.Text.Trim()); info.AdsCalCount = info.AdsCount; info.PositionCode = int.Parse(TB_PostCode.Text.Trim()); new SiteAdsService().UpdateAds(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEADS); Response.Redirect("AddAds.aspx?siteid=" + (string.IsNullOrEmpty(Request.QueryString["siteid"]) ? DDL_SiteList.SelectedValue : Request.QueryString["siteid"])); }
/// <summary> /// 插入session /// </summary> private void InsertSession() { TopNickSessionInfo info = new TopNickSessionInfo(); info.Nick = nick; info.Session = top_session; info.NickState = true; DateTime now = DateTime.Now; info.JoinDate = now; info.LastGetOrderTime = now; info.ShopId = shopId; info.ServiceId = Enum.TopTaoBaoService.YingXiaoJueCe; info.RefreshToken = refreshToken; //有则不添加 if (CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList().Count == 0) { //先添加后删除缓存 new NickSessionService().InsertSerssionNew(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLNICKSESSIONINFO); } else { //新session赋值 CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList()[0].Session = top_session; } //修改缓存后读取店铺信息 //info.ShopId = TaoBaoAPI.GetShopInfo(nick, top_session); //更新店铺信息 //new NickSessionService().UpdateSession(info); //更新缓存 //CacheCollection.GetNickSessionList().Where(o => o.Nick == nick && o.ServiceId == Enum.TopTaoBaoService.YingXiaoJueCe).ToList()[0].ShopId = info.ShopId; HttpCookie cookie = new HttpCookie("nick", HttpUtility.UrlEncode(nick)); HttpCookie cooksession = new HttpCookie("nicksession", top_session); HttpCookie cookietongji = new HttpCookie("istongji", "1"); cookie.Expires = DateTime.Now.AddDays(1); cooksession.Expires = DateTime.Now.AddDays(1); cookietongji.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); Response.Cookies.Add(cooksession); Response.Cookies.Add(cookietongji); }
protected void BTN_Add_Click(object sender, EventArgs e) { if (CheckNull()) { if (DDL_SiteList.SelectedValue != Guid.Empty.ToString()) { AdsInfo info = new AdsInfo(new Guid(DDL_SiteList.SelectedValue), TB_AdsName.Text.Trim(), TB_AdsSize.Text.Trim()); info.AdsType = int.Parse(DDL_AdsType.SelectedValue); FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.AdsId + ".jpg"); info.AdsPic = "/adsimg/" + info.AdsId + ".jpg"; adsSiteDal.AddAds(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO); Response.Redirect("AddAds.aspx?siteid=" + info.SiteId); } } }
protected override void InitializeCulture() { string msg = "尊敬的用户您好,非常抱歉的告诉您,您尚未订购该功能,如需继续使用请购买该服务:<br><br>9元/月 <a href=' http://fuwu.taobao.com/item/subsc.htm?items=service-0-22762-6:1;' target='_blank'>立即购买</a><br>"; if (!string.IsNullOrEmpty(Request.QueryString["nick"]) && !string.IsNullOrEmpty(Request.QueryString["nicksession"]) && !string.IsNullOrEmpty(Request.QueryString["mobile"])) { HttpCookie cookie = new HttpCookie("nick", HttpUtility.UrlEncode(Request.QueryString["nick"])); cookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookie); HttpCookie cookieSe = new HttpCookie("nicksession", Request.QueryString["nicksession"]); cookieSe.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookieSe); HttpCookie cookieM = new HttpCookie("mobile", Request.QueryString["nicksession"]); cookieM.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(cookieM); TeteShopService tss = new TeteShopService(); if (CacheCollection.GetNickSessionList().Where(o => o.Short == Request.QueryString["nick"]).ToList().Count == 0) { TeteShopInfo info = new TeteShopInfo(); info.Nick = Encrypt(Request.QueryString["nick"]); info.Session = Request.QueryString["nicksession"]; info.Short = Request.QueryString["nick"]; info.Adddate = DateTime.Now; info.Appkey = "12132145"; info.Appsecret = "1fdd2aadd5e2ac2909db2967cbb71e7f"; tss.InsertShop(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLNICKSESSIONINFO); } } else { if (Request.Cookies["nick"] == null || Request.Cookies["nicksession"] == null || Request.Cookies["mobile"] == null) { Response.Redirect("http://www.7fshop.com/top/market/buy.aspx?msg=" + msg); } } //else //{ // Session["nick"] = Request.Cookies["nick"].Value; // Session["session"] = Request.Cookies["nicksession"].Value; //} }
protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Up") { AdsInfo info = adsSiteDal.SelectAdsInfo(new Guid(e.CommandArgument.ToString())); TB_AdsName.Text = info.AdsName; TB_AdsSize.Text = info.AdsSize; DDL_AdsType.SelectedValue = info.AdsType.ToString(); ViewState["adsid"] = info.AdsId.ToString(); BTN_Up.Visible = true; BTN_Add.Visible = false; } if (e.CommandName == "De") { adsSiteDal.DeleteAds(new Guid(e.CommandArgument.ToString())); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO); Response.Redirect("AddAds.aspx?siteid=" + Request.QueryString["siteid"]); } }
protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Up") { SiteAdsInfo info = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id == new Guid(e.CommandArgument.ToString())).ToList()[0]; TB_AdsName.Text = info.AdsPosition; DDL_AdsList.SelectedValue = info.AdsId.ToString(); TB_PostCode.Text = info.PositionCode.ToString(); TB_Count.Text = info.AdsCount.ToString(); BTN_Up.Visible = true; BTN_Add.Visible = false; ViewState["siteadsId"] = info.Id; } if (e.CommandName == "De") { adsSiteDal.DeleteAds(new Guid(e.CommandArgument.ToString())); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO); Response.Redirect("AddAds.aspx?siteid=" + (string.IsNullOrEmpty(Request.QueryString["siteid"]) ? DDL_SiteList.SelectedValue : Request.QueryString["siteid"])); } }
protected void BTN_Add_Click(object sender, EventArgs e) { if (DDL_SiteList.SelectedValue != Guid.Empty.ToString()) { SiteAdsInfo info = new SiteAdsInfo(); info.AdsId = new Guid(DDL_AdsList.SelectedValue); info.SiteId = new Guid(DDL_SiteList.SelectedValue); info.AdsPosition = TB_AdsName.Text.Trim(); info.AdsCount = int.Parse(TB_Count.Text.Trim()); info.AdsCalCount = info.AdsCount; info.PositionCode = int.Parse(TB_PostCode.Text.Trim()); info.Id = Guid.NewGuid(); FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.Id + ".jpg"); info.AdsPic = "/adsimg/" + info.Id + ".jpg"; new SiteAdsService().InsertSiteAds(info); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEADS); Response.Redirect("AddAds.aspx?siteid=" + info.SiteId); } }
/// <summary> /// 当没有版本号传入的时候获取客户版本号 /// </summary> /// <returns></returns> private string GetVersion(string u) { string appkey = "21093339"; string secret = "c1c22ba85fb91bd20279213ef7b9ee80"; //判断该店铺是B店还是C店 IDictionary <string, string> param = new Dictionary <string, string>(); string sql = string.Empty; //判断短信购买及充值情况 param.Add("nick", u); param.Add("article_code", "ts-1800709"); string resultnew = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.vas.subscribe.get", "", param); if (resultnew.IndexOf("invali") != -1) { //到期了 return("-1"); } else { Regex reg = new Regex(@"<item_code>([^<]*)</item_code><deadline>([^<]*)</deadline>", RegexOptions.IgnoreCase); string guid = ""; string deadline = ""; //更新日期 MatchCollection match = reg.Matches(resultnew); for (int i = 0; i < match.Count; i++) { try { //10元 if (match[i].Groups[1].ToString() == "ts-1800709-1") { guid = "28F46E17-3117-44E7-847F-79D0BB0BEF69"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-1800709-2") { guid = "C7FCB728-C736-4AF5-935B-14AB24AE37AA"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-1800709-3") { guid = "DB6964D2-A4CB-47C8-B97C-1EB4EC056B56"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-1800709-4") { guid = "F021E717-4ED7-49D7-9289-2B62D2F6119D"; deadline = match[i].Groups[2].ToString(); } if (match[i].Groups[1].ToString() == "ts-1800709-5") { guid = "8A76231A-3874-4CE0-912F-936BCBC1907A"; deadline = match[i].Groups[2].ToString(); } if (match[i].Groups[1].ToString() == "ts-1800709-6") { guid = "2D966333-D046-45FD-B1AF-EDD5E26E4A47"; deadline = match[i].Groups[2].ToString(); } } catch { } } if (guid.Length != 0) { sql = "SELECT * FROM [BangT_Buys] WHERE nick = '" + u + "'"; DataTable dingdt = utils.ExecuteDataTable(sql); //UPDATE BangT_UsedInfo SET UsedTimes=0 WHERE nick=@nick if (dingdt.Rows.Count > 0) { if (new Guid(dingdt.Rows[0]["FeeId"].ToString()) != new Guid(guid)) { sql = "UPDATE BangT_UserAds SET feeid='" + guid + "' WHERE nick='" + u + "' AND UserAdsState<>0"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "',FeeId='" + guid + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } //update xufei sql = "SELECT * FROM BangT_Buys WHERE nick = '" + u + "' AND isexpied = 1"; //string count1 = utils.ExecuteString(sql); DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { if (new Guid(dt.Rows[0]["FeeId"].ToString()) != new Guid(guid)) { sql = "UPDATE BangT_UserAds SET feeid='" + guid + "' WHERE nick='" + u + "' AND UserAdsState<>0"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "',FeeId='" + guid + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } //判断淘宝获取的到期日期跟数据库里日期是否一致 if (dt.Rows[0]["ExpiedTime"] != DBNull.Value) { if (deadline != DateTime.Parse(dt.Rows[0]["ExpiedTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")) { sql = "UPDATE BangT_UsedInfo SET UsedTimes=0 WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } } } } else { //插入 sql = "INSERT INTO BangT_Buys ([Nick],[FeeId],[BuyTime],[IsExpied],ExpiedTime) VALUES ('" + u + "','" + guid + "',GETDATE(),0,'" + deadline + "')"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } } } File.WriteAllText(Server.MapPath("customer/" + u + ".txt"), Request.Url + "?" + Request.QueryString + sql + resultnew); return("2"); }
/// <summary> /// 当没有版本号传入的时候获取客户版本号 /// </summary> /// <returns></returns> private string GetVersion(string u) { string appkey = "12450498"; string secret = "38c892fcaa5a971aec7a9effd105c7ba"; //判断该店铺是B店还是C店 IDictionary <string, string> param = new Dictionary <string, string>(); string sql = string.Empty; //判断短信购买及充值情况 param.Add("nick", u); param.Add("article_code", "ts-22635"); string resultnew = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.vas.subscribe.get", "", param); if (resultnew.IndexOf("invali") != -1) { //到期了 return("-1"); } else { Regex reg = new Regex(@"<item_code>([^<]*)</item_code><deadline>([^<]*)</deadline>", RegexOptions.IgnoreCase); string guid = ""; string deadline = ""; //更新日期 MatchCollection match = reg.Matches(resultnew); for (int i = 0; i < match.Count; i++) { try { //10元 if (match[i].Groups[1].ToString() == "ts-22635-1") { guid = "20FE4A6B-E05D-448A-A514-384B10D1DBF9"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-22635-2") { guid = "42D45910-C56C-4B1A-AB7F-107945178787"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-22635-3") { guid = "04B04022-D2D1-4C1F-BB7C-0DF238EC009E"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-22635-4") { guid = "3D8CF413-7778-4421-A748-6294B18C8685"; deadline = match[i].Groups[2].ToString(); } if (match[i].Groups[1].ToString() == "ts-22635-5") { guid = "6970A0F4-AF47-495A-8E88-AFB5F6AB906E"; deadline = match[i].Groups[2].ToString(); } if (match[i].Groups[1].ToString() == "ts-22635-6") { guid = "216C8ADF-79DF-4602-9683-CC3157DE3F7A"; deadline = match[i].Groups[2].ToString(); } //10元 if (match[i].Groups[1].ToString() == "ts-22635-7") { guid = "C89032C1-B56E-4CC2-9DCF-449001C26FCD"; deadline = match[i].Groups[2].ToString(); } if (match[i].Groups[1].ToString() == "ts-22635-8") { guid = "D747589D-EE31-4F92-A93A-F4CC4A4F8CD6"; deadline = match[i].Groups[2].ToString(); } } catch { } } if (guid.Length != 0) { sql = "SELECT * FROM [BangT_Buys] WHERE nick = '" + u + "'"; DataTable dingdt = utils.ExecuteDataTable(sql); //UPDATE BangT_UsedInfo SET UsedTimes=0 WHERE nick=@nick if (dingdt.Rows.Count > 0) { if (new Guid(dingdt.Rows[0]["FeeId"].ToString()) != new Guid(guid)) { sql = "UPDATE BangT_UserAds SET feeid='" + guid + "' WHERE nick='" + u + "' AND UserAdsState<>0"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "',FeeId='" + guid + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } //update xufei sql = "SELECT * FROM BangT_Buys WHERE nick = '" + u + "' AND isexpied = 1"; //string count1 = utils.ExecuteString(sql); DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { if (new Guid(dt.Rows[0]["FeeId"].ToString()) != new Guid(guid)) { sql = "UPDATE BangT_UserAds SET feeid='" + guid + "' WHERE nick='" + u + "' AND UserAdsState<>0"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "',FeeId='" + guid + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } //判断淘宝获取的到期日期跟数据库里日期是否一致 if (dt.Rows[0]["ExpiedTime"] != DBNull.Value) { if (deadline != DateTime.Parse(dt.Rows[0]["ExpiedTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")) { sql = "UPDATE BangT_UsedInfo SET UsedTimes=0 WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); sql = "UPDATE BangT_Buys SET isexpied=0,buytime=GETDATE(),ExpiedTime = '" + deadline + "' WHERE nick='" + u + "'"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } } } } else { //插入 sql = "INSERT INTO BangT_Buys ([Nick],[FeeId],[BuyTime],[IsExpied],ExpiedTime) VALUES ('" + u + "','" + guid + "',GETDATE(),0,'" + deadline + "')"; utils.ExecuteNonQuery(sql); CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLBUYNINFO); } } } File.WriteAllText(Server.MapPath("customer/" + u + ".txt"), Request.Url + "?" + Request.QueryString + sql + resultnew); return("2"); }