public static bool Update(CAUHINHEMAIL _cauhinhemail) { try { var monhoccu = SelectSingle(_cauhinhemail.CauHinhEmailId); monhoccu.SMTPServer = _cauhinhemail.SMTPServer; monhoccu.Port = _cauhinhemail.Port; monhoccu.DiaChiEmail = _cauhinhemail.DiaChiEmail; monhoccu.TaiKhoan = _cauhinhemail.TaiKhoan; monhoccu.MatKhau = O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Encrypt(_cauhinhemail.MatKhau, true); monhoccu.XacThucSSL = _cauhinhemail.XacThucSSL; monhoccu.XacThucTKKhiGui = _cauhinhemail.XacThucTKKhiGui; monhoccu.ModifiedDate = DateTime.Now; monhoccu.ModifiedBy = GlobalSettings.UserCode; monhoccu.ModifiedLog = GlobalSettings.SessionMyIP; Database.SubmitChanges(); return(true); } catch (Exception ex) { return(false); O2S_Common.Logging.LogSystem.Error(ex); } }
private void CauHinhEmail_ClickData(CAUHINHEMAIL _cauhinh) { txtMaEmail.Text = _cauhinh.MaEmail; txtSMTPServer.Text = _cauhinh.SMTPServer; txtPort.Text = _cauhinh.Port.ToString(); txtDiaChiEmail.Text = _cauhinh.DiaChiEmail; txtTaiKhoan.Text = _cauhinh.TaiKhoan; txtMatKhau.Text = O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Decrypt(_cauhinh.MatKhau, true); chkXacThucSSL.Checked = _cauhinh.XacThucSSL ?? false; chkXacThucTKKhiGui.Checked = _cauhinh.XacThucTKKhiGui ?? false; chkIsLock.Checked = _cauhinh.IsLock ?? false; }
private void btnGuiMail_Click(object sender, EventArgs e) { try { ValidateEmailKhiGui(); int _CauHinhId = O2S_Common.TypeConvert.Parse.ToInt32(cboEmailGui.SelectedValue.ToString()); CAUHINHEMAIL _cauhinh = CauHinhEmailLogic.SelectSingle(_CauHinhId); if (_cauhinh == null) { O2S_Common.Utilities.ThongBao.frmThongBao _frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.VUI_LONG_NHAP_DAY_DU_THONG_TIN); _frmthongbao.Show(); return; } SmtpClient mailclient = new SmtpClient(_cauhinh.SMTPServer, _cauhinh.Port ?? 0); mailclient.EnableSsl = true; mailclient.Credentials = new NetworkCredential(_cauhinh.TaiKhoan, O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Decrypt(_cauhinh.MatKhau, true)); MailMessage message = new MailMessage(_cauhinh.TaiKhoan, txtEmailNhan.Text); message.Subject = txtTieuDeMail.Text; message.Body = txtNoiDungMail.HtmlText; message.IsBodyHtml = true; mailclient.Send(message); MessageBox.Show(Base.ThongBaoLable.GUI_MAIL_THANH_CONG, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.GUI_MAIL_THANH_CONG); //frmthongbao.Show(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); O2S_Common.Logging.LogSystem.Error(ex); //O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.GUI_MAIL_THAT_BAI); //frmthongbao.Show(); } }
private void gridViewCauHinhEmail_Click(object sender, EventArgs e) { try { if (gridViewEmail.RowCount > 0) { var rowHandle = gridViewEmail.FocusedRowHandle; int _CauHinhEmailId = O2S_Common.TypeConvert.Parse.ToInt32(gridViewEmail.GetRowCellValue(rowHandle, "CauHinhEmailId").ToString()); this.CauHinhEmailSelect = CauHinhEmailLogic.SelectSingle(_CauHinhEmailId); if (this.CauHinhEmailSelect != null) { CauHinhEmail_ClickData(this.CauHinhEmailSelect); LockAndUnLookPanelControl(false); } } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
public static bool Insert(CAUHINHEMAIL _monhoc, ref int _monHocId) { try { _monhoc.MatKhau = O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Encrypt(_monhoc.MatKhau, true); _monhoc.CreatedDate = DateTime.Now; _monhoc.CreatedBy = GlobalSettings.UserCode; _monhoc.CreatedLog = GlobalSettings.SessionMyIP; _monhoc.IsRemove = 0; Database.CAUHINHEMAILs.InsertOnSubmit(_monhoc); Database.SubmitChanges(); _monHocId = _monhoc.CauHinhEmailId; _monhoc.MaEmail = string.Format("{0}{1:D5}", "EM", _monHocId); Database.SubmitChanges(); return(true); } catch (System.Exception ex) { return(false); O2S_Common.Logging.LogSystem.Error(ex); } }