Пример #1
0
    //保存
    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.DAO db = new TPortalClass.DAO();

        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpGoods JpGoods = new TPortalClass.JpGoods();

        JpGoods.hy_cid =ddlcolname.Value;
        JpGoods.hy_goodsname = txthy_goodsname.Text;
        JpGoods.hy_goodstitle = txthy_goodstitle.Text;
        JpGoods.hy_linkurl = txthy_linkurl.Text;
        JpGoods.hy_content = txthy_content.Text;
        JpGoods.hy_goodsprice = Convert.ToDouble(txthy_goodsprice.Text);
        JpGoods.hy_sort = Convert.ToInt32(txthy_sort.Text);
        JpGoods.hy_ifsh = 0;
        JpGoods.docid = this.txtDocid.Value;

        if (this.txtop.Value == "add")
        {
            //写系统日志
            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());

            JpGoods.Insert();

        }
        else
        {

            //写系统日志
            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());

            JpGoods.id = int.Parse(txtid.Value.Trim());
            JpGoods.Update();
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }