protected void btnSubmit_Click(object sender, EventArgs e) { int port = 0; E_MailConfig data = new E_MailConfig(); data.EnterpriseID = EnterpriceID; data.UserID = userid; data.Email = txtEmail.Text.Trim() + "@" + txtEmailSuffix.Text; data.SMTP = txtSMTP.Text.Trim(); int.TryParse(txtPort.Text, out port); data.Port = port; data.UserName = txtUserName.Text.Trim(); data.Password = txtPassword.Text; data.Name = txtName.Text; bool flag = new T_MailConfig().ModifyConfig(data); //添加操作日志 new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log() { EnterpriseID = EnterpriceID, UserID = UserID, LogTitle = "配置邮箱信息", IP = MLMGC.COMP.Requests.GetRealIP() }); //MLMGC.COMP.Jscript.ShowMsg("保存"+(b?"成功":"失败"), this); if (flag) { MLMGC.COMP.Jscript.AlertAndRedirect(this, "保存成功", MLMGC.COMP.Requests.GetQueryString("backurl")); } else { MLMGC.COMP.Jscript.ShowMsg("保存失败", this); } }
protected void databind() { data = new T_MailConfig().GetConfig(new E_MailConfig() { PersonalID = PersonalID }); if (data == null) { plSend.Visible = false; return; } plConfig.Visible = false; ltSendEmail.Text = data.Name; }
/// <summary> /// 点击保存按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { if (txtEmail.Text == "" || txtEmailSuffix.Text == "" || txtPassword.Text == "" || txtPort.Text == "" || txtSMTP.Text == "" || txtUserName.Text == "") { MLMGC.COMP.Jscript.ShowMsg("请认真填写以上内容", this); return; } E_MailConfig data = new E_MailConfig(); data.PersonalID = PersonalID; data.Email = txtEmail.Text.Trim() + "@" + txtEmailSuffix.Text; data.SMTP = txtSMTP.Text.Trim(); data.Port = int.Parse(txtPort.Text); data.UserName = txtUserName.Text.Trim(); data.Password = txtPassword.Text; data.Name = txtName.Text; bool b = new T_MailConfig().SetConfig(data); MLMGC.COMP.Jscript.ShowMsg("保存" + (b ? "成功" : "失败"), this); }
/// <summary> /// 获取邮件配置 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-20</remarks> public E_MailConfig GetConfig(E_MailConfig data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PersonalID", SqlDbType.Int) }; parms[0].Value = data.PersonalID; DataTable dt = DbHelperSQL.RunProcedureTable("ProcPI_B_MailConfig_Select", parms); if (dt != null && dt.Rows.Count == 1) { data.Email = dt.Rows[0]["Email"].ToString(); data.SMTP = dt.Rows[0]["SMTP"].ToString(); data.Port = int.Parse(dt.Rows[0]["Port"].ToString()); data.Name = dt.Rows[0]["Name"].ToString(); data.UserName = dt.Rows[0]["UserName"].ToString(); data.Password = dt.Rows[0]["Password"].ToString(); return(data); } return(null); }
/// <summary> /// 修改邮件配置 /// </summary> /// <param name="data"></param> /// <returns></returns> /// <remarks>tianzhenyun 2011-10-20</remarks> public bool SetConfig(E_MailConfig data) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@PersonalID", SqlDbType.Int), new SqlParameter("@Email", SqlDbType.VarChar, 128), new SqlParameter("@SMTP", SqlDbType.VarChar, 128), new SqlParameter("@Port", SqlDbType.TinyInt), new SqlParameter("@UserName", SqlDbType.VarChar, 128), new SqlParameter("@Password", SqlDbType.VarChar, 128), new SqlParameter("@Name", SqlDbType.VarChar, 64) }; parms[0].Value = data.PersonalID; parms[1].Value = data.Email; parms[2].Value = data.SMTP; parms[3].Value = data.Port; parms[4].Value = data.UserName; parms[5].Value = data.Password; parms[6].Value = data.Name; int ReturnValue = 0; DbHelperSQL.RunProcedures("ProcPI_B_MailConfig_Update", parms, out ReturnValue); return(ReturnValue > 0); }
/// <summary> /// 修改邮件配置 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool SetConfig(E_MailConfig data) { return(dal.SetConfig(data)); }
/// <summary> /// 获取邮件配置 /// </summary> /// <param name="data"></param> /// <returns></returns> public E_MailConfig GetConfig(E_MailConfig data) { return(dal.GetConfig(data)); }
/// <summary> /// 修改邮件配置 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool ModifyConfig(E_MailConfig data) { return(dal.ModifyConfig(data)); }