예제 #1
0
        /// <summary>
        /// 生成资讯文章的二维码
        /// </summary>
        /// <param name="pd"></param>
        /// <returns></returns>
        private string createArtQrCode(Song.Entities.Article na, string pathType, string template, int wh)
        {
            //二维码图片名称
            string img = "";

            //if (na != null && na.Art_QrCode != null && na.Art_QrCode != "")
            //{
            //    img = na.Art_QrCode;
            //}
            //else
            //{
            //    img = "NewsArt_" + WeiSha.Common.Request.UniqueId() + ".png";
            //    na.Art_QrCode = img;
            //    Business.Do<IContents>().ArticleSave(na);
            //}
            try
            {
                //创建二维码
                Song.Extend.QrCode.Creat4Entity(na, template, Upload.Get[pathType].Physics + img, wh);
                return(img);
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// 修改时间为最新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbCrtTime_Click(object sender, EventArgs e)
        {
            LinkButton ub    = (LinkButton)sender;
            int        index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int        id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());

            //
            Song.Entities.Article entity = Business.Do <IContents>().ArticleSingle(id);
            entity.Art_CrtTime = DateTime.Now;
            Business.Do <IContents>().ArticleSave(entity);
            BindData(null, null);
        }
예제 #3
0
        /// <summary>
        /// 当前新闻的下一条新闻
        /// </summary>
        /// <param name="identify"></param>
        /// <returns></returns>
        public Article ArticleNext(int identify, int orgid)
        {
            WhereClip wc = new WhereClip();

            if (orgid > 0)
            {
                wc &= Article._.Org_ID == orgid;
            }
            wc &= Article._.Art_IsShow == true;
            wc &= Article._.Art_PushTime < DateTime.Now;
            Song.Entities.Article art = this.ArticleSingle(identify);
            return(Gateway.Default.From <Article>().OrderBy(Article._.Art_PushTime.Desc)
                   .Where(wc && Article._.Art_PushTime < art.Art_PushTime).ToFirst <Article>());
        }
예제 #4
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     Song.Entities.Article mm = Business.Do <IContents>().ArticleSingle(id);
     if (mm == null)
     {
         return;
     }
     ltTitle.Text    = mm.Art_Title;
     ltAuthor.Text   = mm.Art_Author == "" ? "无" : mm.Art_Author;
     ltSource.Text   = mm.Art_Source == "" ? "无" : mm.Art_Source;
     ltCrtTime.Text  = ((DateTime)mm.Art_CrtTime).ToShortDateString();
     ltDetails.Text  = mm.Art_Details;
     ltKeyword.Text  = mm.Art_Keywords;
     artFoot.Visible = ltKeyword.Text.Trim() != "";
     //唯一标识
     ViewState["UID"] = mm.Art_Uid;
     //
     AccessoryBind();
 }
예제 #5
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         ltSource.Text = Business.Do <ISystemPara>()["NewsSourceItem"].String;
         Song.Entities.Article mm;
         if (id != 0)
         {
             mm = Business.Do <IContents>().ArticleSingle(id);
             cbIsHot.Checked = mm.Art_IsHot;
             //是否显示
             cbIsShow.Checked = mm.Art_IsShow;
             //是否置顶
             cbIsTop.Checked = mm.Art_IsTop;
             //是否推荐
             cbIsRec.Checked = mm.Art_IsRec;
             //栏目
             ListItem li = ddlColumn.Items.FindByValue(mm.Col_Id.ToString());
             if (li != null)
             {
                 li.Selected = true;
             }
             //唯一标识
             ViewState["UID"] = mm.Art_Uid;
             //作者
             tbAuthor.Text = Extend.LoginState.Admin.CurrentUser.Acc_Name;
             //专题
             Song.Entities.Special[] ns = Business.Do <IContents>().Article4Special(id);
             foreach (Song.Entities.Special n in ns)
             {
                 ListItem lis = cbSpecial.Items.FindByValue(n.Sp_Id.ToString());
                 if (lis != null)
                 {
                     lis.Selected = true;
                 }
             }
             //上线时间
             tbPushTime.Text = mm.Art_PushTime < DateTime.Now.AddYears(-100) ? DateTime.Now.ToString() : mm.Art_PushTime.ToString();
             AccessoryBind();
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Article();
             ViewState["UID"] = WeiSha.Common.Request.UniqueID();
             //分类
             ListItem li = ddlColumn.Items.FindByValue(colid.ToString());
             if (li != null)
             {
                 li.Selected = true;
             }
             //上线时间
             tbPushTime.Text = DateTime.Now.ToString();
         }
         //文章标题
         tbTitle.Text     = mm.Art_Title;
         tbTitleAbbr.Text = mm.Art_TitleAbbr;
         tbTitleFull.Text = mm.Art_TitleFull;
         //内容
         tbDetails.Text = mm.Art_Details;
         //简介
         tbIntro.Text = mm.Art_Intro;
         //关键字,descrtion,发布时间
         tbKeywords.Text = mm.Art_Keywords;
         tbDescr.Text    = mm.Art_Descr;
         //作者,来源,标签
         tbAuthor.Text = mm.Art_Author;
         tbSource.Text = mm.Art_Source;
         tbLabel.Text  = mm.Art_Label;
         //是否是图片新闻,是否是热点新闻
         cbIsImg.Checked = mm.Art_IsImg;
         fuImg.Visible   = this.panelImg.Visible = cbIsImg.Checked;
         imgFile.Src     = Upload.Get[_uppath].Virtual + mm.Art_Logo;
     }
     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)
 {
     Song.Entities.Article mm = null;
     try
     {
         if (id != 0)
         {
             mm = Business.Do <IContents>().ArticleSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Article();
             mm.Art_IsVerify = false;
         }
         //文章标题
         mm.Art_Title     = tbTitle.Text.Trim();
         mm.Art_TitleAbbr = tbTitleAbbr.Text.Trim();
         mm.Art_TitleFull = tbTitleFull.Text.Trim();
         //是否是图片新闻,是否是热点新闻
         mm.Art_IsImg = cbIsImg.Checked;
         mm.Art_IsHot = cbIsHot.Checked;
         //是否显示
         mm.Art_IsShow = cbIsShow.Checked;
         //是否置顶
         mm.Art_IsTop = cbIsTop.Checked;
         //是否推荐
         mm.Art_IsRec = cbIsRec.Checked;
         //所在栏目
         if (type == "article")
         {
             mm.Col_Id = -1;
         }
         else
         {
             mm.Col_Id = Convert.ToInt32(ddlColumn.SelectedItem.Value);
         }
         //内容
         mm.Art_Details = tbDetails.Text;
         //简介
         mm.Art_Intro = tbIntro.Text.Trim();
         //作者,来源,标签
         mm.Art_Author = tbAuthor.Text.Trim();
         mm.Art_Source = tbSource.Text.Trim();
         mm.Art_Label  = tbLabel.Text.Trim();
         //关键字
         mm.Art_Keywords = tbKeywords.Text.Trim();
         mm.Art_Descr    = tbDescr.Text.Trim();
         mm.Art_PushTime = Convert.ToDateTime(tbPushTime.Text);
         //员工id与名称
         EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
         mm.Acc_Id   = acc.Acc_Id;
         mm.Acc_Name = acc.Acc_Name;
         mm.Art_Uid  = this.getUID();
         //上传图片
         if (cbIsImg.Checked && fuImg.PostedFile.FileName != "")
         {
             try
             {
                 fuImg.UpPath       = _uppath;
                 fuImg.IsMakeSmall  = false;
                 fuImg.IsConvertJpg = true;
                 fuImg.SaveAndDeleteOld(mm.Art_Logo);
                 mm.Art_Logo = fuImg.File.Server.FileName;
                 imgFile.Src = Upload.Get[_uppath].Virtual + mm.Art_Logo;
             }
             catch (Exception ex)
             {
                 this.Alert(ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
     try
     {
         if (id != 0)
         {
             Business.Do <IContents>().ArticleSave(mm);
         }
         else
         {
             //如果是新增
             id = Business.Do <IContents>().ArticleAdd(mm);
         }
         //所属专题
         foreach (ListItem li in this.cbSpecial.Items)
         {
             int spid = Convert.ToInt32(li.Value);
             if (li.Selected == true)
             {
                 Business.Do <IContents>().SpecialAndArticle(spid, id);
             }
             else
             {
                 Business.Do <IContents>().SpecialAndArticleDel(spid, id);
             }
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Master.Alert(ex.Message);
     }
 }