コード例 #1
0
 /// <summary>
 /// 生成下载信息的二维码
 /// </summary>
 /// <param name="pd"></param>
 /// <returns></returns>
 private string createQrCode(Song.Entities.Download di)
 {
     try
     {
         //二维码图片名称
         string img = "";
         if (di != null && di.Dl_QrCode != null && di.Dl_QrCode != "")
         {
             img = di.Dl_QrCode;
         }
         else
         {
             img = "Di_" + WeiSha.Common.Request.UniqueID() + ".png";
         }
         //二维码的宽高
         int wh = Business.Do <ISystemPara>()["Download_QrCode_WidthAndHeight"].Int16 ?? 200;
         //二维码模板内容
         string template = Business.Do <ISystemPara>()["Download_QrCode_Template"].String;
         //创建二维码
         Song.Extend.QrCode.Creat4Entity(di, template, Upload.Get[type].Physics + img, wh);
         return(img);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
         return(null);
     }
 }
コード例 #2
0
 /// <summary>
 /// 生成下载信息二维码
 /// </summary>
 /// <param name="pd"></param>
 /// <returns></returns>
 private string createQrCode(Song.Entities.Download di, string pathType, string template, int wh)
 {
     try
     {
         //二维码图片名称
         string img = "";
         if (di != null && di.Dl_QrCode != null && di.Dl_QrCode != "")
         {
             img = di.Dl_QrCode;
         }
         else
         {
             img          = "Di_" + WeiSha.Common.Request.UniqueID() + ".png";
             di.Dl_QrCode = img;
             Business.Do <IContents>().DownloadSave(di);
         }
         //创建二维码
         Song.Extend.QrCode.Creat4Entity(di, template, Upload.Get[pathType].Physics + img, wh);
         return(img);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
         return(null);
     }
 }
コード例 #3
0
 public void DownloadDelete(int identify)
 {
     Song.Entities.Download entity = this.DownloadSingle(identify);
     if (entity == null)
     {
         return;
     }
     DownloadDelete(entity);
 }
コード例 #4
0
ファイル: Download.aspx.cs プロジェクト: zzti/LearningSystem
 /// <summary>
 /// 修改是否显示的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void sbShow_Click(object sender, EventArgs e)
 {
     try
     {
         StateButton ub    = (StateButton)sender;
         int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
         int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());
         //
         Song.Entities.Download entity = Business.Do <IContents>().DownloadSingle(id);
         entity.Dl_IsShow = !entity.Dl_IsShow;
         Business.Do <IContents>().DownloadSave(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
コード例 #5
0
        /// <summary>
        /// 设置初始界面
        /// </summary>
        private void fill()
        {
            try
            {
                Song.Entities.Download mm;
                if (id != 0)
                {
                    mm = Business.Do <IContents>().DownloadSingle(id);
                    //唯一标识
                    ViewState["UID"] = mm.Dl_Uid == null || mm.Dl_Uid.Length < 1 ? WeiSha.Common.Request.UniqueID() : mm.Dl_Uid;
                    //是否使用与显示,以及热点与置顶
                    cbIsRec.Checked  = mm.Dl_IsRec;
                    cbIsShow.Checked = mm.Dl_IsShow;
                    cbIsHot.Checked  = mm.Dl_IsHot;
                    cbIsTop.Checked  = mm.Dl_IsTop;
                    //更新时间
                    tbUpdateTime.Text = ((DateTime)mm.Dl_UpdateTime).ToString("yyyy-MM-dd");
                    //资源文件
                    hlSource.Text        = mm.Dl_FilePath;
                    hlSource.NavigateUrl = Upload.Get[type].Virtual + mm.Dl_FilePath;
                    //栏目
                    ListItem li = ddlSort.Items.FindByValue(mm.Col_Id.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                    //类型
                    ListItem liTy = ddlColumn.Items.FindByValue(mm.Dty_Id.ToString());
                    if (liTy != null)
                    {
                        liTy.Selected = true;
                    }
                    //适用系统
                    if (mm.Dl_OS != null && mm.Dl_OS.Length > 0)
                    {
                        foreach (string o in mm.Dl_OS.Split('/'))
                        {
                            ListItem lii = cblOS.Items.FindByText(o);
                            if (lii != null)
                            {
                                lii.Selected = true;
                            }
                        }
                    }
                    //发布时间
                    tbPushTime.Text = mm.Dl_PushTime.ToString();
                    //图片
                    //this.imgShow.Src = Upload.Get[type].Virtual + mm.Dl_Logo;
                    //二维码
                    this.imgQrCode.ImageUrl = Upload.Get[type].Virtual + mm.Dl_QrCode;
                }
                else
                {
                    //如果是新增
                    mm = new Song.Entities.Download();
                    ViewState["UID"] = WeiSha.Common.Request.UniqueID();
                    //更新时间
                    tbUpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
                    //上传控件必填属性
                    fuSource.Attributes.Add("nullable", "false");
                    //分类
                    ListItem li = ddlColumn.Items.FindByValue(colid.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }
                }
                tbName.Text = mm.Dl_Name;
                //版本号
                tbVersion.Text = mm.Dl_Version;
                //介绍
                this.tbIntro.Text = mm.Dl_Intro;
                tbDetails.Text    = mm.Dl_Details;
                //所有者
                tbAuthor.Text = mm.Dl_Author;
                //标签
                tbLabel.Text = mm.Dl_Label;

                //发布设置相关
                tbKeywords.Text = mm.Dl_Keywords;
                tbDescr.Text    = mm.Dl_Descr;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                Song.Entities.Download mm;
                if (id != 0)
                {
                    mm = Business.Do <IContents>().DownloadSingle(id);
                    //唯一标识
                    ViewState["UID"] = mm.Dl_Uid;
                }
                else
                {
                    //如果是新增
                    mm = new Song.Entities.Download();
                    ViewState["UID"] = WeiSha.Common.Request.UniqueID();
                }
                mm.Dl_Name = tbName.Text;
                //是否使用与显示,热点与置顶
                mm.Dl_IsRec  = cbIsRec.Checked;
                mm.Dl_IsShow = cbIsShow.Checked;
                mm.Dl_IsHot  = cbIsHot.Checked;
                mm.Dl_IsTop  = cbIsTop.Checked;
                //栏目
                mm.Col_Id   = Convert.ToInt32(ddlColumn.SelectedItem.Value);
                mm.Col_Name = ddlColumn.SelectedItem.Text;
                //类型
                mm.Dty_Id   = Convert.ToInt32(ddlSort.SelectedItem.Value);
                mm.Dty_Type = ddlSort.SelectedItem.Text;
                //版本号
                mm.Dl_Version = tbVersion.Text.Trim();
                //更新时间
                mm.Dl_UpdateTime = Convert.ToDateTime(tbUpdateTime.Text.Trim());
                //介绍
                mm.Dl_Intro = this.tbIntro.Text.Trim();
                //所有者
                mm.Dl_Author = tbAuthor.Text.Trim();
                //标签
                mm.Dl_Label = tbLabel.Text.Trim();
                //适用系统
                string ostr = "";
                foreach (ListItem li in cblOS.Items)
                {
                    if (li.Selected)
                    {
                        ostr += li.Text + "/";
                    }
                }
                if (ostr != "")
                {
                    ostr = ostr.Substring(0, ostr.Length - 1);
                }
                mm.Dl_OS = ostr;
                //资源
                if (this.fuSource.PostedFile.FileName != "")
                {
                    try
                    {
                        fuSource.UpPath       = type;
                        fuSource.IsConvertJpg = false;
                        fuSource.SaveAndDeleteOld(mm.Dl_FilePath);

                        mm.Dl_FilePath = fuSource.File.Server.FileName;
                        //imgShow.Src = fuSource.File.Server.VirtualPath; ;
                        mm.Dl_Size = (int)fuSource.File.Server.Size;
                    }
                    catch (Exception ex)
                    {
                        this.Alert(ex.Message);
                    }
                }
                //详细信息
                mm.Dl_Details = tbDetails.Text;
                //编辑人的信息
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                mm.Acc_Id   = acc.Acc_Id;
                mm.Acc_Name = acc.Acc_Name;
                //发布设置
                mm.Dl_Keywords = tbKeywords.Text;
                mm.Dl_Descr    = tbDescr.Text;
                mm.Dl_PushTime = tbPushTime.Text.Trim() != "" ? Convert.ToDateTime(tbPushTime.Text) : DateTime.Now;
                //唯一值
                mm.Dl_Uid = this.getUID();
                //确定操作
                if (id == 0)
                {
                    mm.Dl_CrtTime = DateTime.Now;
                    Business.Do <IContents>().DownloadAdd(mm);
                }
                else
                {
                    Business.Do <IContents>().DownloadSave(mm);
                }

                //生成二维码
                mm.Dl_QrCode = createQrCode(mm);
                //二维码
                this.imgQrCode.ImageUrl = Upload.Get[type].Virtual + mm.Dl_QrCode;
                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }