Example #1
0
    protected void btnsa_Click(object sender, EventArgs e)
    {
        string urladdress  = imagebll.GetModel(sid).Htmlurl.Trim();
        string htmlurl     = "";
        string htmlurllist = "";
        string html        = imagebll.GetModel(sid).Htmlurllist.Trim();

        if (html == "NULL" || html == "")
        {
            htmlurllist = loginname + System.DateTime.Now.ToLocalTime().ToString().Replace(":", "").Replace("-", "").Replace(" ", "").Replace("/", "") + ".htm";
        }
        //else { htmlurllist = imagebll.GetModel(sid).Htmlurllist.Trim(); }
        else
        {
            htmlurllist = html;
        }
        if (urladdress == "NULL" || urladdress == "")
        {
            htmlurl = System.DateTime.Now.ToLocalTime().ToString().Replace(":", "").Replace("-", "").Replace(" ", "").Replace("/", "") + ".htm";
        }
        else
        {
            htmlurl = urladdress;
        }
        //GZS.Model.ImageTabM imagemodel = imagebll.GetModel(sid);
        //GZS.Model.ImageTabM imagemodels = new GZS.Model.ImageTabM();
        GZS.Model.ImageTabM imagemodels = imagebll.GetModel(sid);
        imagemodels.imageid   = sid;
        imagemodels.LoginName = loginname;
        imagemodels.imageName = txtImageName.Text.Trim();
        imagemodels.remark    = txtImageShuo.Text.Trim();

        //imagemodels.Createdatetime = imagemodel.Createdatetime;
        // imagemodels.Updatetime1 = imagemodel.Updatetime1;
        imagemodels.Htmlurl     = htmlurl;
        imagemodels.Htmlurllist = htmlurllist;
        int resd = imagebll.UpdateImageTab(imagemodels);
        int ses  = urlbll.DeleteByImageid(sid);

        foreach (DataListItem item in DataList1.Items)
        {
            HiddenField            fid   = (HiddenField)item.FindControl("HiddenField1");
            HiddenField            fidid = (HiddenField)item.FindControl("HiddenField3");
            GZS.Model.ImageUrlTabM md    = new GZS.Model.ImageUrlTabM();
            md.Imageid    = sid;
            md.Imagepath  = fid.Value.Trim();
            md.imgexplain = fidid.Value.Trim();
            int es = urlbll.Add(md);
        }
        List <GZS.Model.ImageTabM> list = imagebll.GetAll(loginname);

        for (int i = 0; i < list.Count; i++)
        {
            imagebll.StaticHtmls(list[i].imageid, loginname);
            imagebll.StaticHtml(list[i].imageid, loginname);
        }
        imagebll.StaticHtmlshouye(loginname);
        Response.Redirect("PictureManage.aspx");
        BindShow();
    }
Example #2
0
    protected void btnUpdatefile_Click(object sender, EventArgs e)
    {
        string picTitle = "";

        if (this.uploadPic.HasFile)
        {
            string path = ConfigurationManager.AppSettings["Upimagecn001"].ToString() + loginname + "/";
            picTitle = UploadFile(uploadPic, path, 500, "default");
            switch (picTitle)
            {
            case "1":
                Response.Write("<script>alert('图片类型不对!');</script>");
                break;

            case "2":
                Response.Write("<script>alert('图片大小超出500K!');</script>");
                break;

            default:
                string urladdress = imagebll.GetModel(sid).Htmlurl.Trim();
                string htmlurl    = "";
                if (urladdress == "NULL" || urladdress == "")
                {
                    htmlurl = DateTime.Now.ToString("yyyyMMdd") + "" + sid + "htm";
                }
                else
                {
                    htmlurl = urladdress;
                }
                GZS.Model.ImageTabM imagemodel  = imagebll.GetModel(sid);
                GZS.Model.ImageTabM imagemodels = new GZS.Model.ImageTabM();
                imagemodels.imageid        = imagemodel.imageid;
                imagemodels.LoginName      = imagemodel.LoginName;
                imagemodels.imageName      = imagemodel.imageName;
                imagemodels.remark         = imagemodel.remark;
                imagemodels.Createdatetime = imagemodel.Createdatetime;
                imagemodels.Updatetime1    = imagemodel.Updatetime1;
                imagemodels.Htmlurl        = htmlurl;
                imagemodels.Htmlurllist    = imagemodel.Htmlurllist;
                int resd = imagebll.UpdateImageTab(imagemodels);

                GZS.Model.ImageUrlTabM imageurlmodel = new GZS.Model.ImageUrlTabM();
                imageurlmodel.Imageid    = sid;
                imageurlmodel.Imagepath  = picTitle.Trim();
                imageurlmodel.imgexplain = txtShuoming.Text.Trim();
                int result = urlbll.Add(imageurlmodel);
                txtShuoming.Text = "";

                BindShow();
                break;
            }
        }
        else
        {
            Response.Write("<script>alert('请选择上传的图片!');</script>");
        }
    }