Exemplo n.º 1
0
        public bool SysJobEmail(DatabaseConstant.Action Action, ref SYS_JOB_EMAIL objSysJobEmail, ref string sMessage)
        {
            // Kiểm tra kết nối, server, service trước khi request
            Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.JobService.layGiaTri());

            // Khởi tạo và gán giá trị cho request
            JobRequest request = Common.Utilities.PrepareRequest(new JobRequest());

            request.Function       = DatabaseConstant.Function.SYS_JOB_EMAIL;
            request.Action         = Action;
            request.objSysJobEmail = objSysJobEmail;

            JobResponse response = Client.Job(request);

            //Kiểm tra kết quả trả về
            Common.Utilities.ValidResponse(request, response);

            if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
            {
                objSysJobEmail = response.objSysJobEmail;
                return(true);
            }
            else
            {
                sMessage = response.ResponseMessage;
                return(false);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
 private void GetFormData(ref SYS_JOB_EMAIL obj)
 {
     try
     {
         obj.ID                = 1;
         obj.NAME              = txtName.Text;
         obj.DESCRIPTION       = txtDescription.Text;
         obj.MAIL_FROM         = txtUserName.Text;
         obj.MAIL_HOST_ADDRESS = txtHostAddress.Text;
         string pro = ((RadComboBoxItem)cboProtocol.SelectedItem).Tag.ToString();
         obj.MAIL_HOST_PROTOCOL  = pro;
         obj.MAIL_HOST_SMTP_PORT = txtPort.Text;
         obj.MAIL_HOST_TIMEOUT   = 1000;
         obj.MAIL_USERNAME       = txtUserName.Text;
         obj.MAIL_PASSWORD       = txtPassWord.Password;
     }
     catch (Exception ex)
     {
         LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
         throw ex;
     }
 }