예제 #1
0
        protected virtual void BackupOrRestore()
        {
            MessageBoxs msg     = new MessageBoxs();
            IvsMessage  message = null;

            if (isBackup)
            {
                message = new IvsMessage("SYBK00_008");
            }
            else
            {
                message = new IvsMessage("SYRT00_002");
            }
            msg.Add(message);
            CommonData.MessageTypeResult result = msg.Display(CommonData.MessageType.YesNo);
            if (result == CommonData.MessageTypeResult.Yes)
            {
                //this.service = new Ivs.Core.Services.Services();
                //this.service.Credentials = System.Net.CredentialCache.DefaultCredentials;
                //this.service.BackupOrRestoreCompleted += new Ivs.Core.Services.BackupOrRestoreCompletedEventHandler(service_BackupOrRestoreCompleted);
                //this.service.BackupOrRestoreAsync(this.isBackup, this.txtPath.Text);
                //backupService.BackupOrRestore(this.isBackup, this.txtPath.Text);
                this.btnOK.Enabled = false;
            }
        }
예제 #2
0
        /// <summary>
        /// Processing when click btnViewLog
        /// </summary>
        private void btnViewLog_Click(object sender, EventArgs e)
        {
            try
            {
                string[] logContent = null;
                string   logFile    = CommonData.StringEmpty;
                //this.service = new Ivs.Core.Services.Services();
                //if (DbConfig.UsingProxy.Equals("true"))
                //{
                //    string address = "http://" + DbConfig.ServerName + ":" + DbConfig.WebServicePort;
                //    WebProxy proxyObject = new WebProxy(address, true);
                //    service.Proxy = proxyObject;
                //}
                //service.Credentials = CredentialCache.DefaultCredentials;

                //bool result = this.service.GetLogFile(out logFile, out logContent);
                //if (!result)
                //{
                //    if (Directory.Exists(logFile))
                //    {
                //        MessageBoxs msg = new MessageBoxs();
                //        IvsMessage message = null;
                //        message = new IvsMessage("CMN025");
                //        msg.Add(message);
                //        msg.Display(CommonData.MessageType.Ok);
                //    }
                //    else
                //    {
                //        MessageBoxs msg = new MessageBoxs();
                //        IvsMessage message = null;
                //        message = new IvsMessage("CMN071");
                //        msg.Add(message);
                //        msg.Display(CommonData.MessageType.Ok);
                //    }

                //}
                //else
                //{
                //    File.WriteAllLines(logFile, logContent);
                //    System.Diagnostics.Process.Start(logFile);
                //}
            }
            catch
            {
                MessageBoxs msg     = new MessageBoxs();
                IvsMessage  message = null;
                message = new IvsMessage("SYBK00_006");
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);
            }
        }
예제 #3
0
        /// <summary>
        /// Check validated data
        /// </summary>
        protected bool ValidateData()
        {
            MessageBoxs msg     = new MessageBoxs();
            IvsMessage  message = null;

            this.txtPath.ClearErrors();
            if (!this.IsValidatePath(this.txtPath.Text))
            {
                message = new IvsMessage("SYBK00_004");
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);
                this.txtPath.SetError(message.MessageText);
                this.txtPath.Focus();
                return(false);
            }
            return(true);
        }
예제 #4
0
        public virtual void btnOK_Click(object sender, EventArgs e)
        {
            MessageBoxs msg     = new MessageBoxs();
            IvsMessage  message = null;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            int returnCode = 0;

            returnCode = this.GetImportData();
            switch (returnCode)
            {
            case CommonData.ImportReturnCode.PathIsEmpty:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_REQUIRED, lblPath_Import.Text);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.PathNotExist:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_DATA_OR_FILE_NOT_FOUND, txtPath.Text);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.FileFormatInvalid:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_FILE_FORMAT_INVALID);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.NumRowInvalid:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_FILE_NUM_OF_ROW_INVALID);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.NumFieldInvalid:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_FILE_NUM_OF_COLUMN_INVALID);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.SystemError:

                message = new IvsMessage(CommonConstantMessage.COM_MSG_GENERAL_EXCEPTION);
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);

                this.importData  = null;
                this.IsImportErr = true;
                break;

            case CommonData.ImportReturnCode.Succeed:
                this.IsImportErr = false;
                this.Hide();
                break;
            }
        }
예제 #5
0
        /// <summary>
        /// Processing when click btnBackup
        /// </summary>
        protected void BackupOrRestore(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateData())
                {
                    this.BackupOrRestore();

                    #region Old version

                    //if (!string.IsNullOrEmpty(result))
                    //{
                    //    message = new IvsMessage("SYBK00_001");
                    //    msg.Add(message);
                    //    msg.Display(CommonData.MessageType.Ok);
                    //}
                    //CommonBl commonBl = new CommonBl();
                    //int iReturnCode = commonBl.Backup(this.txtPath.Text);
                    //switch (iReturnCode)
                    //{
                    //    case CommonData.DbReturnCode.Succeed:
                    //        message = new IvsMessage("SYBK00_001");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);

                    //        break;
                    //    case CommonData.DbReturnCode.AccessDenied:
                    //        message = new IvsMessage("CMN017");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Access Denied");
                    //        break;
                    //    case CommonData.DbReturnCode.InvalidHost:
                    //        message = new IvsMessage("CMN018");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Invalid Host");
                    //        break;
                    //    case CommonData.DbReturnCode.InvalidDatabase:
                    //        message = new IvsMessage("CMN019");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Invalid Database");
                    //        break;
                    //    case CommonData.DbReturnCode.LostConnection:
                    //        message = new IvsMessage("CMN020");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Lost Connection");
                    //        break;
                    //    case CommonData.DbReturnCode.DuplicateKey:
                    //        message = new IvsMessage("CMN014");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Duplicate Key");
                    //        break;
                    //    case CommonData.DbReturnCode.ForgeignKeyNotExist:
                    //        message = new IvsMessage("CMN022");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Forgeign Key Not Exist");
                    //        break;
                    //    case CommonData.DbReturnCode.ForeignKeyViolation:
                    //        message = new IvsMessage("CMN023");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Foreign Key Violation");
                    //        break;
                    //    case CommonData.DbReturnCode.DataNotFound:
                    //        message = new IvsMessage("CMN024");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Data Not Found");
                    //        break;
                    //    case CommonData.DbReturnCode.ExceptionOccured:
                    //        message = new IvsMessage("CMN025");
                    //        msg.Add(message);
                    //        msg.Display(CommonData.MessageType.Ok);
                    //        //MessageBox.Show("Exception Occured");
                    //        break;
                    //}

                    #endregion Old version
                }
            }
            catch
            {
                MessageBoxs msg     = new MessageBoxs();
                IvsMessage  message = null;
                message = new IvsMessage("SYBK00_006");
                msg.Add(message);
                msg.Display(CommonData.MessageType.Ok);
            }
        }