コード例 #1
0
ファイル: main_activity.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.JpActivity JpActivity = new TPortalClass.JpActivity();
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();

        JpActivity.hy_bt = this.txthy_bt.Text;
        JpActivity.hy_content = this.txthy_content.Text;
        JpActivity.hy_address = this.txthy_address.Text;
        JpActivity.hy_tel = this.txthy_tel.Text;
        JpActivity.hy_starttime = this.txthy_starttime.Value;
        JpActivity.hy_endtime = this.txthy_endtime.Value;
        JpActivity.hy_contact = this.txthy_contact.Text;
        JpActivity.hy_category = this.txthy_category.Text;
        JpActivity.hy_bz = this.txthy_bz.Text;
        JpActivity.hy_sort = Convert.ToInt32(this.txthy_sort.Text);
        JpActivity.hy_addtime = this.txtaddtime.Value;
        JpActivity.hy_djr = this.txtdjr.Value;
        JpActivity.hy_ifsh = 0;
        JpActivity.docid = txtDocid.Value;

        //string lsfilename = FileUpload1.FileName;
        //string lspath = "", lsurl = "", str_path = "";
        //if (lsfilename != "")  //attsize
        //{
        //    lsfilename = System.Guid.NewGuid() + "_" + lsfilename;
        //    //将附件上传到服务器目录下
        //    lspath = Server.MapPath("~/");  //虚拟目录的位置
        //    lsurl = "/upload/activitypic_yt";  //原图存放的文件夹
        //    Directory.CreateDirectory(lspath + "/" + lsurl);
        //    str_path = lspath + "/" + lsurl + "/" + lsfilename;
        //    FileUpload1.SaveAs(str_path);
        //    JpActivity.hy_images = lsurl + "/" + lsfilename;
        //}
        //else
        //{
        //    JpActivity.hy_images = this.txtpicurl.Value;
        //}

        if (this.txtop.Value == "add")
        {
            if (JpActivity.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());

            JpActivity.Insert();
        }
        else
        {
            JpActivity.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());

            JpActivity.Update();
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }
コード例 #2
0
ファイル: main_activity.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");
        }

        string ls_tip = "保存成功!";

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

        JpActivity.hy_bt = this.txthy_bt.Text;
        JpActivity.hy_content = this.txthy_content.Text;
        JpActivity.hy_address = this.txthy_address.Text;
        JpActivity.hy_tel = this.txthy_tel.Text;
        JpActivity.hy_starttime = this.txthy_starttime.Value;
        JpActivity.hy_endtime = this.txthy_endtime.Value;
        JpActivity.hy_contact = this.txthy_contact.Text;
        JpActivity.hy_category = this.txthy_category.Text;
        JpActivity.hy_bz = this.txthy_bz.Text;
        JpActivity.hy_sort = Convert.ToInt32(this.txthy_sort.Text);
        JpActivity.hy_addtime = DateTime.Now.ToString();
        JpActivity.hy_djr = this.txtdjr.Value;
        JpActivity.hy_ifsh = 1;
        JpActivity.docid = txtDocid.Value;

        if (this.txtop.Value == "add")
        {
            if (JpActivity.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());

            JpActivity.Insert();
        }
        else
        {
            JpActivity.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());

            JpActivity.Update();
        }
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }