//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx"); string ls_tip = "发送成功!"; HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //发送 if (this.txtwhichoperation.Value == "1") { string[] lv_jsrid = this.txthy_jsrid.Text.Split('+'); string[] lv_jsrname = this.txthy_jsrname.Value.Split('+'); for (var i = 0; i < lv_jsrid.Length; i++) { if (lv_jsrid[i] != "") { Hyoa_mail.ID = Hyoa_global.GetRandom(); Hyoa_mail.DOCID = this.txtdocid.Value; Hyoa_mail.hy_type = "收件"; Hyoa_mail.hy_foldername = "收件箱"; Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text; Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text; Hyoa_mail.hy_jsrid = lv_jsrid[i].ToString(); Hyoa_mail.hy_wbjsrid = ""; Hyoa_mail.hy_jsrname = lv_jsrname[i].ToString(); Hyoa_mail.hy_title = this.txthy_title.Text; Hyoa_mail.hy_body = this.hy_content1.Value; Hyoa_mail.hy_datetime = System.DateTime.Now.ToString(); Hyoa_mail.hy_ifsavetofjx = ""; Hyoa_mail.hy_yxj = ""; Hyoa_mail.hy_yjbg = ""; Hyoa_mail.hy_zycd = ""; Hyoa_mail.hy_hz = ""; Hyoa_mail.hy_wbjszh = ""; Hyoa_mail.Insert(); } if (this.txthy_wbjsrid.Text != "") { sendmail(this.txthy_wbjsrid.Text, this.txthy_title.Text, this.hy_content1.Value, this.txtdocid.Value); } } //如果要保存到发件箱,则保存一份 if (this.ddlifsavetofjx.SelectedValue == "是") { Hyoa_mail.ID = Hyoa_global.GetRandom(); Hyoa_mail.DOCID = this.txtdocid.Value; Hyoa_mail.hy_type = "发件"; Hyoa_mail.hy_foldername = "发件箱"; Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text; Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text; Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text; Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text; Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value; Hyoa_mail.hy_title = this.txthy_title.Text; Hyoa_mail.hy_body = this.hy_content1.Value; Hyoa_mail.hy_datetime = System.DateTime.Now.ToString(); Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue; Hyoa_mail.hy_yxj = ""; Hyoa_mail.hy_yjbg = ""; Hyoa_mail.hy_zycd = ""; Hyoa_mail.hy_hz = ""; Hyoa_mail.hy_wbjszh = ""; Hyoa_mail.Insert(); } } //存草稿 if (this.txtwhichoperation.Value == "2") { if (this.txtop.Value == "add") { string ls_id = this.txtdocid.Value; Hyoa_mail.ID = ls_id; this.txtid.Value = ls_id; Hyoa_mail.DOCID = this.txtdocid.Value; Hyoa_mail.hy_type = "发件"; Hyoa_mail.hy_foldername = "草稿箱"; Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text; Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text; Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text; Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text; Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value; Hyoa_mail.hy_title = this.txthy_title.Text; Hyoa_mail.hy_body = this.hy_content1.Value; Hyoa_mail.hy_datetime = System.DateTime.Now.ToString(); Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue; Hyoa_mail.hy_yxj = ""; Hyoa_mail.hy_yjbg = ""; Hyoa_mail.hy_zycd = ""; Hyoa_mail.hy_hz = ""; Hyoa_mail.hy_wbjszh = ""; Hyoa_mail.Insert(); ls_tip = "存草稿成功!"; } else { string ls_id = this.txtid.Value; Hyoa_mail.ID = ls_id; this.txtid.Value = ls_id; Hyoa_mail.DOCID = this.txtdocid.Value; Hyoa_mail.hy_type = "发件"; Hyoa_mail.hy_foldername = "草稿箱"; Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text; Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text; Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text; Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text; Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value; Hyoa_mail.hy_title = this.txthy_title.Text; Hyoa_mail.hy_body = this.hy_content1.Value; Hyoa_mail.hy_datetime = System.DateTime.Now.ToString(); Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue; Hyoa_mail.hy_yxj = ""; Hyoa_mail.hy_yjbg = ""; Hyoa_mail.hy_zycd = ""; Hyoa_mail.hy_hz = ""; Hyoa_mail.hy_wbjszh = ""; Hyoa_mail.Update(); ls_tip = "存草稿成功!"; } } //处理完成后的提示及跳转(增加刷新附件功能) if (this.txtifsxfj.Text == "1") { Response.Write("<script>window.location='main_mail.aspx?op=modify&mid=" + this.txtmudelid.Value + "&id=" + this.txtid.Value + "&url=" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } }