コード例 #1
0
ファイル: main_adver_sh.aspx.cs プロジェクト: wjszxli/xdjb
    //撤稿
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.Session["uid"] == null || this.Session["uid"].ToString() == "")
        {
            this.Response.Redirect("../login.aspx");
        }

        string ls_tip = "撤稿成功!";

        TPortalClass.JpAdver JpAdver = new TPortalClass.JpAdver();
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.DAO db = new TPortalClass.DAO();
        string sql_cg = "update hy_adver set hy_ifsh=3 where id=" + System.Int32.Parse(this.txtid.Value) + "";
        db.Execute(sql_cg);
        //写系统日志
        string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        if (userip == null || userip == "")
        {
            userip = Request.ServerVariables["REMOTE_ADDR"];
        }
        JpCommon.WriteLog(userip, "撤稿", "撤稿广告链接记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());
        JpAdver.Update();

        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }
コード例 #2
0
ファイル: main_adver_sh.aspx.cs プロジェクト: wjszxli/xdjb
    //审核
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.Session["uid"] == null || this.Session["uid"].ToString() == "")
        {
            this.Response.Redirect("../login.aspx");
        }
        TPortalClass.JpAdver JpAdver = new TPortalClass.JpAdver();
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        JpAdver.hy_advername = this.txthy_advername.Text;
        JpAdver.hy_way = this.txthy_way.SelectedValue;
        JpAdver.hy_adverurl = this.txthy_adverurl.Text;
        JpAdver.hy_sort = int.Parse(this.txthy_sort.Text);
        JpAdver.hy_adversize = this.txthy_adversize.Text;
        JpAdver.hy_advertitle = this.txthy_advertitle.Text;
        JpAdver.hy_used = "0";
        JpAdver.hy_ifsh = 2;
        JpAdver.hy_starttime = this.txthy_starttime.Value.Trim();
        JpAdver.hy_endtime = this.txthy_endtime.Value.Trim();
        TPortalClass.DAO db = new TPortalClass.DAO();
        string lsfilename = FileUpload1.FileName;
        string lspath = "", lsurl = "", str_path = "";
        if (lsfilename != "")  //attsize
        {
            lsfilename = System.Guid.NewGuid() + "_" + lsfilename;
            //将附件上传到服务器目录下
            lspath = Server.MapPath("~/");  //虚拟目录的位置
            lsurl = "/upload/adverpic_yt";  //原图存放的文件夹
            Directory.CreateDirectory(lspath + "/" + lsurl);
            str_path = lspath + "/" + lsurl + "/" + lsfilename;
            FileUpload1.SaveAs(str_path);
            JpAdver.hy_adverpic = lsurl + "/" + lsfilename;
        }
        else
        {
            JpAdver.hy_adverpic = this.txtpicurl.Value;
        }
        string ls_tip = "发布成功!";

        if (this.txtop.Value == "add")
        {
            if (JpAdver.IsExist())
            {
                this.Response.Write("<script language=javascript>alert('该广告名称已经存在!')</script>");
                return;
            }
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "广告审核", "广告审核记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());
            JpAdver.Insert();
        }
        else
        {
            JpAdver.id = System.Int32.Parse(this.txtid.Value);
            //写系统日志
            string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (userip == null || userip == "")
            {
                userip = Request.ServerVariables["REMOTE_ADDR"];
            }
            JpCommon.WriteLog(userip, "广告审核", "广告审核记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString());
            JpAdver.Update();
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }