private string createSpecQrCode(Song.Entities.Special ns, string pathType, string template, int wh) { try { //二维码图片名称 string img = ""; if (ns != null && ns.Sp_QrCode != null && ns.Sp_QrCode != "") { img = ns.Sp_QrCode; } else { img = "NewsSpec_" + WeiSha.Common.Request.UniqueID() + ".png"; ns.Sp_QrCode = img; Business.Do <IContents>().SpecialSave(ns); } //创建二维码 Song.Extend.QrCode.Creat4Entity(ns, template, Upload.Get[pathType].Physics + img, wh); return(img); } catch (Exception ex) { Message.ExceptionShow(ex); return(null); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { Song.Entities.Special mm = null; try { if (id != 0) { mm = Business.Do <IContents>().SpecialSingle(id); } else { //如果是新增 mm = new Song.Entities.Special(); } //专题名称 mm.Sp_Name = tbName.Text.Trim(); //是否显示,是否显示,是否外部连接 mm.Sp_IsUse = cbIsUse.Checked; mm.Sp_IsShow = cbIsShow.Checked; mm.Sp_IsOut = cbIsOut.Checked; //外部链接地址 mm.Sp_OutUrl = tbOutUrl.Text; //说明,简介,标签 mm.Sp_Tootip = this.tbTootip.Text.Trim(); mm.Sp_Intro = tbIntro.Text.Trim(); mm.Sp_Label = tbLabel.Text.Trim(); //详情 tbDetails.Text = mm.Sp_Details; //发布设置:关键字,destion,发布时间 mm.Sp_Keywords = tbKeywords.Text.Trim(); mm.Sp_Descr = tbDescr.Text.Trim(); //Uid mm.Sp_Uid = getUID(); //生成二维码 mm.Sp_QrCode = createQrCode(mm); } catch (Exception ex) { Message.ExceptionShow(ex); } try { if (id != 0) { Business.Do <IContents>().SpecialSave(mm); } else { //如果是新增 Business.Do <IContents>().SpecialAdd(mm); } //二维码 this.imgQrCode.ImageUrl = Upload.Get[type].Virtual + mm.Sp_QrCode; Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Master.Alert(ex.Message); } }
/// <summary> /// 生成资讯专题的二维码 /// </summary> /// <param name="pd"></param> /// <returns></returns> private string createQrCode(Song.Entities.Special ns) { try { //二维码图片名称 string img = ""; if (ns != null && ns.Sp_QrCode != null && ns.Sp_QrCode != "") { img = ns.Sp_QrCode; } else { img = "Spec_" + WeiSha.Common.Request.UniqueID() + ".png"; } //二维码的宽高 int wh = Business.Do <ISystemPara>()["NewsSpec_QrCode_WidthAndHeight"].Int16 ?? 200; //二维码模板内容 string template = Business.Do <ISystemPara>()["NewsSpec_QrCode_Template"].String; //创建二维码 Song.Extend.QrCode.Creat4Entity(ns, template, Upload.Get[type].Physics + img, wh); return(img); } catch (Exception ex) { Message.ExceptionShow(ex); return(null); } }
/// <summary> /// 修改是否使用的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbUse_Click(object sender, EventArgs e) { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); // Song.Entities.Special entity = Business.Do <IContents>().SpecialSingle(id); entity.Sp_IsUse = !entity.Sp_IsUse; Business.Do <IContents>().SpecialSave(entity); BindData(null, null); }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { Song.Entities.Special mm = Business.Do <IContents>().SpecialSingle(id); if (mm != null) { lbName.Text = mm.Sp_Name; } } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { Song.Entities.Special mm; if (id != 0) { mm = Business.Do <IContents>().SpecialSingle(id); //唯一标识 ViewState["UID"] = mm.Sp_Uid == null || mm.Sp_Uid.Length < 1 ? WeiSha.Common.Request.UniqueID() : mm.Sp_Uid; //是否显示,是否显示,是否外部连接 cbIsUse.Checked = mm.Sp_IsUse; cbIsShow.Checked = mm.Sp_IsShow; cbIsOut.Checked = mm.Sp_IsOut; //二维码 this.imgQrCode.ImageUrl = Upload.Get[type].Virtual + mm.Sp_QrCode; //上线时间 tbPushTime.Text = mm.Sp_PushTime.ToString(); } else { //如果是新增 mm = new Song.Entities.Special(); ViewState["UID"] = WeiSha.Common.Request.UniqueID(); //上线时间 tbPushTime.Text = DateTime.Now.ToString(); } //专题名称 tbName.Text = mm.Sp_Name; //外部链接地址 tbOutUrl.Text = mm.Sp_OutUrl; //说明,简介,标签 this.tbTootip.Text = mm.Sp_Tootip; tbIntro.Text = mm.Sp_Intro; tbLabel.Text = mm.Sp_Label; //详情 tbDetails.Text = mm.Sp_Details; //发布设置:关键字,destion,发布时间 tbKeywords.Text = mm.Sp_Keywords; tbDescr.Text = mm.Sp_Descr; } catch (Exception ex) { Message.ExceptionShow(ex); } }