protected void Page_Load(object sender, EventArgs e) { Id = Request.QueryString["id"].ToString(); var active = ActiveHelper.GetItem(Convert.ToInt32(Id)); SellerId = active.SellerId.ToString(); }
private void GetItem(HttpContext context) { int aid = GetInt("newid"); var item = ActiveHelper.GetItem(aid); if (item == null) { ReturnErrorMsg("不存在该活动"); return; } var data = new { newid = item.Id, title = item.Title, img = Utility.GetSizePicUrl(item.CoverImgUrl, 540, 400, context), summary = item.Summary, descrition = item.Description, dateline = item.CreateTime.GetUnixTime(), Views = item.Views, Commentnum = item.Commentnum }; item.Views++; ActiveHelper.Update(item); JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", data); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void GetItem() { int aid = GetInt("id"); var item = ActiveHelper.GetItem(aid); if (item == null) { ReturnErrorMsg("资讯不存在:id" + aid); return; } var coupon = CouponHelper.GetItem(item.CouponId); var data = new { Id = item.Id, SellerId = item.SellerId, CouponId = item.CouponId, CouponTitle = coupon.Title, Summary = item.Summary, Title = item.Title, Views = item.Views, Commentnum = item.Commentnum, ImgId = item.CoverImgId, ImgUrl = item.CoverImgUrl == "" ? "http://placehold.it/128x128" : item.CoverImgUrl, CreateTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Description = item.Description }; JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", data); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void BindList() { if (this.rptsuppliercouponlist != null) { rptsuppliercouponlist.DataSource = ActiveHelper.GetThisTopicList(); rptsuppliercouponlist.DataBind(); } }
private void Delete() { var ids = Utility.GetListint(GetString("ids")); foreach (var id in ids) { ActiveHelper.Delete(id); } }
private void ActiveComment(HttpContext context) { int aid = GetInt("newid"); int uid = GetInt("uid"); var user = AccountHelper.GetUser(uid); string msg = GetString("message"); var active = ActiveHelper.GetItem(aid); Comment c = new Comment(); c.SellerId = active.SellerId; c.TypeId = active.Id; c.UserId = uid; c.Content = msg; c.Type = CommentType.Avtive; //冗余两个字段 c.Img = active.CoverImgUrl; c.Title = active.Title; try { CommentHelper.Create(c); active.Commentnum += 1; ActiveHelper.Update(active); } catch { ReturnErrorMsg("fail"); throw; } ExtcreditLog log = new ExtcreditLog(); var merchantExtend = SystemHelper.GetMerchantExtend(user.SellerId); if (!ExtcreditLogHelper.JudgeExtcreditGet(ExtcreditSourceType.CommentActive, aid, uid)) { //积分获得 log.UserId = uid; log.SellerId = user.SellerId; log.SourceId = aid; log.Extcredit = merchantExtend != null ? merchantExtend.CommentIntegral : 0; log.Type = ExtcreditSourceType.CommentActive; log.CreateTime = DateTime.Now; ExtcreditLogHelper.AddExtcreditLog(log); user.Integral += log.Extcredit; AccountHelper.SaveAccount(user); } //ReturnCorrectMsg("评论成功"); JsonTransfer jt = new JsonTransfer(); jt.Add("data", new IntegralData(log.Extcredit)); jt.AddSuccessParam(); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void Create() { var active = new Active(); active.SellerId = GetInt("sellerid"); active.CouponId = GetInt("ticket_id"); active.Title = GetString("title"); active.CoverImgUrl = GetString("thumbnail"); active.Description = GetString("content"); var text = GetString("text"); active.Summary = text.Length > 20 ? text.Substring(0, 20) : text; //active.Summary = active.Description.Length > 20 ? active.Description.Substring(0, 20) : active.Description; active.CreateTime = DateTime.Now; ActiveHelper.Create(active); }
private void UpdateData() { var id = GetInt("id"); var active = ActiveHelper.GetItem(id); active.CouponId = GetInt("ticket_id"); active.Title = GetString("Title"); active.CoverImgUrl = GetString("thumbnail"); active.Description = GetString("content"); var text = GetString("text"); active.Summary = text.Length > 20 ? text.Substring(0, 20) : text; //active.Summary = active.Description.Length > 20 ? active.Description.Substring(0, 20) : active.Description; ActiveHelper.Update(active); }
protected void BindSearch() { ProductBrowseQuery productBrowseQuery = this.GetCurrProductBrowseQuery(); if (this.serach_text != null) { this.serach_text.Value = productBrowseQuery.Keywords; } if (search_Subtext != null) { search_Subtext.Value = productBrowseQuery.SubKeywords; } var browseProductList = ActiveHelper.GetCurrActiveOneProductList(productBrowseQuery);// ProductBrowser.GetCurrBrowseProductList(productBrowseQuery); this.rptProducts.DataSource = browseProductList.Data; this.rptProducts.DataBind(); }
public void GetList(HttpContext context) { int index = GetInt("start"); int size = GetInt("limit"); int sid = GetInt("sellerid"); var merchant = MerchantHelper.GetMerchant(sid); var results = ActiveHelper.GetPagings(sid, index * size, size); var data = new List <object>(); foreach (var r in results.Results) { string url = string.Empty; if (merchant.MerType == MerchantTypes.Night) { url = Utility.GetSizePicUrl(r.CoverImgUrl, 450, 190, context); } else { url = Utility.GetSizePicUrl(r.CoverImgUrl, 180, 143, context); } var d = new { newid = r.Id, title = r.Title, img = Utility.GetPhoneNeedUrl(url), dateline = r.CreateTime.GetUnixTime(), summary = r.Summary, descrition = r.Description, Views = r.Views, Commentnum = r.Commentnum }; data.Add(d); } JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", data); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
private void ActiveCommentList(HttpContext context) { int aid = GetInt("newid"); int index = GetInt("start"); int size = GetInt("limit"); var active = ActiveHelper.GetItem(aid); var cms = CommentHelper.GetPagings(active.SellerId, CommentType.Avtive, aid, index * size, size); var users = new List <Account>(); if (cms.Results.Count != 0) { users = AccountHelper.GetUserList(cms.Results.Select(c => c.UserId).ToList()).ToList(); } var data = new CommentsForApis(); foreach (var cm in cms.Results) { var user = users.FirstOrDefault(u => u.Id == cm.UserId); if (user == null) { throw new ArgumentNullException(string.Format("userId:{0}", cm.UserId)); } var result = new ComentsForApi { Avatar = Utility.GetSizePicUrl(user.Avatar, 100, 100, context), UserName = user.UserName, Sex = (int)user.Sex, Dateline = cm.CreateTime.GetUnixTime(), Message = cm.Content }; data.Comments.Add(result); } data.Commentnum = cms.TotalCount; JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", data); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
public void GetList() { int index = GetInt("start"); int size = GetInt("limit"); int sid = GetInt("sellerid"); var data = ActiveHelper.GetPagings(sid, index * size, size); var result = new PagResults <object>(); result.TotalCount = data.TotalCount; foreach (var item in data.Results) { var o = new { Id = item.Id, SellerId = item.SellerId, Summary = item.Summary, Title = item.Title, Views = item.Views, Commentnum = item.Commentnum, ImgId = item.CoverImgId, HasCoupon = item.CouponId != 0, ImgUrl = item.CoverImgUrl == "" ? "http://placehold.it/128x128" : item.CoverImgUrl, CreateTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Description = item.Description }; result.Results.Add(o); } JsonTransfer jt = new JsonTransfer(); jt.AddSuccessParam(); jt.Add("data", result); Response.Write(DesEncrypt(jt).ToLower()); Response.End(); }
static void Main(string[] args) { var sss = BasicActive.BasicActiveIntance(); sss.UserName = "******"; sss.Password = "******"; sss.BrokerUri = "tcp://192.168.65.133:61616"; sss.TopicName = "hhhh"; //var aaaa = ActiveHelper.ActiveHelperInstance(sss); //for (int j = 0; j < 1000; j++) //{ // aaaa.SendMsg("hello-world"); //} List <Task> tasks = new List <Task>(); Task.Run(() => { for (int i = 0; i < 10; i++) { int j = i; //Task.Run(() => //{ try { //lock (lll) //{ int k = j; sss.TopicName = $"Test{k}"; var aaaa = ActiveHelper.ActiveHelperInstance(sss); aaaa.ReceiveMsg(msg => { Console.WriteLine($"{((Apache.NMS.ITextMessage)msg).Text}"); }); //aaaa.ReceiveMsg(msg => { Console.WriteLine($"{((Apache.NMS.ITextMessage)msg).Text}"); }); } //} catch (Exception ex) { Console.WriteLine(ex.ToString()); //throw; } //}); } }); //Task.Run(()=> { // for (int i = 0; i < 10; i++) // { // //Task.Run(()=> { // try // { // sss.TopicName = $"Test{++i}"; // var aaaa = ActiveHelper.ActiveHelperInstance(sss); // for (int j = 0; j < 10; j++) // { // aaaa.SendMsg($"hello-world"); // } // } // catch (Exception ex) // { // Console.WriteLine(ex.ToString()); // //throw; // } // //}); // } //}); //Task.WaitAll(tasks.ToArray()); //try //{ //} //catch (AggregateException ex) //{ // foreach (var item in ex.InnerExceptions) // { // Console.WriteLine(item.Message); // } //} //Task.Run(() => { // for (int i = 0; i < 10; i++) // { // try // { // sss.UserName = $"{i}"; // var aaaa = ActiveHelper.ActiveHelperInstance(sss); // aaaa.ReceiveMsg(msg => { Console.WriteLine($"{((Apache.NMS.ITextMessage)msg).Text}"); }); // } // catch (Exception ex) // { // //throw; // } // } //}); //for (int i = 0; i < 100; i++) //{ // sss.UserName = $"{i}"; // var aaaa = ActiveHelper.ActiveHelperInstance(sss); // Task.Run(() => // { // try // { // aaaa.ReceiveMsg(msg => { Console.WriteLine($"{((Apache.NMS.ITextMessage)msg).Text}"); }); // } // catch (Exception ex) // { // throw; // } // }); //} //for (int i = 0; i < 1000; i++) //{ // Task.Run(() => // { // try // { // var aaaa = ActiveHelper.ActiveHelperInstance(sss); // //for (int j = 0; j < 10; j++) // //{ // aaaa.SendMsg("hello-world"); // //} // } // catch (Exception ex) // { // throw; // } // } // ); //} //Task.Run(() => //{ // try // { // //sss.Password = "******"; // var aaaa = ActiveHelper.ActiveHelperInstance(sss); // aaaa.ReceiveMsg(msg => { Console.WriteLine($"{msg.ToString()}"); }); // } // catch (Exception ex) // { // throw; // } //}); Console.ReadKey(); }