コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //messageBox title
            string loginIDError  = ValidationRegex.ValidteEmpty(this.lblLoginId.Text, this.txtLoginId.Text);
            string passwordError = ValidationRegex.ValidteEmpty(this.lblLoginPass.Text, this.txtLoginPass.Text);

            if (loginIDError != "")
            {
                MsgHelper.WarningMsg(loginIDError, ValidationRegex.publicTitle);
                return;
            }
            else if (passwordError != "")
            {
                MsgHelper.WarningMsg(passwordError, ValidationRegex.publicTitle);
                return;
            }

            IUserInfoService uiService = BLLFactory.ServiceAccess.CreateUserInfoService();
            UserInfo         userInfo  = new UserInfo();

            userInfo.loginID  = this.txtLoginId.Text;
            userInfo.password = this.txtLoginPass.Text;
            UserInfo us;

            try
            {
                us = uiService.userExist(userInfo);
                if (us != null)
                {
                    userinfo = us;
                    logger.Info(us.loginID + "ログイン成功。");
                    FrmMain.userinfo = us;
                    this.Dispose();
                    FrmMain mainForm = new FrmMain();
                    mainForm.ShowDialog();
                }
                else
                {
                    logger.Info("ログイン失敗。" + ValidationRegex.I003);
                    MsgHelper.WarningMsg(ValidationRegex.I003, ValidationRegex.publicTitle);
                }
            }
            catch (OdbcException ex)
            {
                // 例外処理
                MsgHelper.WarningMsg(ValidationRegex.I004, ValidationRegex.publicTitle);
            }
            catch (Exception ex)
            {
                // 例外処理
                MsgHelper.WarningMsg(ValidationRegex.I005, ValidationRegex.publicTitle);
            }
        }
コード例 #2
0
        private bool messageCheck()
        {
            bool   flag           = false;
            string nameMessage    = ValidationRegex.ValidteEmpty(this.lblTrName.Text, this.txtTrName.Text);
            string ipMessage      = ValidationRegex.ValidteEmpty(this.lblTrIp.Text, this.txtTrIp.Text);
            string accountMessage = ValidationRegex.ValidteEmpty(this.lblTrAccount.Text, this.txtTraccount.Text);
            string passMessage    = ValidationRegex.ValidteEmpty(this.lblTrPass.Text, this.txtTrPass.Text);
            string stfileMessage  = ValidationRegex.ValidteEmpty(this.lblTrStfile.Text, this.txtTrStfile.Text);
            Regex  patt           = new Regex("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}");

            int bkId = 0;

            if (!String.IsNullOrWhiteSpace(this.id))
            {
                bkId = Convert.ToInt32(this.id);
            }
            //check Backup Server Name
            IList <BackupServer> existLists = null;

            if (!String.IsNullOrWhiteSpace(this.txtTrName.Text))
            {
                existLists = backupService.GetBackupServerListByNameButId(bkId, this.txtTrName.Text.Trim());
            }

            if (nameMessage != "")
            {
                MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (existLists != null && existLists.Count > 0)
            {
                string msg = ValidationRegex.W008;
                msg = msg.Replace("{1}", this.lblTrName.Text);
                MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (ipMessage != "")
            {
                MsgHelper.WarningMsg(ipMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (!patt.IsMatch(this.txtTrIp.Text.Trim()))
            {
                string msg = ValidationRegex.W003.Replace("{1}", this.lblTrIp.Text);
                MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (accountMessage != "")
            {
                MsgHelper.WarningMsg(accountMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (passMessage != "")
            {
                MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (stfileMessage != "")
            {
                MsgHelper.WarningMsg(stfileMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else
            {
                //IP and startfolder unique checking
                IList <BackupServer> bkList = backupService.GetBackupServerListButId(bkId, this.txtTrIp.Text, this.txtTrStfile.Text);
                if (bkList.Count > 0)
                {
                    MsgHelper.WarningMsg(ValidationRegex.W009, ValidationRegex.publicTitle);
                    flag = true;
                }
                else
                {
                    //check whether the ip and startfolder is deleted.
                    IList <BackupServer> deletedbkList = backupService.GetDeletedBackupServerList(this.txtTrIp.Text, this.txtTrStfile.Text);
                    if (deletedbkList.Count > 0)
                    {
                        flag = !MsgHelper.QuestionMsg(ValidationRegex.W010, ValidationRegex.publicTitle);
                    }
                }
            }
            return(flag);
        }
コード例 #3
0
ファイル: FrmGroupTransfer.cs プロジェクト: hst-bridge/BBS
        private void btnSave_Click(object sender, EventArgs e)
        {
            string nameMessage   = ValidationRegex.ValidteEmpty(this.lblName.Text, this.txtMonitorName.Text);
            string serverMessage = ValidationRegex.ValidteEmpty(this.lblServer.Text, this.cobMonitorServer.Text);

            if (nameMessage != "")
            {
                MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle);
                return;
            }
            else if (serverMessage != "")
            {
                MsgHelper.WarningMsg(serverMessage, ValidationRegex.publicTitle);
                return;
            }
            else
            {
                string id = this.txtMonitorId.Text;
                //save operation
                //BackupServerGroup backupServerGroup = new BackupServerGroup();

                innerBackupServerGroup.backupServerGroupName = this.txtMonitorName.Text.Trim();
                innerBackupServerGroup.monitorServerID       = this.cobMonitorServer.SelectedValue.ToString();
                innerBackupServerGroup.memo       = this.txtMonitorMemo.Text.Trim();
                innerBackupServerGroup.deleteFlg  = 0;
                innerBackupServerGroup.creater    = FrmMain.userinfo.loginID;
                innerBackupServerGroup.createDate = CommonUtil.DateTimeNowToString();
                innerBackupServerGroup.updater    = FrmMain.userinfo.loginID;
                innerBackupServerGroup.updateDate = CommonUtil.DateTimeNowToString();

                //IBackupServerGroupService backupService = BLLFactory.ServiceAccess.CreateBackupServerGroupService();
                //int flag = -1;
                if (id == "")
                {
                    IList <BackupServerGroup> existLists = backupService.GetBackupServerGroupByName(this.txtMonitorName.Text.Trim());
                    if (existLists.Count > 0)
                    {
                        string msg = ValidationRegex.W008;
                        msg = msg.Replace("{1}", this.lblName.Text);
                        MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle);
                    }
                    else
                    {
                        if (MsgHelper.QuestionMsg(ValidationRegex.Q001, ValidationRegex.publicTitle))
                        {
                            ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(saveOperation));
                        }
                        if (innerFlag > -1)
                        {
                            MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle);
                            gFlag = true;
                            this.Dispose();
                        }
                    }
                }
                else
                {
                    innerBackupServerGroup.id = id;
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                    {
                        ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(updateOperation));
                    }
                    if (innerFlag > -1)
                    {
                        MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle);
                        gFlag = true;
                        this.Dispose();
                    }
                }
            }
        }
コード例 #4
0
ファイル: FrmObject.cs プロジェクト: hst-bridge/BBS
        private bool messageCheck()
        {
            bool   flag             = false;
            string nameMessage      = ValidationRegex.ValidteEmpty(this.lblName.Text, this.txtMonitorName.Text);
            string ipMessage        = ValidationRegex.ValidteEmpty(this.lblMonitorIp.Text, this.txtMonitorIp.Text);
            string accountMessage   = ValidationRegex.ValidteEmpty(this.lblMonitorAccount.Text, this.txtMonitorAccount.Text);
            string passMessage      = ValidationRegex.ValidteEmpty(this.lblMonitorPass.Text, this.txtMonitorPass.Text);
            string stfileMessage    = ValidationRegex.ValidteEmpty(this.lblMonitorStfile.Text, this.txtMonitorStfile.Text);
            string localpathMessage = ValidationRegex.ValidteEmpty(this.lblLocalPath.Text, this.txtLocalPath.Text);
            // SSH エラーコピー対応 20140416
            string macMessage = ValidationRegex.ValidteEmpty(this.lblMacPath.Text, this.txtMacPath.Text);
            //string monitorDrive = ValidationRegex.ValidteEmpty(this.lblMonitorDrive.Text, this.cobMonitorDrive.Text);
            Regex patt = new Regex("([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}");

            if (nameMessage != "")
            {
                MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (ipMessage != "")
            {
                MsgHelper.WarningMsg(ipMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (accountMessage != "")
            {
                MsgHelper.WarningMsg(accountMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (passMessage != "")
            {
                MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (stfileMessage != "")
            {
                MsgHelper.WarningMsg(stfileMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (localpathMessage != "")
            {
                MsgHelper.WarningMsg(localpathMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            else if (macMessage != "")
            {
                MsgHelper.WarningMsg(macMessage, ValidationRegex.publicTitle);
                flag = true;
            }
            //else if (monitorDrive != "")
            //{
            //    MsgHelper.WarningMsg(monitorDrive, ValidationRegex.publicTitle);
            //    flag = true;
            //}
            else if (!patt.IsMatch(this.txtMonitorIp.Text.Trim()))
            {
                string msg = ValidationRegex.W003.Replace("{1}", this.lblMonitorIp.Text);
                MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle);
                flag = true;
            }
            return(flag);
        }
コード例 #5
0
ファイル: FrmObject.cs プロジェクト: hst-bridge/BBS
        /// <summary>
        /// save or update button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool mesFlg = messageCheck();

            if (mesFlg)
            {
                return;
            }
            else
            {
                string id = this.txtId.Text;
                //save operation
                //MonitorServer monitorServer = new MonitorServer();
                innerMonitorServer.monitorServerName = this.txtMonitorName.Text.Trim();
                innerMonitorServer.monitorServerIP   = this.txtMonitorIp.Text.Trim();
                innerMonitorServer.monitorSystem     = 1;
                innerMonitorServer.memo             = this.txtMonitorMemo.Text.Trim();
                innerMonitorServer.account          = this.txtMonitorAccount.Text.Trim();
                innerMonitorServer.password         = this.txtMonitorPass.Text.Trim();
                innerMonitorServer.startFile        = this.txtMonitorStfile.Text.Trim().TrimEnd('\\');
                innerMonitorServer.monitorDrive     = "\\\\" + this.txtMonitorIp.Text.Trim() + "\\" + this.txtMonitorStfile.Text.Trim().TrimEnd('\\');
                innerMonitorServer.monitorDriveP    = "";
                innerMonitorServer.monitorLocalPath = this.txtLocalPath.Text.Trim();
                innerMonitorServer.monitorMacPath   = this.txtMacPath.Text.Trim();
                // Top Directory コピーするかどうか
                if (checkBoxTopDirFile.Checked)
                {
                    innerMonitorServer.copyInit = 1;
                }
                else
                {
                    innerMonitorServer.copyInit = 0;
                }
                innerMonitorServer.deleteFlg = 0;
                if (id == "")
                {
                    innerMonitorServer.creater    = FrmMain.userinfo.loginID;
                    innerMonitorServer.createDate = CommonUtil.DateTimeNowToString();
                }
                else
                {
                    innerMonitorServer.creater    = monitorServer.creater;
                    innerMonitorServer.createDate = monitorServer.createDate;
                }
                innerMonitorServer.updater    = FrmMain.userinfo.loginID;
                innerMonitorServer.updateDate = CommonUtil.DateTimeNowToString();

                //IMonitorServerService monitorService = BLLFactory.ServiceAccess.CreateMonitorServerService();
                //IMonitorServerFolderService imsfs = BLLFactory.ServiceAccess.CreateMonitorServerFolderService();
                //int flag = -1;
                if (id == "")
                {
                    IList <MonitorServer> existLists = monitorService.GetMonitorServerListByName(this.txtMonitorName.Text.Trim());
                    if (existLists.Count > 0)
                    {
                        string msg = ValidationRegex.W008;
                        msg = msg.Replace("{1}", this.lblName.Text);
                        MsgHelper.WarningMsg(msg, ValidationRegex.publicTitle);
                    }
                    else
                    {
                        if (MsgHelper.QuestionMsg(ValidationRegex.Q001, ValidationRegex.publicTitle))
                        {
                            ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(saveOperation));
                        }
                        if (innerFlag > -1)
                        {
                            MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle);
                            gFlag = true;
                            this.Dispose();
                        }
                    }
                }
                else
                {
                    innerMonitorServer.id = id;
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                    {
                        ProgressbarEx.Progress.StartProgessBar(new ProgressbarEx.ShowProgess(updateOperation));
                    }
                    if (innerFlag > -1)
                    {
                        MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle);
                        gFlag = true;
                        this.Dispose();
                    }
                }
            }
        }
コード例 #6
0
ファイル: FrmAuth.cs プロジェクト: hst-bridge/BBS
        private void btnAuthSave_Click(object sender, EventArgs e)
        {
            string loginIDMessage = ValidationRegex.ValidteEmpty(this.lblAuEditLoginId.Text, this.txtAuEditLoginId.Text);
            string passMessage    = ValidationRegex.ValidteEmpty(this.lblAuEditLoginPass.Text, this.txtAuEditLoginPass.Text);
            string nameMessage    = ValidationRegex.ValidteEmpty(this.lblAuEditName.Text, this.txtAuEditName.Text);
            string mailMessage    = ValidationRegex.ValidteEmpty(this.lblAuEditMail.Text, this.txtAuEditMail.Text);

            if (loginIDMessage != "")
            {
                MsgHelper.WarningMsg(loginIDMessage, ValidationRegex.publicTitle);
                return;
            }
            else if (passMessage != "")
            {
                MsgHelper.WarningMsg(passMessage, ValidationRegex.publicTitle);
                return;
            }
            else if (nameMessage != "")
            {
                MsgHelper.WarningMsg(nameMessage, ValidationRegex.publicTitle);
                return;
            }
            else if (mailMessage != "")
            {
                MsgHelper.WarningMsg(mailMessage, ValidationRegex.publicTitle);
                return;
            }
            else
            {
                string id = this.txtAuthEditId.Text;
                //save operation
                UserInfo userInfo = new UserInfo();

                userInfo.loginID  = this.txtAuEditLoginId.Text;
                userInfo.password = this.txtAuEditLoginPass.Text;
                userInfo.name     = this.txtAuEditName.Text;
                userInfo.mail     = this.txtAuEditMail.Text;
                if (this.rbAuthMailYes.Checked == true)
                {
                    userInfo.mailFlg = 1;
                }
                else
                {
                    userInfo.mailFlg = 0;
                }
                if (this.rbAuthFlgYes.Checked == true)
                {
                    userInfo.authorityFlg = 1;
                }
                else
                {
                    userInfo.authorityFlg = 0;
                }
                userInfo.deleteFlg  = 0;
                userInfo.creater    = FrmMain.userinfo.loginID;
                userInfo.createDate = CommonUtil.DateTimeNowToString();
                userInfo.updater    = FrmMain.userinfo.loginID;
                userInfo.updateDate = CommonUtil.DateTimeNowToString();

                IUserInfoService userInfoService = BLLFactory.ServiceAccess.CreateUserInfoService();

                int flag = -1;
                if (id == "")
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q001, ValidationRegex.publicTitle))
                    {
                        flag = userInfoService.InsertUserInfo(userInfo);
                    }
                    if (flag > -1)
                    {
                        MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle);
                        this.Dispose();
                    }
                    else
                    {
                        MsgHelper.InfoMsg(ValidationRegex.I002, ValidationRegex.publicTitle);
                    }
                }
                else
                {
                    userInfo.id = id;
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                    {
                        flag = userInfoService.UpdateUserInfo(userInfo);
                    }
                    if (flag > -1)
                    {
                        MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle);
                        this.Dispose();
                    }
                    else
                    {
                        MsgHelper.InfoMsg(ValidationRegex.U002, ValidationRegex.publicTitle);
                    }
                }
            }
        }