コード例 #1
0
        //图文模块
        private void digg_photo_add(HttpContext context)
        {
            string channel_type = DTRequest.GetFormString("channel_type");
            string digg_type    = DTRequest.GetFormString("digg_type");
            int    id           = DTRequest.GetFormInt("id");

            BLL.photo bll = new BLL.photo();
            if (!bll.Exists(id))
            {
                context.Response.Write("{msg:0, msgbox:\"信息不存在或已删除!\"}");
                return;
            }
            if (digg_type == "good")
            {
                bll.UpdateField(id, "digg_good=digg_good+1");
            }
            else
            {
                bll.UpdateField(id, "digg_act=digg_act+1");
            }
            Model.photo model = bll.GetModel(id);
            context.Response.Write("{msg:1, digggood:" + model.digg_good + ", diggact:" + model.digg_act + ", msgbox:\"成功顶或踩了一下!\"}");
            Utils.WriteCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString(), id.ToString(), 8640);
            return;
        }
コード例 #2
0
        private void ShowInfo(int _id)
        {
            BLL.photo   bll   = new BLL.photo();
            Model.photo model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text   = model.title;
            txtPhotoNo.Text = model.photo_no;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            txtMarketPrice.Text    = model.market_price.ToString();
            txtSellPrice.Text      = model.sell_price.ToString();
            txtSortId.Text         = model.sort_id.ToString();
            txtClick.Text          = model.click.ToString();
            txtDiggGood.Text       = model.digg_good.ToString();
            txtDiggAct.Text        = model.digg_act.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.photo_albums, model.img_url);
            //赋值属性列表
            LitAttributeList.Text = GetAttributeHtml(model.photo_attribute_values, this.channel_id, _id);
        }
コード例 #3
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.photo bll = new BLL.photo();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
         return;
     }
     model = bll.GetModel(id);
     //浏览数+1
     bll.UpdateField(id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
         model.link_url = model.link_url.Trim();
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
 }
コード例 #4
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.photo bll = new BLL.photo();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
         return;
     }
     model = bll.GetModel(id);
     //浏览数+1
     bll.UpdateField(id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
     {
         model.link_url = model.link_url.Trim();
     }
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
 }
コード例 #5
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            DTcms.BLL.photo   bll   = new BLL.photo();
            DTcms.Model.photo model = bll.GetModel(_id);

            model.channel_id      = this.channel_id;
            model.title           = txtTitle.Text.Trim();
            model.category_id     = int.Parse(ddlCategoryId.SelectedValue);
            model.photo_no        = txtPhotoNo.Text.Trim();
            model.market_price    = decimal.Parse(txtMarketPrice.Text.Trim());
            model.sell_price      = decimal.Parse(txtSellPrice.Text.Trim());
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = focus_photo.Value;
            model.content         = txtContent.Value;
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.click           = int.Parse(txtClick.Text.Trim());
            model.is_msg          = 0;
            model.is_top          = 0;
            model.is_red          = 0;
            model.is_hot          = 0;
            model.is_slide        = 0;
            model.is_lock         = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //保存相册
            if (model.photo_albums != null)
            {
                model.photo_albums.Clear();
            }
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            if (albumArr != null)
            {
                List <Model.photo_album> ls = new List <Model.photo_album>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        ls.Add(new Model.photo_album {
                            id = img_id, photo_id = _id, big_img = imgArr[1], small_img = imgArr[2]
                        });
                    }
                }
                model.photo_albums = ls;
            }

            //扩展属性
            BLL.photo_attribute bll2 = new BLL.photo_attribute();
            DataSet             ds2  = bll2.GetList("channel_id=" + this.channel_id);

            List <Model.photo_attribute_value> attrls = new List <Model.photo_attribute_value>();

            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int    attr_id            = int.Parse(dr["id"].ToString());
                string attr_title         = dr["title"].ToString();
                string attr_value_id      = Request.Form["value_" + attr_id];
                string attr_value_content = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content))
                {
                    attrls.Add(new Model.photo_attribute_value {
                        id = Convert.ToInt32(attr_value_id), photo_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content
                    });
                }
            }
            model.photo_attribute_values = attrls;

            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }
コード例 #6
0
 //图文模块
 private void digg_photo_add(HttpContext context)
 {
     string channel_type = DTRequest.GetFormString("channel_type");
     string digg_type = DTRequest.GetFormString("digg_type");
     int id = DTRequest.GetFormInt("id");
     BLL.photo bll = new BLL.photo();
     if (!bll.Exists(id))
     {
         context.Response.Write("{msg:0, msgbox:\"信息不存在或已删除!\"}");
         return;
     }
     if (digg_type == "good")
     {
         bll.UpdateField(id, "digg_good=digg_good+1");
     }
     else
     {
         bll.UpdateField(id, "digg_act=digg_act+1");
     }
     Model.photo model = bll.GetModel(id);
     context.Response.Write("{msg:1, digggood:" + model.digg_good + ", diggact:" + model.digg_act + ", msgbox:\"成功顶或踩了一下!\"}");
     Utils.WriteCookie(DTKeys.COOKIE_DIGG_KEY, channel_type + id.ToString(), id.ToString(), 8640);
     return;
 }
コード例 #7
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.photo   bll   = new BLL.photo();
            Model.photo model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateField(id, "is_msg=1");
                }
                break;

            case "ibtntop":
                if (model.is_top == 1)
                {
                    bll.UpdateField(id, "is_top=0");
                }
                else
                {
                    bll.UpdateField(id, "is_top=1");
                }
                break;

            case "ibtnred":
                if (model.is_red == 1)
                {
                    bll.UpdateField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateField(id, "is_red=1");
                }
                break;

            case "ibtnhot":
                if (model.is_hot == 1)
                {
                    bll.UpdateField(id, "is_hot=0");
                }
                else
                {
                    bll.UpdateField(id, "is_hot=1");
                }
                break;

            case "ibtnslide":
                if (model.is_slide == 1)
                {
                    bll.UpdateField(id, "is_slide=0");
                }
                else
                {
                    bll.UpdateField(id, "is_slide=1");
                }
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
        }
コード例 #8
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     ChkAdminLevel(channel_id, ActionEnum.Edit.ToString()); //检查权限
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     BLL.photo bll = new BLL.photo();
     Model.photo model = bll.GetModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtnmsg":
             if (model.is_msg == 1)
                 bll.UpdateField(id, "is_msg=0");
             else
                 bll.UpdateField(id, "is_msg=1");
             break;
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateField(id, "is_top=0");
             else
                 bll.UpdateField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=1");
             break;
         case "ibtnhot":
             if (model.is_hot == 1)
                 bll.UpdateField(id, "is_hot=0");
             else
                 bll.UpdateField(id, "is_hot=1");
             break;
         case "ibtnslide":
             if (model.is_slide == 1)
                 bll.UpdateField(id, "is_slide=0");
             else
                 bll.UpdateField(id, "is_slide=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
 }
コード例 #9
0
        private void ShowInfo(int _id)
        {
            BLL.photo bll = new BLL.photo();
            Model.photo model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.title;
            txtPhotoNo.Text = model.photo_no;
            txtLinkUrl.Text = model.link_url;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            txtMarketPrice.Text = model.market_price.ToString();
            txtSellPrice.Text = model.sell_price.ToString();
            txtSortId.Text = model.sort_id.ToString();
            txtClick.Text = model.click.ToString();
            txtDiggGood.Text = model.digg_good.ToString();
            txtDiggAct.Text = model.digg_act.ToString();
            txtContent.Value = model.content;
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.photo_albums, model.img_url);
            //赋值属性列表
            LitAttributeList.Text = GetAttributeHtml(model.photo_attribute_values, this.channel_id, _id);
        }
コード例 #10
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            DTcms.BLL.photo bll = new BLL.photo();
            DTcms.Model.photo model = bll.GetModel(_id);

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.photo_no = txtPhotoNo.Text.Trim();
            model.market_price = decimal.Parse(txtMarketPrice.Text.Trim());
            model.sell_price = decimal.Parse(txtSellPrice.Text.Trim());
            model.link_url = txtLinkUrl.Text.Trim();
            model.img_url = focus_photo.Value;
            model.content = txtContent.Value;
            model.seo_title = txtSeoTitle.Text.Trim();
            model.seo_keywords = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.click = int.Parse(txtClick.Text.Trim());
            model.is_msg = 0;
            model.is_top = 0;
            model.is_red = 0;
            model.is_hot = 0;
            model.is_slide = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //保存相册
            if (model.photo_albums != null)
                model.photo_albums.Clear();
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            if (albumArr != null)
            {
                List<Model.photo_album> ls = new List<Model.photo_album>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        ls.Add(new Model.photo_album { id = img_id, photo_id = _id, big_img = imgArr[1], small_img = imgArr[2] });
                    }
                }
                model.photo_albums = ls;
            }

            //扩展属性
            BLL.photo_attribute bll2 = new BLL.photo_attribute();
            DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id);

            List<Model.photo_attribute_value> attrls = new List<Model.photo_attribute_value>();
            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int attr_id = int.Parse(dr["id"].ToString());
                string attr_title = dr["title"].ToString();
                string attr_value_id = Request.Form["value_" + attr_id];
                string attr_value_content = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content))
                {
                    attrls.Add(new Model.photo_attribute_value { id =  Convert.ToInt32(attr_value_id), photo_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content });
                }
            }
            model.photo_attribute_values = attrls;

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }