Пример #1
0
        protected void btn_ServerClick(object sender, EventArgs e)
        {
            Img img = new Img();
            img.savePathName = "files";
            string path = img.saveImage("");
            if (img.error == "")
            {
                AlbumInfo info = new AlbumInfo();
                info.album_name = path;
                info.imgUrl = path;
                info.showHome = false;
                info.linkUrl = "";

                AlbumDal al = new AlbumDal();
                int id = al.add(info);
                StringBuilder sb = new StringBuilder();
                sb.Append("<span style='font-size:12px;BACKGROUND: #F7F7F7;'>上传成功!");
                sb.Append("<a href=\"javascript:;\" onClick=\"parent.addContent(iname);\">插入</a> ");
                sb.Append("<a href=\"javascript:history.back();\">继续上传</a></span>");
                sb.Append("<script language=\"JavaScript\">");
                sb.Append("var iname=\""+gform("up_name")+"\";");
                sb.Append("parent.document.getElementById(iname).value=\"" + path + "\";</script>;");
                die(sb.ToString());
            }
            else
            {
                Response.Write(img.error+" <a href=\"javascript:history.back()\">返回</a>");
                Response.End();
            }
        }
Пример #2
0
        protected void btn_ServerClick(object sender, EventArgs e)
        {
            Img img = new Img();
            img.savePathName = "album";
            string path = img.saveImage("");
            if (img.error == "")
            {
                AlbumInfo info = new AlbumInfo();
                info.album_name = path;
                info.imgUrl = path;
                if (showHome.Checked)
                    info.showHome = true;
                else
                    info.showHome = false;
                info.linkUrl = linkUrl.Value;

                AlbumDal al = new AlbumDal();
                int id = al.add(info);
                showMessage("上传成功<br/>图片地址:<a href=\"" + path + "\" target=\"_blank\">" + path + "</a>");
            }
            else
            {
                showMessage(img.error);
            }
            
        }
Пример #3
0
 /// <summary>
 /// 添加数据
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public int add(AlbumInfo info)
 {
     int id = add("album",
         "album_name", 2, 50, info.album_name,
         "imgUrl", 2, 255, info.imgUrl,
         "linkUrl",2,255,info.linkUrl,
         "showHome",5,1,info.showHome
         );
     return id;
 }
Пример #4
0
 private void bind_update(int id, string showHome)
 {
     AlbumInfo info = new AlbumInfo();
     if (showHome == "True")
         info.showHome = true;
     else
         info.showHome = false;
     AlbumDal al = new AlbumDal();
     al.updateShomeHome(id, info);
     //throw new Exception("The method or operation is not implemented.");
 }
Пример #5
0
 /// <summary>
 /// 读取
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public AlbumInfo GetModel(int id)
 {
     DataRow dr = get_info("Album", id.ToString());
     AlbumInfo info = new AlbumInfo();
     if (!dr.IsNull("id"))
     {
         info.id = int.Parse(dr["id"].ToString());
         info.album_name = dr["album_name"].ToString();
         info.imgUrl = dr["imgUrl"].ToString();
         info.postDate = dr["postDate"].ToString();
         info.linkUrl = dr["linkUrl"].ToString();
         info.showHome = bool.Parse(dr["showHome"].ToString());
     }
     return info;
 }
Пример #6
0
 /// <summary>
 /// 是否首页显示
 /// </summary>
 /// <param name="id"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool updateShomeHome(int id,AlbumInfo info)
 {
     return edit("Album",id.ToString(),
         "showHome",5,8,info.showHome
         );
 }