private void btnSave_Click(object sender, RoutedEventArgs e) { try { if (Validation()) { SYS_JOB_EMAIL obj = new SYS_JOB_EMAIL(); GetFormData(ref obj); JobProcess process = new JobProcess(); bool ret = false; string sMessage = ""; ret = process.SysJobEmail(DatabaseConstant.Action.CAU_HINH, ref obj, ref sMessage); if (ret) { LMessage.ShowMessage("Update successful", LMessage.MessageBoxType.Warning); return; } else { LMessage.ShowMessage("Update failed", LMessage.MessageBoxType.Warning); return; } } } catch (System.Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
private void SetFormData() { try { SYS_JOB_EMAIL obj = new SYS_JOB_EMAIL(); obj.ID = 1; JobProcess process = new JobProcess(); bool ret = false; string sMessage = ""; ret = process.SysJobEmail(DatabaseConstant.Action.LAY_LAI, ref obj, ref sMessage); if (obj != null) { txtName.Text = obj.NAME; txtDescription.Text = obj.DESCRIPTION; txtHostAddress.Text = obj.MAIL_FROM; txtHostAddress.Text = obj.MAIL_HOST_ADDRESS; txtPort.Text = obj.MAIL_HOST_SMTP_PORT; txtUserName.Text = obj.MAIL_USERNAME; txtPassWord.Password = obj.MAIL_PASSWORD; string pro = obj.MAIL_HOST_PROTOCOL; if (!pro.IsNullOrEmpty()) { if (pro.Equals("SMTP")) { cboProtocol.SelectedIndex = 0; } if (pro.Equals("SMTPS")) { cboProtocol.SelectedIndex = 1; } else { cboProtocol.SelectedIndex = 0; } } else { cboProtocol.SelectedIndex = 0; } } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); throw ex; } }