//保存 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_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config(); //先判断这个用户是否已经存在 DataTable dtmail = Hyoa_mail_config.Getmailconfigbyuserid(this.txtuserid.Text); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (dtmail.Rows.Count > 0) { Hyoa_mail_config.hy_userid = this.txtuserid.Text; Hyoa_mail_config.hy_mailid = this.hy_mailid.Text; Hyoa_mail_config.hy_mailpwd = Encrypt(this.hy_mailpwd.Text); Hyoa_mail_config.hy_smtpurl=this.hy_smtpurl.Text; Hyoa_mail_config.hy_smtpport = this.hy_smtpport.Text; Hyoa_mail_config.hy_pop3url = this.hy_pop3url.Text; Hyoa_mail_config.hy_pop3port = this.hy_pop3port.Text; Hyoa_mail_config.hy_ifsavebak = this.hy_ifsavebak.Text; Hyoa_mail_config.Update(); } else { Hyoa_mail_config.ID = Hyoa_global.GetRandom(); Hyoa_mail_config.hy_userid = this.txtuserid.Text; Hyoa_mail_config.hy_mailid = this.hy_mailid.Text; Hyoa_mail_config.hy_mailpwd = Encrypt(this.hy_mailpwd.Text); Hyoa_mail_config.hy_smtpurl = this.hy_smtpurl.Text; Hyoa_mail_config.hy_smtpport = this.hy_smtpport.Text; Hyoa_mail_config.hy_pop3url = this.hy_pop3url.Text; Hyoa_mail_config.hy_pop3port = this.hy_pop3port.Text; Hyoa_mail_config.hy_ifsavebak = this.hy_ifsavebak.Text; Hyoa_mail_config.Insert(); } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }
//保存 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_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config(); //先判断这个用户是否已经存在 DataTable dtmail = Hyoa_mail_config.Getmailconfigbyuserid(this.txtuserid.Text); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); string lsop = ""; if (this.Request.QueryString["op"] != null) { lsop = this.Request.QueryString["op"].ToString(); //是否弹出窗口 } if (lsop == "add") { Hyoa_mail_config.ID = Hyoa_global.GetRandom(); Hyoa_mail_config.hy_userid = this.txtuserid.Text; Hyoa_mail_config.hy_mailid = this.hy_mailid.Text; Hyoa_mail_config.hy_mailpwd = Encrypt(this.hy_mailpwd.Text); Hyoa_mail_config.hy_smtpurl = this.hy_smtpurl.Text; Hyoa_mail_config.hy_smtpport = this.hy_smtpport.Text; Hyoa_mail_config.hy_pop3url = this.hy_pop3url.Text; Hyoa_mail_config.hy_pop3port = this.hy_pop3port.Text; Hyoa_mail_config.hy_ifsavebak = this.hy_ifsavebak.Text; Hyoa_mail_config.hy_sort = System.Int32.Parse(this.hy_sort.Text); Hyoa_mail_config.Insert(); } else { Hyoa_mail_config.ID = this.txtdocid.Value; Hyoa_mail_config.hy_userid = this.txtuserid.Text; Hyoa_mail_config.hy_mailid = this.hy_mailid.Text; Hyoa_mail_config.hy_mailpwd = Encrypt(this.hy_mailpwd.Text); Hyoa_mail_config.hy_smtpurl = this.hy_smtpurl.Text; Hyoa_mail_config.hy_smtpport = this.hy_smtpport.Text; Hyoa_mail_config.hy_pop3url = this.hy_pop3url.Text; Hyoa_mail_config.hy_pop3port = this.hy_pop3port.Text; Hyoa_mail_config.hy_ifsavebak = this.hy_ifsavebak.Text; Hyoa_mail_config.hy_sort = System.Int32.Parse(this.hy_sort.Text); Hyoa_mail_config.Update(); } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='/mail/list_grxx.aspx'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }