private void BindColor() { int num = Globals.SafeInt(this.Id, 0); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); Maticsoft.Model.SNS.Products model = new Maticsoft.Model.SNS.Products(); model = products.GetModel((long) num); if (model != null) { this.hidValue.Value = model.Color; } }
protected void btnSave_Click(object sender, EventArgs e) { int num = Globals.SafeInt(this.Id, 0); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); Maticsoft.Model.SNS.Products model = new Maticsoft.Model.SNS.Products(); model = products.GetModel((long) num); if (model != null) { model.Color = this.hidValue.Value; products.Update(model); this.lblTip.Visible = true; LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "更新商品(ProductId=" + num + ")的颜色成功", this); } this.BindColor(); }
public ActionResult AjaxPostAdd(FormCollection Fm) { if (base.currentUser == null) { return base.Content("NoLogin"); } if (base.currentUser.UserType == "AA") { return base.Content("AA"); } bool flag = Globals.SafeBool(Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic"), false); string str = Fm["Type"]; string str2 = Fm["ImageUrl"]; string str3 = InjectionFilter.Filter(Fm["ShareDes"]); string str4 = Fm["VideoUrl"]; string str5 = Fm["PostExUrl"]; string str6 = Fm["AudioUrl"]; string productName = Fm["ProductName"]; int photoCateId = Globals.SafeInt(Fm["PhotoCateId"], 0); int ablumId = Globals.SafeInt(Fm["AblumId"], 0); long pid = Globals.SafeLong(Fm["Pid"], (long) 0L); string photoAddress = Fm["Address"]; string mapLng = Fm["MapLng"]; string mapLat = Fm["MapLat"]; base.PostsModel.Description = str3; base.PostsModel.CreatedDate = DateTime.Now; base.PostsModel.CreatedNickName = base.currentUser.NickName; base.PostsModel.CreatedUserID = base.currentUser.UserID; base.PostsModel.ImageUrl = str2; base.PostsModel.UserIP = base.Request.UserHostAddress; base.PostsModel.AudioUrl = str6; if (!string.IsNullOrWhiteSpace(base.PostsModel.ImageUrl) && (str != "Product")) { string savePath = "/Upload/SNS/Images/Photos/" + DateTime.Now.ToString("yyyyMMdd") + "/"; string saveThumbsPath = "/Upload/SNS/Images/PhotosThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/"; base.PostsModel.ImageUrl = Maticsoft.BLL.SNS.Photos.MoveImage(base.PostsModel.ImageUrl, savePath, saveThumbsPath); } if (str == "Product") { base.PostsModel.Type = 2; Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); if (products.Exsit(productName, base.currentUser.UserID)) { return base.Content("ProductRepeat"); } } else if (str == "Photo") { base.PostsModel.Type = 1; } else { base.PostsModel.Type = 0; if (!string.IsNullOrEmpty(str4) && !string.IsNullOrEmpty(str5)) { base.PostsModel.VideoUrl = str4; base.PostsModel.PostExUrl = str5; } } base.PostsModel.Status = 1; base.PostsModel = base.PostsBll.AddPost(base.PostsModel, ablumId, pid, photoCateId, photoAddress, mapLng, mapLat, true); base.PostsModel.Description = ViewModelBase.RegexNickName(base.PostsModel.Description); Maticsoft.ViewModel.SNS.Posts item = new Maticsoft.ViewModel.SNS.Posts(); if (!string.IsNullOrEmpty(base.PostsModel.ImageUrl) && (str != "Product")) { base.PostsModel.ImageUrl = base.PostsModel.ImageUrl.Split(new char[] { '|' })[0]; } if (base.PostsModel.Type == 2) { Maticsoft.Model.SNS.Products modelByCache = new Maticsoft.BLL.SNS.Products().GetModelByCache((long) base.PostsModel.TargetId); if (flag && (modelByCache != null)) { base.PostsModel.Description = (string) base.PostsModel.Description.Replace("{ProductUrl}", (dynamic) string.IsNullOrWhiteSpace(modelByCache.StaticUrl) ? ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + base.PostsModel.TargetId) : modelByCache.StaticUrl); } else { base.PostsModel.Description = (string) base.PostsModel.Description.Replace("{ProductUrl}", (((dynamic) base.ViewBag).BasePath + "Product/Detail/") + base.PostsModel.TargetId); } } item.Post = base.PostsModel; base.list.Add(item); return this.PartialView(base.CurrentThemeViewPath + "/UserProfile/LoadPostData.cshtml", base.list); }
public ActionResult AjaxGetProductInfo(string ProductLink) { Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); string text = ViewModelBase.RegexProductId(ProductLink); if (text == "No") { return base.Content("No"); } string productImageUrl = products.GetProductImageUrl(Globals.SafeLong(text, (long) 0L)); if (productImageUrl == "No") { return base.Content("No"); } return base.Content(text + "|" + productImageUrl); }
public ActionResult AjaxDelPost(FormCollection Fm) { int postID = Globals.SafeInt(Fm["PostId"], 0); Maticsoft.Model.SNS.Posts model = base.PostsBll.GetModel(postID); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); int result = 0; DataSet set = new DataSet(); int valueOrDefault = model.Type.GetValueOrDefault(); if (model.Type.HasValue) { switch (valueOrDefault) { case 0: if ((base.PostsBll.DeleteEx(postID, false, 1) && !string.IsNullOrWhiteSpace(model.ImageUrl)) && !model.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(model.ImageUrl); } goto Label_017A; case 1: set = photos.DeleteListEx(model.TargetId.ToString(), out result, false, 1); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_017A; case 2: set = products.DeleteListEx(model.TargetId.ToString(), out result, false, 1); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_017A; case 4: new Maticsoft.BLL.SNS.UserBlog().DeleteEx(model.TargetId); goto Label_017A; } } if ((base.PostsBll.DeleteEx(postID, false, 1) && !string.IsNullOrWhiteSpace(model.ImageUrl)) && !model.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(model.ImageUrl); } Label_017A: return base.Content(postID.ToString()); }
protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (!e.CommandArgument.Equals("Delete")) { return; } if ((e.CommandName == null) || (e.CommandName.ToString() == "")) { return; } int postID = Globals.SafeInt(e.CommandName, -1); Maticsoft.Model.SNS.Posts modelByCache = this.bll.GetModelByCache(postID); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); int result = 0; DataSet set = new DataSet(); int valueOrDefault = modelByCache.Type.GetValueOrDefault(); if (modelByCache.Type.HasValue) { switch (valueOrDefault) { case 0: if ((this.bll.DeleteEx(postID, true, base.CurrentUser.UserID) && !string.IsNullOrWhiteSpace(modelByCache.ImageUrl)) && !modelByCache.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(modelByCache.ImageUrl); } goto Label_01B3; case 1: set = photos.DeleteListEx(modelByCache.TargetId.ToString(), out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_01B3; case 2: set = products.DeleteListEx(modelByCache.TargetId.ToString(), out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_01B3; } } if ((this.bll.DeleteEx(postID, true, base.CurrentUser.UserID) && !string.IsNullOrWhiteSpace(modelByCache.ImageUrl)) && !modelByCache.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(modelByCache.ImageUrl); } Label_01B3: this.gridView.OnBind(); LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "删除动态(PostID=" + postID + ")成功", this); MessageBox.ShowSuccessTip(this, "删除成功!"); }
protected void btnDelete_Click(object sender, EventArgs e) { Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); if (this.GetSelIDlist().Trim().Length != 0) { int result = 0; int num2 = 0; string selIDTypelist = this.GetSelIDTypelist("1"); if (!string.IsNullOrEmpty(selIDTypelist) && (selIDTypelist.Length > 0)) { DataSet set = photos.DeleteListEx(selIDTypelist, out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除图片动态(ProductID=" + selIDTypelist + ")成功", this); } string str3 = this.GetSelIDTypelist("2"); if (!string.IsNullOrEmpty(str3) && (str3.Length > 0)) { DataSet set2 = products.DeleteListEx(str3, out num2, true, base.CurrentUser.UserID); if (set2 != null) { this.PhysicalFileInfo(set2.Tables[0]); } LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除商品动态(ProductID=" + str3 + ")成功", this); } string postIDs = this.GetSelIDTypelist("0"); bool flag = false; if (postIDs.Length > 0) { LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除文字动态(PostID=" + postIDs + ")成功", this); flag = this.bll.DeleteListByNormalPost(postIDs, true, base.CurrentUser.UserID); } if (((result == 1) || (num2 == 1)) || flag) { MessageBox.ShowSuccessTip(this, "删除成功!"); } else { MessageBox.ShowSuccessTip(this, "删除失败!"); } this.gridView.OnBind(); } }
public ActionResult WaterfallProductListData(string keyword, string type, int startIndex) { keyword = InjectionFilter.Filter(keyword); ProductCategory model = new ProductCategory(); ProductQuery query = new ProductQuery(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); query.Order = type; query.Keywords = keyword; query.CategoryID = -1; ((dynamic) base.ViewBag).BasePageSize = this._basePageSize; startIndex = (startIndex > 1) ? (startIndex + 1) : 0; int endIndex = (startIndex > 1) ? ((startIndex + this._waterfallDetailCount) - 1) : this._waterfallDetailCount; if (products.GetProductCount(query) < 1) { return new EmptyResult(); } model.ProductListWaterfall = products.GetProductByPage(query, startIndex, endIndex); string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic"); if ((model.ProductListWaterfall != null) && (model.ProductListWaterfall.Count > 0)) { foreach (Maticsoft.Model.SNS.Products products2 in model.ProductListWaterfall) { if (valueByCache != "true") { products2.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID); continue; } products2.StaticUrl = string.IsNullOrWhiteSpace(products2.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID)) : products2.StaticUrl; } } return base.View("ProductListWaterfall", model); }
public ActionResult Product(int pageIndex = 1) { ((dynamic) base.ViewBag).Title = "商品搜索"; string inputString = string.IsNullOrWhiteSpace(base.Request.Params["keyword"]) ? "" : base.Server.UrlDecode(base.Request.Params["keyword"]); string str2 = string.IsNullOrWhiteSpace(base.Request.Params["type"]) ? "hot" : base.Request.Params["type"]; inputString = InjectionFilter.Filter(inputString); this.LogKeyWord(inputString); ProductCategory model = new ProductCategory(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); ProductQuery query = new ProductQuery { Order = str2 }; ((dynamic) base.ViewBag).sequence = str2; query.Keywords = inputString; query.CategoryID = -1; int pageSize = this._basePageSize + this._waterfallSize; ((dynamic) base.ViewBag).BasePageSize = this._basePageSize; int startIndex = (pageIndex > 1) ? (((pageIndex - 1) * pageSize) + 1) : 0; int endIndex = (pageIndex > 1) ? ((startIndex + this._basePageSize) - 1) : this._basePageSize; int productCount = 0; ((dynamic) base.ViewBag).CurrentPageAjaxStartIndex = endIndex; ((dynamic) base.ViewBag).CurrentPageAjaxEndIndex = pageIndex * pageSize; query.QueryType = 0; productCount = products.GetProductCount(query); if (productCount >= 1) { query.QueryType = 1; model.ProductPagedList = products.GetProductByPage(query, startIndex, endIndex).ToPagedList<Maticsoft.Model.SNS.Products>(pageIndex, pageSize, new int?(productCount)); string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic"); if ((model.ProductPagedList != null) && (model.ProductPagedList.Count > 0)) { foreach (Maticsoft.Model.SNS.Products products2 in model.ProductPagedList) { if (valueByCache != "true") { products2.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID); continue; } products2.StaticUrl = string.IsNullOrWhiteSpace(products2.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID)) : products2.StaticUrl; } } if (base.Request.IsAjaxRequest()) { return this.PartialView("ProductList", model); } } return base.View(model); }
private List<string> ProductsPhysicalInfo(int ID) { List<Maticsoft.Model.SNS.Products> list = new Maticsoft.BLL.SNS.Products().UserUploadPhotoList(ID); if ((list != null) && (list.Count > 0)) { List<string> list2 = new List<string>(); foreach (Maticsoft.Model.SNS.Products products2 in list) { if (this.RegURL(products2.ProductUrl)) { list2.Add(base.Server.MapPath(products2.ProductUrl)); } if (this.RegURL(products2.ThumbImageUrl)) { list2.Add(base.Server.MapPath(products2.ThumbImageUrl)); } if (this.RegURL(products2.NormalImageUrl)) { list2.Add(base.Server.MapPath(products2.NormalImageUrl)); } } if (list2.Count > 0) { return list2; } } return null; }
public static string GetProductUrl(long productId) { Maticsoft.Model.SNS.Products model = new Maticsoft.BLL.SNS.Products().GetModel(productId); if (model != null) { return GetProductUrl(model); } return ""; }