protected void Page_Load(object sender, EventArgs e) { ((Label)Master.FindControl("lblTitle")).Text = "View Video"; Photoid = QueryString.getQueryStringOnIndex(0); Userid = SessionClass.getUserId(); LoadFollow(); LoadDataListComments(); YouLikes(); string videotag = ""; MediaBO objMedia = new MediaBO(); objMedia = MediaBLL.getMediaByMediaId(Photoid); videotag += " <script type= 'text/javascript' >"; videotag += " jwplayer('container').setup({"; videotag += " file: src='" + Global.USER_VIDEO + objMedia.Id + ".mp4' ,"; videotag += " flashplayer: '../../Resources/jwplayer/player.swf',"; videotag += " width: 520"; videotag += " }); "; videotag += "</script> "; this.LiteralVideo.Text = videotag; imgBtnComments.ImageUrl = Global.PROFILE_PICTURE + Userid + ".jpg"; Session["SpamPhoto"] = null; Session["AbusePhoto"] = null; }
public string SavePhotos() { string albumId; if (Session["PhotoAlbumId"] == null) { MediaAlbumBO objAClass = new MediaAlbumBO(); objAClass.UserId = userid; objAClass.Name = "My Pictures"; objAClass.Type = Global.PHOTO; objAClass.isFollow = true; albumId = MediaAlbumBLL.insertDefaultAlbum(objAClass); } else { albumId = Session["PhotoAlbumId"].ToString(); } MediaBO objClass = new MediaBO(); objClass.UserId = userid; objClass.AlbumId = albumId; objClass.Caption = ""; objClass.Name = ""; objClass.Description = ""; objClass.AddedDate = DateTime.Now; objClass.Location = ""; objClass.Type = Global.PHOTO; objClass.isFollow = true; return(MediaBLL.insertMedia(objClass)); }
public string SavePhotos() { string albumId; MediaAlbumBO objAClass = new MediaAlbumBO(); objAClass.UserId = Userid; objAClass.Name = "Profile Pictures"; objAClass.Type = Global.PHOTO; objAClass.isFollow = true; albumId = MediaAlbumBLL.insertDefaultAlbum(objAClass); MediaBO objClass = new MediaBO(); objClass.UserId = Userid; objClass.AlbumId = albumId; objClass.Caption = ""; objClass.Name = ""; objClass.Description = ""; objClass.AddedDate = DateTime.Now; objClass.Location = ""; objClass.Type = Global.PHOTO; objClass.isFollow = true; return(MediaBLL.insertMedia(objClass)); }
public void GetPhotoDesc() { MediaBO mediaobj = new MediaBO(); mediaobj = MediaBLL.getMediaByMediaId(Photoid); LabelGetCaption.Text = mediaobj.Caption; LabelGetDesc.Text = mediaobj.Description; LabelGetLocation.Text = mediaobj.Location; imgBack.PostBackUrl = "ViewPhotoAlbum.aspx?" + mediaobj.AlbumId; }
public ActionResult Entrance() { ViewBag.cates = new ProductBLL().GetParentCates(); MediaBLL mediaBLL = new MediaBLL(); MediaObj mediaObj = mediaBLL.GetMedia(1); ViewBag.media1 = mediaObj; mediaObj = mediaBLL.GetMedia(2); ViewBag.media2 = mediaObj; mediaObj = mediaBLL.GetMedia(3); ViewBag.media3 = mediaObj; return(View()); }
protected void LoadFollow() { MediaBO obj = new MediaBO(); obj = MediaBLL.getMediaByMediaId(Photoid); Isfollow = obj.isFollow; if (Isfollow) { lbtnFollow.Text = "UnFollow"; } else { lbtnFollow.Text = "Follow"; } }
protected void lbtnFollow_Click(object sender, EventArgs e) { if (lbtnFollow.Text.Equals("Follow")) { MediaBO obj = new MediaBO(); obj.Id = Photoid; obj.isFollow = true; MediaBLL.updateFollow(obj); } else if (lbtnFollow.Text.Equals("UnFollow")) { MediaBO obj = new MediaBO(); obj.Id = Photoid; obj.isFollow = false; MediaBLL.updateFollow(obj); } LoadFollow(); }
public ActionResult Index() { int total; MediaBLL mediaBLL = new MediaBLL(); IDictionary <int, MediaObj> flash = new Dictionary <int, MediaObj>(); flash.Add(15, mediaBLL.GetMedia(15)); flash.Add(16, mediaBLL.GetMedia(16)); flash.Add(17, mediaBLL.GetMedia(17)); flash.Add(18, mediaBLL.GetMedia(18)); flash.Add(19, mediaBLL.GetMedia(19)); flash.Add(20, mediaBLL.GetMedia(20)); flash.Add(21, mediaBLL.GetMedia(21)); flash.Add(22, mediaBLL.GetMedia(22)); flash.Add(23, mediaBLL.GetMedia(23)); flash.Add(24, mediaBLL.GetMedia(24)); flash.Add(25, mediaBLL.GetMedia(25)); flash.Add(26, mediaBLL.GetMedia(26)); flash.Add(27, mediaBLL.GetMedia(27)); flash.Add(28, mediaBLL.GetMedia(28)); flash.Add(29, mediaBLL.GetMedia(29)); flash.Add(30, mediaBLL.GetMedia(30)); flash.Add(31, mediaBLL.GetMedia(31)); ViewBag.flash = flash; ProductBLL productBLL = new ProductBLL(); JsonArray cates = productBLL.GetProductCatesByParentID(0); ViewBag.cates = cates; ViewBag.cate1 = WriteProducts(productBLL.GetProducts((int)cates[0]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 3, out total)); ViewBag.cate2 = WriteProducts(productBLL.GetProducts((int)cates[1]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 2, out total)); ViewBag.cate3 = WriteProducts(productBLL.GetProducts((int)cates[2]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 6, out total)); ViewBag.cate4 = WriteProducts(productBLL.GetProducts((int)cates[3]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 6, out total)); ViewBag.cate5 = WriteProducts(productBLL.GetProducts((int)cates[4]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 6, out total)); ViewBag.cate6 = WriteProducts(productBLL.GetProducts((int)cates[5]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 6, out total)); ViewBag.cate7 = WriteProducts(productBLL.GetProducts((int)cates[6]["categoryID"], null, 0, 0, -1, -1, -1, -1, 1, 6, out total)); ViewBag.onSaleProducts = WriteProducts(productBLL.GetProducts(0, null, 0, 0, -1, 1, -1, -1, 1, 4, out total)); ViewBag.newProducts = WriteProducts(productBLL.GetProducts(0, null, 0, 0, 1, -1, -1, -1, 1, 3, out total)); return(View()); }
public ActionResult Index() { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 16)) { return(Redirect("/Manage/Error/2.html")); } MediaBLL mediaBLL = new MediaBLL(); MediaObj mediaObj = mediaBLL.GetMedia(1); ViewBag.media1 = mediaObj; mediaObj = mediaBLL.GetMedia(2); ViewBag.media2 = mediaObj; mediaObj = mediaBLL.GetMedia(3); ViewBag.media3 = mediaObj; mediaObj = mediaBLL.GetMedia(4); ViewBag.media4 = mediaObj; mediaObj = mediaBLL.GetMedia(5); ViewBag.media5 = mediaObj; mediaObj = mediaBLL.GetMedia(6); ViewBag.media6 = mediaObj; mediaObj = mediaBLL.GetMedia(7); ViewBag.media7 = mediaObj; mediaObj = mediaBLL.GetMedia(8); ViewBag.media8 = mediaObj; mediaObj = mediaBLL.GetMedia(9); ViewBag.media9 = mediaObj; mediaObj = mediaBLL.GetMedia(10); ViewBag.media10 = mediaObj; mediaObj = mediaBLL.GetMedia(11); ViewBag.media11 = mediaObj; mediaObj = mediaBLL.GetMedia(12); ViewBag.media12 = mediaObj; mediaObj = mediaBLL.GetMedia(13); ViewBag.media13 = mediaObj; mediaObj = mediaBLL.GetMedia(14); ViewBag.media14 = mediaObj; return(View()); }
protected void btnSave_Click(object sender, EventArgs e) { TextBox captionText = new TextBox(); TextBox locationText = new TextBox(); TextBox despText = new TextBox(); TextBox titleText = new TextBox(); GMDatePicker datep = new GMDatePicker(); string caption = null; string location = null; string desp = null; string title = null; string id = null; DateTime adddate; foreach (DataListItem dataItem in DataList1.Items) { captionText = (TextBox)dataItem.FindControl("txtCaption"); locationText = (TextBox)dataItem.FindControl("txtLocation"); despText = (TextBox)dataItem.FindControl("txtDescription"); titleText = (TextBox)dataItem.FindControl("txtName"); datep = (GMDatePicker)dataItem.FindControl("GMDatePicker1"); caption = captionText.Text.ToString().Trim(); location = locationText.Text.ToString().Trim(); desp = despText.Text.ToString().Trim(); title = titleText.Text.ToString().Trim(); adddate = datep.Date; string Id = ((HiddenField)dataItem.FindControl("HiddenField1")).Value; MediaBO objClass = new MediaBO(); objClass.Id = Id; objClass.Location = location; objClass.Caption = caption; objClass.Name = title; objClass.Description = desp; objClass.AddedDate = adddate; objClass.Type = Global.VIDEO; MediaBLL.updateEditVideoMedia(objClass); } LoadDataListMedia(); }
public ActionResult Index() { MediaBLL mediaBLL = new MediaBLL(); IDictionary <int, MediaObj> flash = new Dictionary <int, MediaObj>(); flash.Add(4, mediaBLL.GetMedia(4)); flash.Add(5, mediaBLL.GetMedia(5)); flash.Add(6, mediaBLL.GetMedia(6)); flash.Add(7, mediaBLL.GetMedia(7)); flash.Add(8, mediaBLL.GetMedia(8)); flash.Add(9, mediaBLL.GetMedia(9)); flash.Add(10, mediaBLL.GetMedia(10)); flash.Add(11, mediaBLL.GetMedia(11)); flash.Add(12, mediaBLL.GetMedia(12)); flash.Add(13, mediaBLL.GetMedia(13)); flash.Add(14, mediaBLL.GetMedia(14)); ViewBag.flash = flash; return(View()); }
public ActionResult Products() { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 17)) { return(Redirect("/Manage/Error/2.html")); } MediaBLL mediaBLL = new MediaBLL(); ViewBag.media15 = mediaBLL.GetMedia(15); ViewBag.media16 = mediaBLL.GetMedia(16); ViewBag.media17 = mediaBLL.GetMedia(17); ViewBag.media18 = mediaBLL.GetMedia(18); ViewBag.media19 = mediaBLL.GetMedia(19); ViewBag.media20 = mediaBLL.GetMedia(20); ViewBag.media21 = mediaBLL.GetMedia(21); ViewBag.media22 = mediaBLL.GetMedia(22); ViewBag.media23 = mediaBLL.GetMedia(23); ViewBag.media24 = mediaBLL.GetMedia(24); ViewBag.media25 = mediaBLL.GetMedia(25); ViewBag.media26 = mediaBLL.GetMedia(26); ViewBag.media27 = mediaBLL.GetMedia(27); ViewBag.media28 = mediaBLL.GetMedia(28); ViewBag.media29 = mediaBLL.GetMedia(29); ViewBag.media30 = mediaBLL.GetMedia(30); ViewBag.media31 = mediaBLL.GetMedia(31); ViewBag.media32 = mediaBLL.GetMedia(32); ViewBag.media33 = mediaBLL.GetMedia(33); ViewBag.media34 = mediaBLL.GetMedia(34); ViewBag.media35 = mediaBLL.GetMedia(35); return(View()); }
public ActionResult Test3() { string media_id = ""; AutoResponse item = wcApi.AutoResponseBLL.GetContentbyQuestion("劳动节"); string _token = CommonBLL.GetAccess_token(); var bgpath = AppDomain.CurrentDomain.BaseDirectory + item.RoomImgPath; bgpath = Server.MapPath(item.RoomImgPath); if (item.type == "image") { var x = MediaBLL.UploadMultimedia(_token, "image", bgpath); media_id = x; } ///获取临时素材 string path = HttpContext.Server.MapPath("~/img/"); MediaBLL.GetMultimedia(_token, media_id, path); FileStream fs = new FileStream(bgpath, FileMode.Open); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); fs.Dispose(); var x1 = MediaBLL.UploadMultimedia(_token, "image", "aa.jpg", data); media_id = x1; MediaBLL.GetMultimedia(_token, media_id, path); return(Content(media_id)); }
public void ProcessRequest(HttpContext context) { int MediaClassId = 0; string MediaScale = ""; int smallPiexl = 0; int WaterMark = 0; string WaterImagePath = ""; int waterPosition = 0; string MediaLabel = ""; string MediaDescript = ""; string MediaTitle = ""; MediaClassId = int.Parse(context.Request["MediaClassId"].ToString()); MediaScale = context.Request["MediaScale"].ToString(); smallPiexl = int.Parse(context.Request["smallPiexl"].ToString()); WaterMark = int.Parse(context.Request["WaterMark"].ToString()); WaterImagePath = context.Request["WaterImagePath"].ToString(); waterPosition = int.Parse(context.Request["waterPosition"].ToString()); if (!string.IsNullOrEmpty(context.Request["MediaLabel"])) { MediaLabel = context.Request["MediaLabel"].ToString(); } if (!string.IsNullOrEmpty(context.Request["MediaLabel"])) { MediaLabel = context.Request["MediaLabel"].ToString(); } if (!string.IsNullOrEmpty(context.Request["MediaDescript"])) { MediaDescript = context.Request["MediaDescript"].ToString(); } if (!string.IsNullOrEmpty(context.Request["MediaTitle"])) { MediaTitle = context.Request["MediaTitle"].ToString(); } context.Response.ContentType = "text/plain"; HttpPostedFile file = context.Request.Files["Filedata"];//接受文件 string fileExt = file.FileName.Substring(file.FileName.LastIndexOf(".") + 1); if (!FileHelper.CheckFileExt(this.fileType, fileExt)) { context.Response.Write("不允许上传" + fileExt + "类型的文件"); } if (this.fileSize > 0 && file.ContentLength > fileSize * 1024) { context.Response.Write("文件超过限制的大小啦"); } MediaSize = file.ContentLength / 1024; filename = DateTime.Now.ToString("ddHHmmssfff") + Path.GetExtension(file.FileName); localPath = HttpContext.Current.Request.PhysicalApplicationPath + ("upimg/" + DateTime.Now.ToString("yyyyMM") + "/"); //判断文件夹是否存在, 不存在则创建 if (!System.IO.Directory.Exists(localPath)) { System.IO.Directory.CreateDirectory(localPath); } try { //本地创建上传的图片文件 file.SaveAs(Path.Combine(localPath, filename)); } catch (Exception) { strfile = "Error"; } string path = "/upimg/" + DateTime.Now.ToString("yyyyMM") + "/" + filename; byte[] Data = new byte[1]; Data = FileHelper.AddImageSignPic(File.ReadAllBytes(localPath + filename), path, WaterImagePath, waterPosition, waterQuality, waterTransparency, WaterMark); //读取本地图片, 转成二进制, 调用服务生成图片, 返回路径另上域名 if (FileServer.CreateFileImage(Data, path)) { strfile = "http://img.stock.com" + path; } else { strfile = "Error"; } //判断文件是否存在, 存在则删除 // if (File.Exists(localPath + filename)) // File.Delete(localPath + filename); Media Media = new Media(); MediaBLL MediaBLL = Factory.BusinessFactory.CreateBll <MediaBLL>(); if (!string.IsNullOrEmpty(path)) { Media.MediaClassId = MediaClassId; Media.MediaTitle = MediaTitle; Media.UploadTime = DateTime.Now; Media.UploadPath = path; Media.MediaSize = MediaSize; Media.MediaType = 1; Media.Uploader = UserCookies.AdminName; Media.MediaLabel = MediaLabel; Media.MediaDescript = MediaDescript; MediaBLL.Add(Media).ToString(); } context.Response.Write("/upimg/" + DateTime.Now.ToString("yyyyMM") + "/" + filename); }
public ActionResult Cates(string id) { int cateID; int startPage; if (id.IndexOf('_') == -1) { cateID = int.Parse(id); startPage = 1; } else { string[] strId = id.Split('_'); cateID = int.Parse(strId[0]); startPage = int.Parse(strId[1]); } ViewBag.page = startPage; MediaBLL mediaBLL = new MediaBLL(); IDictionary <int, MediaObj> flash = new Dictionary <int, MediaObj>(); flash.Add(32, mediaBLL.GetMedia(32)); flash.Add(33, mediaBLL.GetMedia(33)); flash.Add(34, mediaBLL.GetMedia(34)); flash.Add(35, mediaBLL.GetMedia(35)); ViewBag.flash = flash; ProductBLL productBLL = new ProductBLL(); IList <ProductCateObj> productCateList = new List <ProductCateObj>(); ProductCateObj productCateObj = productBLL.GetProductCateByCateID(cateID); ViewBag.cates = productCateObj; while (productCateObj != null) { productCateObj = productBLL.GetProductCateByCateID(productCateObj.ParentID); if (productCateObj == null) { break; } else { productCateList.Add(productCateObj); } } StringBuilder sb = new StringBuilder(); for (int i = productCateList.Count - 1; i >= 0; i--) { sb.Append(">") .Append("<a href='/list/") .Append(productCateList[i].CategoryID) .Append(".html'>") .Append(productCateList[i].CategoryName) .Append("</a>"); } ViewBag.current = new MvcHtmlString(sb.ToString()); ViewBag.allCates = productBLL.GetProductCates(); Validation vld = new Validation(false); int sort = vld.GetInt("sort"); string price = vld.Get("price"); decimal priceFrom = 0; decimal priceTo = 0; if (!string.IsNullOrEmpty(price)) { string[] p = price.Split('-'); priceFrom = decimal.Parse(p[0]); priceTo = decimal.Parse(p[1]); } string sortField; bool isAsc; switch (sort) { case 1: sortField = "Price"; isAsc = true; break; case 2: sortField = "ProductID"; isAsc = false; break; case 4: sortField = "SellNum"; isAsc = false; break; case 5: sortField = "Price"; isAsc = false; break; default: sortField = "Products.Sort"; isAsc = false; break; } ViewBag.sort = sort; ViewBag.price = price; int pageSize = 24; int total; ViewBag.data = productBLL.GetProducts(cateID, null, priceFrom, priceTo, -1, -1, -1, -1, startPage, pageSize, out total, 1, sortField, isAsc); ViewBag.pageSize = pageSize; ViewBag.total = total; ViewBag.totalPages = total % pageSize == 0 ? total / pageSize : (total / pageSize + 1); int totalRecommends; ViewBag.recommends = productBLL.GetProducts(0, null, 0, 0, -1, -1, 1, -1, 1, 10, out totalRecommends); ViewBag.onSaleProducts = WriteProducts(productBLL.GetProducts(0, null, 0, 0, -1, 1, -1, -1, 1, 5, out total)); ViewBag.newProducts = WriteProducts(productBLL.GetProducts(0, null, 0, 0, 1, -1, -1, -1, 1, 20, out total), 5); return(View()); }
/// <summary> /// 测试函数 /// </summary> /// <returns></returns> public ActionResult Test() { /// hui_open id "oVWwA044l4_gH37FSmlyqvF04LX0" /// feng_open_id "oVWwA0x8AB3fkTdokUxBflTkVIZk" string openid = "oVWwA044l4_gH37FSmlyqvF04LX0"; string token = CommonBLL.GetAccess_token(); UserInfo user = UserBLL.GetUserDetail(token, openid); UserInfo us = UserBLL.GetUserInfo(user.openid); if (us != null) { us.count = us.count + 1; UserBLL.ModifyUsers(us); } else { UserBLL.SaveUsers(user); } //DataSet ds = DbHelperSQL.Query("select * from UserInfo where openid='" + openid + "'"); //if (ds.Tables[0].Rows.Count > 0) //{ // UserBLL.UpdateUser(new UserInfo() { openid = openid, count = int.Parse(ds.Tables[0].Rows[0]["count"].ToString()) + 1 }); //} //else //{ // UserBLL.AddUser(new UserInfo() { openid = openid,count=0}); //} ///头像流 string touxiangUrl = user.headimgurl; Stream mstouxiang = UserBLL.GetTouxiang(touxiangUrl); ///二维码流 string ticket = QrcodeBLL.Get_QR_STR_SCENE_Qrcode(token, openid); Stream mserweima = QrcodeBLL.GetQrcodeStream(ticket); ///背景图片流 var bgpath = AppDomain.CurrentDomain.BaseDirectory + "\\img\\" + "backGroudImd.jpg"; FileStream fs = new FileStream(bgpath, FileMode.Open); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); fs.Dispose(); MemoryStream ms = new MemoryStream(data); ///合成图片 var outsteam = ImgCom.ImgCommon.AddWaterPic(ms, mstouxiang, mserweima, "张辉", "测试内容就是这样"); ///上传图片 string media_id = MediaBLL.UploadMultimedia(token, "image", "hui.jpg", outsteam); ///获取临时素材 string path = HttpContext.Server.MapPath("~/img/"); MediaBLL.GetMultimedia(token, media_id, path); return(Content(media_id)); }
protected void DeleteLinkButton_Click(object sender, EventArgs e) { MediaBLL.deleteMedia(Photoid); Response.Redirect("Photos.aspx"); }
/// <summary> /// sssss /// </summary> /// <returns></returns> public ActionResult Index() { #region 微信验证URL // 微信加密签名 string signature = Request["SIGNATURE"]; // 时间戮 string timestamp = Request["TIMESTAMP"]; // 随机数 string nonce = Request["NONCE"]; // 随机字符串 string echostr = Request["echostr"]; if (!string.IsNullOrWhiteSpace(signature) && !string.IsNullOrWhiteSpace(timestamp) && !string.IsNullOrWhiteSpace(nonce) && !string.IsNullOrWhiteSpace(echostr)) { var re = WXMethdBLL.CheckURL(signature, timestamp, nonce, echostr); return(Content(re)); } #endregion else { string _token = CommonBLL.GetAccess_token(); StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8); string text = sr.ReadToEnd(); if (!string.IsNullOrEmpty(text)) { string resStr = ""; var eventmodel = WXMethdBLL.CreateMessage(text); if (eventmodel == null) { return(Content("")); } //关注事件 if (eventmodel is SubscribeEvent) { SubscribeEvent model = eventmodel as SubscribeEvent; var fromUser = UserBLL.GetUserInfo(eventmodel.FromUserName); if (fromUser == null) { #region 第一次关注 fromUser = UserBLL.GetUserDetail(_token, eventmodel.FromUserName); fromUser.count = 0; UserBLL.SaveUsers(fromUser); if (!string.IsNullOrWhiteSpace(model.EventKey)) { model.EventKey = model.EventKey.Substring(model.EventKey.IndexOf("_") + 1); var arr = model.EventKey.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); string toUserOpenid = arr[0]; string key = arr[1]; var user = UserBLL.SaveUserShareCount(toUserOpenid, key); //根据不同的活动添加/更新数据 var count = user.count; #region 生成分享活动不同生成不同的回复 string remarkvalue = CommonBLL.CreateSendFromMSG(key, count, fromUser); #endregion string content = CommonBLL.SendKeFuMsg(toUserOpenid, remarkvalue); } #endregion } resStr = WXMethdBLL.ResponseMsg(new Modal.WeiXinRequest.ContentRequest() { FromUserName = model.ToUserName, ToUserName = model.FromUserName, Content = @"欢迎你,家长朋友。 我们是一帮小学教育工作者, 工作之余, 在这里分享教育心得。 领取提示: 热门资料,点击底部菜单获取 其它资料,回复相应关键词获取" }); return(Content(resStr)); } //点击事件生成返回二维码 else if (eventmodel is Modal.WeiXinEvent.ClickEvent) { #region 点击button生成二维码 Modal.WeiXinEvent.ClickEvent model = eventmodel as Modal.WeiXinEvent.ClickEvent; var fromUser = UserBLL.GetUserInfo(eventmodel.FromUserName); if (fromUser == null) { fromUser = UserBLL.GetUserDetail(_token, eventmodel.FromUserName); fromUser.count = 0; UserBLL.SaveUsers(fromUser); } CommonBLL.SendWaitPicMsg(model, fromUser); if (model.EventKey == "huodong1") { int count = UserBLL.FinishShareCount("huodong1"); var setHongdong1Count = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["huodong1"]); if (count >= setHongdong1Count) { resStr = WXMethdBLL.ResponseMsg(new Modal.WeiXinRequest.ContentRequest() { FromUserName = model.ToUserName, ToUserName = model.FromUserName, Content = @"对不起,亲爱的; 1000套0元包邮【一、二年级语文期末复习资料】已经被抢光了。如果您还需要,请留言给我们,超过100人留言,教研室就加印哦。 心急的家长,也可以进入如下地址原价下单。https://weidian.com/?userid=880432647" }); return(Content(resStr)); } } var ticket = QrcodeBLL.Get_QR_STR_SCENE_Qrcode(_token, model.FromUserName + "#" + model.EventKey); var QrStream = QrcodeBLL.GetQrcodeStream(ticket); var touxiangStream = UserBLL.GetTouxiang(fromUser.headimgurl); byte[] bg = null; if (model.EventKey == "huodong1") { bg = ImgCom.ImgCommon.AddWaterPic(ImgCom.ImgCommon.GetBGImgMemoryStream(model.EventKey), touxiangStream, QrStream, "huodong1", null, ""); } else { bg = ImgCom.ImgCommon.AddWaterPic(ImgCom.ImgCommon.GetBGImgMemoryStream(model.EventKey), touxiangStream, QrStream, null, null, "我领取了"); } var x = MediaBLL.UploadMultimedia(_token, "image", model.ToUserName + ".jpg", bg); resStr = WXMethdBLL.ResponseMsg(new Modal.WeiXinRequest.ImageReuquest() { FromUserName = model.ToUserName, ToUserName = model.FromUserName, MediaId = x }); return(Content(resStr)); #endregion } //接受消息 else if (eventmodel is Modal.WeiXinEvent.TextMessage) { #region 接收消息处理 Modal.WeiXinEvent.TextMessage model = eventmodel as Modal.WeiXinEvent.TextMessage; string content = ""; //获取后台添加的问答消息 AutoResponse item = wcApi.AutoResponseBLL.GetContentbyQuestion(model.Content); if (item != null && item.type == "text") { content = item.ReplyContent; resStr = WXMethdBLL.ResponseMsg(new Modal.WeiXinRequest.ContentRequest() { FromUserName = model.ToUserName, ToUserName = model.FromUserName, Content = content }); } else if (item != null && item.type == "image") { var x_bgpath = Server.MapPath(item.RoomImgPath); FileStream fs = new FileStream(x_bgpath, FileMode.Open); byte[] x_data = new byte[fs.Length]; fs.Read(x_data, 0, x_data.Length); fs.Close(); fs.Dispose(); var x = MediaBLL.UploadMultimedia(_token, "image", model.ToUserName + ".jpg", x_data); resStr = WXMethdBLL.ResponseMsg(new Modal.WeiXinRequest.ImageReuquest() { FromUserName = model.ToUserName, ToUserName = model.FromUserName, MediaId = x }); } else { resStr = ""; } return(Content(resStr)); #endregion } } return(Content("")); } }
public ActionResult Upload() { ViewBag.success = false; if (!AppData.IsManagerLogin) { ViewBag.msg = "抱歉,您未登录后台或会话已过期!"; return(View()); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1601)) { ViewBag.msg = "您没有执行该操作的权限!"; return(View()); } HttpPostedFileBase pic = Request.Files.Count == 0 ? null : Request.Files[0]; int mediaID = string.IsNullOrEmpty(Request.Form["id"]) ? 0 : int.Parse(Request.Form["id"]); if (pic != null && !string.IsNullOrEmpty(pic.FileName)) { int type = string.IsNullOrEmpty(Request.Form["type"]) ? 0 : int.Parse(Request.Form["type"]); string ext = Path.GetExtension(pic.FileName); if (type == 0) { if (!Regex.IsMatch(ext, @"^\.(gif|jpg|jpeg|png)$", RegexOptions.IgnoreCase)) { ViewBag.msg = "上传的图片格式不合要求,请上传gif,png,jpg格式的图片"; return(View()); } } else if (type == 1) { if (!Regex.IsMatch(ext, @"^\.(mp3|wma)$", RegexOptions.IgnoreCase)) { ViewBag.msg = "上传的图片格式不合要求,请上传mp3,wma格式的文件"; return(View()); } } string dirPath = Config.MediaPath + @"\Media"; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } MediaBLL mediaBLL = new MediaBLL(); MediaObj mediaObj = mediaBLL.GetMedia(mediaID); if (mediaObj != null) { System.IO.File.Delete(Config.MediaPath + mediaObj.SavePath); } else { mediaObj = new MediaObj(); mediaObj.MediaID = mediaID; } string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff") + ext; string savePath = Path.Combine(dirPath, newFileName); mediaObj.SavePath = @"\Media\" + newFileName; mediaObj.Src = "/Media/" + newFileName; mediaObj.Description = Request.Form["desc"]; mediaObj.Url = Request.Form["url"]; mediaObj.Content = Request.Form["content"]; mediaBLL.SetMedia(mediaObj); pic.SaveAs(savePath); ViewBag.success = true; return(View()); } else if (mediaID != 0) { MediaBLL mediaBLL = new MediaBLL(); MediaObj mediaObj = mediaBLL.GetMedia(mediaID); mediaObj.Description = Request.Form["desc"]; mediaObj.Url = Request.Form["url"]; mediaObj.Content = Request.Form["content"]; mediaBLL.SetMedia(mediaObj); ViewBag.success = true; return(View()); } else { ViewBag.msg = "请您选择一张图片上传"; return(View()); } }
protected void LoadDataListMedia() { DataList1.DataSource = MediaBLL.getMediaTop5(Userid, Global.PHOTO, Albumid); DataList1.DataBind(); }
protected void LoadDataListMedia() { DataList1.DataSource = MediaBLL.getMediaTop5(Userid, Global.VIDEO); DataList1.DataBind(); }
protected void LoadDataListMedia() { DataList1.DataSource = MediaBLL.getMediaByAlbum(Albumid); DataList1.DataBind(); }