Beispiel #1
0
        /// <summary>
        ///查询广告列表
        ///创建人:wsy
        ///时间2015-07-23
        /// </summary>
        /// <param name="context"></param>
        public void Search(HttpContext context)
        {
            string pageIndex  = context.Request["pageIndex"] ?? "";
            string pageSize   = context.Request["pageSize"] ?? "";
            string advid      = context.Request["advid"] ?? "";
            string name       = StringHelper.SqlSpecialConvert(context.Request["sname"] ?? "", StringConverTypeEnum.Like);
            int    totalCount = 1;
            List <Psys_VW_AdvAndUser> advlist = new Psys_Adv_BLL().GetListByPage(Convert.ToInt32(pageIndex), Convert.ToInt32(pageSize), advid, " Adv_Type, SortNum desc ", ref totalCount, name);//查询广告列表
            StringBuilder             table   = new StringBuilder();

            table.Append("<tr><th style='width:15px;'>序号</th><th style='width:80px;'>广告位置</th><th style='width:100px;'>图片跳转链接</th><th  style='width:40px;'>最后修改人</th><th style='width:45px;'>最后修改日期</th><th style='width:45px;'>操作</th></tr>");
            if (advlist.Count > 0)
            {
                for (int i = 0; i < advlist.Count; i++)
                {
                    table.Append("<tr>");
                    table.Append("<td>" + (i + 1) + "</td>");                                                                                                                                                                                             //序号
                    table.Append("<td ><div class='new_titleimg'><i name='titlename' onmouseover='doover(this)' onmouseout='doout(this)' >" + advlist[i].Name + "</i><div style='display:none'><img src='" + advlist[i].PicPath + "'></div></div></td>"); //广告位置
                    table.Append("<td title='" + advlist[i].PicUrl + "'>" + StringHelper.SubString(advlist[i].PicUrl, 50) + "</td>");                                                                                                                     //图片跳转链接
                    table.Append("<td title='" + advlist[i].LastEditUserName + "'>" + StringHelper.SubString(advlist[i].LastEditUserName.ToString(), 10) + "</td>");                                                                                      //最后修改人
                    table.Append("<td >" + DateTimeHelper.ToString(advlist[i].LastEditDate, DateTimeHelper.DateFormat.SHORTDATE) + "</td>");                                                                                                              //最后修改日期
                    table.Append("<td>");
                    table.Append("<a href='AdvEdit.aspx?advid=" + advlist[i].ID + "&type=0'>编辑</a>");                                                                                                                                                     // //添加积分商城广告判断标识0:阅读网 1:积分商城 edit by fuzhenzhen 15-11-05
                    table.Append("<a href=\"javascript:SortPreAndNext('" + advlist[i].ID + "','up')\">上移</a>");                                                                                                                                           //上移  lyn
                    table.Append("<a href=\"javascript:SortPreAndNext('" + advlist[i].ID + "','down')\">下移</a>");                                                                                                                                         //下移  lyn
                    table.Append("</td>");
                    table.Append("</tr>");
                }
                context.Response.Write(JsonConvert.SerializeObject(new { count = totalCount, data = table.ToString() }));
            }
            else
            {
                context.Response.Write("{\"count\":\"" + totalCount + "\",\"data\":\"\"}");
            }
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string id   = Request["advid"] ?? "";
         string type = Request["type"] ?? ""; //添加积分商城广告判断标识0:阅读网 1:积分商城 edit by fuzhenzhen 15-11-05
         advid.Value   = id;
         pictype.Value = type;
         if (type == "1")
         {
             advcation.InnerHtml = "您当前的位置:天鹅商城管理";
         }
         if (!string.IsNullOrEmpty(id))
         {
             Psys_Adv adv = new Psys_Adv_BLL().SelectEntity(id);//根据ID查询广告信息
             if (adv != null)
             {
                 name.Value           = adv.Name;
                 pic.Value            = "../" + adv.PicPath;
                 pic_url.Value        = adv.PicUrl;
                 sp.InnerHtml         = "(" + adv.PicRemark + ")";
                 hid_isnofollow.Value = adv.IsNofollow.ToString();
                 altname.Value        = adv.AltName;
             }
         }
     }
 }
Beispiel #3
0
        /// <summary>
        /// 编辑广告
        /// 创建人:wsy
        /// 时间2015-07-23
        /// </summary>
        /// <param name="context"></param>
        public void EditAdv(HttpContext context)
        {
            string pic = UploadPic(context);//上传图片

            if (pic == "-1")
            {
                //格式不正确
                context.Response.Write(pic);
                return;
            }
            else if (pic == "-2")
            {
                //文件大小>5M
                context.Response.Write(pic);
                return;
            }
            else
            {
                string id         = context.Request["advid"]; //广告ID
                string url        = context.Request["url"];   //图片跳转链接
                string altname    = context.Request["altname"];
                string isnofollow = context.Request["isnofollow"];

                string       oldpic = "";
                Psys_Adv_BLL bll    = new Psys_Adv_BLL();
                Psys_Adv     adv    = bll.SelectEntity(id);//根据ID查询广告
                if (adv != null)
                {
                    adv.PicUrl         = url;
                    adv.LastEditUserID = new Guid(RequestSession.GetSessionUser().UserId);
                    adv.LastEditDate   = DateTime.Now;
                    oldpic             = adv.PicPath;
                    adv.IsNofollow     = Convert.ToInt32(isnofollow);
                    adv.AltName        = altname;
                    if (!string.IsNullOrEmpty(pic) && pic != "-3")
                    {
                        adv.PicPath = "/Upload/AdvPic/" + pic;
                    }
                    string result = bll.Update(adv).ToString();
                    if (result == "1" && !string.IsNullOrEmpty(pic) && pic != "-3")
                    {
                        //删除原来的图片
                        if (!string.IsNullOrEmpty(oldpic))
                        {
                            string pa = System.Web.HttpContext.Current.Server.MapPath(oldpic);
                            if (File.Exists(pa))
                            {
                                File.Delete(pa);
                            }
                        }
                    }
                    context.Response.Write(result);
                    LogHelper.InserLog((int)EnumClass.OperateType.编辑操作, PageBase.CurrentOperatName, "编辑了名称为" + adv.Name + "的广告");
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除广告
        /// 创建人:wsy
        /// 时间2015-07-23
        /// </summary>
        /// <param name="context"></param>
        public void DeletePic(HttpContext context)
        {
            string       id  = context.Request["id"];
            Psys_Adv_BLL bll = new Psys_Adv_BLL();
            Psys_Adv     adv = bll.SelectEntity(id);//根据ID查询广告

            adv.Status = 1;
            context.Response.Write(bll.Update(adv));//将广告状态改为已删除
            LogHelper.InserLog((int)EnumClass.OperateType.除操作, PageBase.CurrentOperatName, "删除了名称为" + adv.Name + "的广告");
        }
Beispiel #5
0
        /// <summary>
        /// 导出Excel列表
        /// 时间:2015-08-16
        /// 创建人:wsy
        /// </summary>
        /// <param name="context"></param>
        public void ExportExcel(HttpContext context)
        {
            string type        = context.Request["type"];
            string advid       = context.Request["advid"] ?? "";
            string pageIndex   = context.Request["pageIndex"] ?? "";
            string pageSize    = context.Request["pageSize"] ?? "";
            string recordCount = context.Request["recordCount"] ?? "0";
            int    totalCount  = 0;
            string name        = StringHelper.SqlSpecialConvert(context.Request["sname"] ?? "", StringConverTypeEnum.Like);
            List <Psys_VW_AdvAndUser> advlist;

            pageSize  = type == "all" ? recordCount : pageSize;//判断导出当前or全部
            pageIndex = type == "all" ? "1" : pageIndex;
            Psys_Adv_BLL bll = new Psys_Adv_BLL();

            advlist = bll.GetListByPage(Convert.ToInt32(pageIndex), Convert.ToInt32(pageSize), advid, " SortNum desc ", ref totalCount, name);//查询广告列表
            Excel.ExportExcelByMyXls <Psys_VW_AdvAndUser>(advlist, "Name,PicUrl,LastEditUserName,ToDateShort", "广告位置,图片跳转链接,最后修改人,最后修改日期", "AdvList.xls", "广告列表导出");
            LogHelper.InserLog((int)EnumClass.OperateType.导出操作, PageBase.CurrentOperatName, "导出了广告列表");
        }