예제 #1
0
        public List <string> GetSettedData(ref string AStrCallReturn)
        {
            List <string> LListStrReturn = new List <string>();
            string        LStrDBServer   = string.Empty;
            string        LStrDBPort     = string.Empty;
            string        LStrLoginID    = string.Empty;
            string        LStrLoginPwd   = string.Empty;
            int           LIntDBPort     = 0;

            string LStrVerificationCode004 = string.Empty;

            try
            {
                AStrCallReturn          = string.Empty;
                LStrVerificationCode004 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);

                LStrDBServer = TextBoxServerName.Text.Trim();
                LStrDBPort   = TextBoxServerPort.Text.Trim();
                LStrLoginID  = TextBoxLoginName.Text.Trim();
                LStrLoginPwd = PasswordBoxLoginPassword.Password;

                if (string.IsNullOrEmpty(LStrDBServer))
                {
                    TextBoxServerName.Focus(); AStrCallReturn = "ER0001"; return(LListStrReturn);
                }

                if (string.IsNullOrEmpty(LStrDBPort))
                {
                    TextBoxServerPort.Focus(); AStrCallReturn = "ER0002"; return(LListStrReturn);
                }
                if (!int.TryParse(LStrDBPort, out LIntDBPort))
                {
                    TextBoxServerPort.Focus(); AStrCallReturn = "ER0002"; return(LListStrReturn);
                }
                if (LIntDBPort <= 0 || LIntDBPort > 65535)
                {
                    TextBoxServerPort.Focus(); AStrCallReturn = "ER0002"; return(LListStrReturn);
                }

                if (string.IsNullOrEmpty(LStrLoginID))
                {
                    TextBoxLoginName.Focus(); AStrCallReturn = "ER0003"; return(LListStrReturn);
                }

                LStrDBServer = EncryptionAndDecryption.EncryptDecryptString(LStrDBServer, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrDBPort   = EncryptionAndDecryption.EncryptDecryptString(LStrDBPort, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrLoginID  = EncryptionAndDecryption.EncryptDecryptString(LStrLoginID, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrLoginPwd = EncryptionAndDecryption.EncryptDecryptString(LStrLoginPwd, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);

                LListStrReturn.Add(LStrDBServer); LListStrReturn.Add(LStrDBPort); LListStrReturn.Add(LStrLoginID); LListStrReturn.Add(LStrLoginPwd);
            }
            catch { LListStrReturn.Clear(); }

            return(LListStrReturn);
        }
예제 #2
0
        //验证输入的参数是否符合格式
        private bool ConfirmConnectParameter(ref string AStrReturn)
        {
            bool LBoolReturn = false;

            string LStrServerName    = string.Empty;
            string LStrServerPort    = string.Empty;
            int    LIntServerPort    = 0;
            string LStrLoginName     = string.Empty;
            string LStrLoginPassword = string.Empty;


            try
            {
                IListConnectArguments.Clear();
                App.GStrCatchException = string.Empty;

                LStrServerName    = TextBoxServerName.Text.Trim();
                LStrServerPort    = TextBoxServerPort.Text.Trim();
                LStrLoginName     = TextBoxLoginName.Text.Trim();
                LStrLoginPassword = PasswordBoxLoginPassword.Password;

                if (string.IsNullOrEmpty(LStrServerName))
                {
                    AStrReturn = "E00001"; TextBoxServerName.Focus(); return(LBoolReturn);
                }
                if (!int.TryParse(LStrServerPort, out LIntServerPort))
                {
                    AStrReturn = "E00002"; TextBoxServerPort.Focus(); return(LBoolReturn);
                }
                if (LIntServerPort <= 1024 || LIntServerPort >= 65535)
                {
                    AStrReturn = "E00002"; TextBoxServerPort.Focus(); return(LBoolReturn);
                }
                if (string.IsNullOrEmpty(LStrLoginName))
                {
                    AStrReturn = "E00003"; TextBoxLoginName.Focus(); return(LBoolReturn);
                }
                if (string.IsNullOrEmpty(LStrLoginPassword))
                {
                    AStrReturn = "E00004"; PasswordBoxLoginPassword.Focus(); return(LBoolReturn);
                }

                IListConnectArguments.Add(LStrServerName); IListConnectArguments.Add(LStrServerPort); IListConnectArguments.Add(LStrLoginName); IListConnectArguments.Add(LStrLoginPassword);

                LBoolReturn = true;
            }
            catch (Exception ex)
            {
                LBoolReturn            = false;
                AStrReturn             = "E00000";
                App.GStrCatchException = ex.ToString();
            }
            return(LBoolReturn);
        }