Example #1
0
        /// <summary>
        /// 获得幻灯片列表二:优点:(1)使用function标签与foreach结合,可以从模版页面控制记录数量;(2)不需要实现注册到模版里
        /// </summary>
        /// <returns></returns>
        public IList <Model.wx_shop_indexbanner> getHdp()
        {
            Tag tag = this.Document.CurrentRenderingTag;

            var attribute = tag.Attributes["rows"];
            IList <Model.wx_shop_indexbanner> artlist = new List <Model.wx_shop_indexbanner>();

            int rows = -1;//若为-1,则不做限制条件

            if (attribute != null && MyCommFun.isNumber(attribute.Value.GetValue()))
            {
                rows = MyCommFun.Obj2Int(attribute.Value.GetValue());
            }
            MxWeiXinPF.DAL.wx_shop_indexbanner sibDal = new DAL.wx_shop_indexbanner();
            artlist = sibDal.GetHDPByWid(wid, rows);

            if (artlist != null && artlist.Count > 0)
            {
                Model.wx_shop_indexbanner cat = new Model.wx_shop_indexbanner();
                for (int i = 0; i < artlist.Count; i++)
                {
                    cat = artlist[i];

                    if (cat.bannerLinkUrl == null || cat.bannerLinkUrl.Trim() == "")
                    {  //如果link_url为空,则直接调用本系统的信息
                        cat.bannerLinkUrl = "javascript:;";
                    }
                    else
                    {
                        cat.bannerLinkUrl = MyCommFun.urlAddOpenid(cat.bannerLinkUrl, openid);
                    }
                }
            }
            return(artlist);
        }
Example #2
0
        /// <summary>
        /// 取幻灯片信息
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="topNum">取前几条数据,若为-1,则取全部的数据</param>
        public IList <Model.wx_shop_indexbanner> GetHDPByWid(int wid, int topNum)
        {
            IList <Model.wx_shop_indexbanner> hdpList = new List <Model.wx_shop_indexbanner>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ");
            if (topNum >= 0)
            {
                strSql.Append(" top " + topNum + " ");
            }
            strSql.Append(" * from wx_shop_indexbanner  ");
            strSql.Append(" where wid=@wid order by sort_id asc,id asc");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid", SqlDbType.Int, 4)
            };
            parameters[0].Value = wid;
            SqlDataReader sr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters);

            Model.wx_shop_indexbanner hdp = new Model.wx_shop_indexbanner();
            while (sr.Read())
            {
                hdp               = new Model.wx_shop_indexbanner();
                hdp.id            = MyCommFun.Obj2Int(sr["id"]);
                hdp.bannerName    = MyCommFun.ObjToStr(sr["bannerName"]);
                hdp.bannerPicUrl  = MyCommFun.ObjToStr(sr["bannerPicUrl"]);
                hdp.bannerLinkUrl = MyCommFun.ObjToStr(sr["bannerLinkUrl"]);
                hdp.remark        = MyCommFun.ObjToStr(sr["remark"]);
                hdp.sort_id       = MyCommFun.Obj2Int(sr["sort_id"]);
                hdpList.Add(hdp);
            }
            sr.Close();
            return(hdpList);
        }
Example #3
0
        private void ShowInfo(int id)
        {
            hidid.Value = id.ToString();
            Model.wx_shop_indexbanner photo = pBll.GetModel(id);
            hidid.Value       = photo.id.ToString();
            txtpName.Text     = photo.bannerName.ToString();
            txtLinkUrl.Text   = photo.bannerLinkUrl;
            txtpContent.Value = photo.remark.ToString();
            txtseq.Text       = photo.sort_id.Value.ToString();


            //封面图片
            if (photo.bannerPicUrl != null && photo.bannerPicUrl.Trim() != "/images/noneimg.jpg")
            {
                txtImgUrl.Text         = photo.bannerPicUrl;
                imgfacePicPic.ImageUrl = photo.bannerPicUrl;
            }
        }
Example #4
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int id = MyCommFun.Str2Int(hidid.Value);

            #region  //先判断
            string strErr = "";
            if (this.txtpName.Text.Trim().Length == 0)
            {
                strErr += "图片名称不能为空!";
            }
            if (this.txtImgUrl.Text.Trim().Length == 0)
            {
                strErr += "图片不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");
                return;
            }

            #endregion

            #region 赋值
            Model.wx_shop_indexbanner photo = new Model.wx_shop_indexbanner();

            if (id > 0)
            {
                photo = pBll.GetModel(id);
            }

            string facePicc = imgfacePicPic.ImageUrl;
            if (txtImgUrl.Text.Trim() != "")
            {
                facePicc = txtImgUrl.Text.Trim();
            }
            Model.wx_userweixin weixin = GetWeiXinCode();
            photo.wid           = weixin.id;
            photo.bannerName    = txtpName.Text.Trim();
            photo.remark        = txtpContent.Value.Trim();
            photo.bannerLinkUrl = txtLinkUrl.Text.Trim();
            photo.bannerPicUrl  = facePicc;
            photo.sort_id       = MyCommFun.Str2Int(txtseq.Text.Trim());


            #endregion

            if (id <= 0)
            {  //新增
                photo.createDate = DateTime.Now;
                //1新增主表
                id = pBll.Add(photo);

                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加相册--图片信息,主键为" + id); //记录日志
                JscriptMsg("添加相册--图片信息成功!", "banner_list.aspx", "Success");
            }
            else
            {   //修改
                pBll.Update(photo);

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改相册--图片信息,主键为" + id); //记录日志
                JscriptMsg("修改相册--图片信息成功!", "banner_list.aspx", "Success");
            }
        }