Esempio n. 1
0
        public int GetMonitorFileListenListCount(string monitorFileName, string monitorServerID, string dirname)
        {
            OdbcConnection conn;
            int            count = 0;

            //simplify sql——2014-07-03 wjd modified
            string where = "";//deleteFlg = 0 AND monitorType<>'削除'

            //monitorServerId format: DBServerIP|monitorServerId Id——2014-07-06 wjd modified
            string DBServerIP = "";
            string msId       = "";

            if (monitorServerID.Trim('|').IndexOf('|') > 0)
            {
                string[] array = monitorServerID.Trim('|').Split('|');
                DBServerIP = "'" + array[0] + "'";
                msId       = array[1];
            }
            else
            {
                DBServerIP = Common.CommonUtil.GetLoginIPWithQuote();
                msId       = monitorServerID;
            }

            //file or folder
            if (monitorFileName != "")
            {
                if (dirname == "0")
                {
                    where += " monitorFileName like '%" + monitorFileName + "%'";// AND monitorFileRelativeDirectory not like '%\\" + monitorFileName + "%'
                }
                else
                {
                    where += " monitorFileRelativeDirectory like '%\\" + monitorFileName + "%'";//id IN(select min(id) from (SELECT min(id) as id,min(CHARINDEX('\\" + monitorFileName + "', monitorFileRelativeDirectory)) AS patindexs FROM monitorFileListen where deleteFlg=0 and monitorType<>'削除' group by monitorFileRelativeDirectory) as a group by a.patindexs) AND
                }
                where += " AND ";
            }

            //one or all monitorServers
            if (msId != "-1")
            {
                where += " monitorServerID = " + msId + " AND ";
            }

            //add condition DBServerIP——2014-06-04 wjd modified
            where += " DBServerIP in (" + DBServerIP + ") ";

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                count = MonitorFileListenDal.GetMonitorFileListenListCount(where, conn);
                conn.Close();
                return(count);
            }
        }
        public int InsertManualBackupServer(ManualBackupServer ManualBackupServer)
        {
            OdbcConnection conn;
            int            count = 0;

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                count = ManualBackupServerDal.InsertManualBackupServer(ManualBackupServer, conn);
                conn.Close();
            }
            return(count);
        }
        public int DeleteManualBackupServer(int BackupServerId, string loginID)
        {
            OdbcConnection conn;
            int            count = 0;

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                count = ManualBackupServerDal.DeleteManualBackupServerById(BackupServerId, loginID, conn);
                conn.Close();
            }
            return(count);
        }
Esempio n. 4
0
        /// <summary>
        /// 転送容量の取得
        /// </summary>
        /// <param name="groupId">グループid</param>
        /// <param name="dtStart">開始日付</param>
        /// <param name="dtEnd">終了日付</param>
        /// <param name="tmStart">開始時間</param>
        /// <param name="tmEnd">終了時間</param>
        /// <param name="displayFlg">表示フラグ</param>
        /// <param name="tranferLfg">0:転送中-完了両方;1:転送中のみ</param>
        /// <param name="stateFlg">0:OK-NG両方;1:NGのみ</param>
        /// <param name="logFlg">0:ログ表示;1:転送容量表示</param>
        /// <returns></returns>
        public IList <TransferLog> GetTransferLogListByProc(int pindex, int pagesize, string groupId, string dtStart, string dtEnd, string tmStart, string tmEnd, int displayFlg, int tranferFlg, int stateFlg, int logFlg, string name)
        {
            IList <TransferLog> LogList;
            //groupId format: DBServerIP|group Id——2014-07-02 wjd modified
            string DBServerIP = "";
            string group      = "";

            if (groupId.Trim('|').IndexOf('|') > 0)
            {
                string[] array = groupId.Trim('|').Split('|');
                DBServerIP = "'" + array[0] + "'";
                group      = array[1];
            }
            else
            {
                DBServerIP = Common.CommonUtil.GetLoginIPWithQuote();
                group      = groupId;
            }
            OdbcParameter[] parameters =
            {
                new OdbcParameter("@DBServerIP",           DBServerIP),
                new OdbcParameter("@groupId",              group),
                new OdbcParameter("@StartDate",            dtStart),
                new OdbcParameter("@EndDate",              dtEnd),
                new OdbcParameter("@StartTime",            tmStart),
                new OdbcParameter("@EndTime",              tmEnd),
                new OdbcParameter("@TranferFlg",           tranferFlg),
                new OdbcParameter("@StateFlg",             stateFlg),
                new OdbcParameter("@LogFlg",               logFlg),
                new OdbcParameter("@backupServerFileName", name),
                new OdbcParameter("@Pindex",               pindex),
                new OdbcParameter("@Psize",                pagesize)
            };
            OdbcConnection conn;

            //2014-06-03 wjd modified
            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                //sqlcommand ストアド実行方法
                //LogList = TransferLogDal.GetTransferLogListByProc(conn, parameters, "sp_GetTranferList");
                //odbccommand ストアド実行方法
                LogList = TransferLogDal.GetTransferLogListByProc(conn, parameters, "{call sp_GetTransferList2(?,?,?,?,?,?,?,?,?,?,?,?)}");
                conn.Close();
                return(LogList);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Get MonitorServerList from All DB
        /// </summary>
        /// 2014-06-04 wjd add
        /// <returns></returns>
        public IList <MonitorServer> GetMonitorServerListAll()
        {
            OdbcConnection        conn;
            IList <MonitorServer> MonitorServer;

            IList <SearchCondition> condition = new List <SearchCondition>();

            condition.Add(new SearchCondition {
                con = "deleteFlg=?", param = "@deleteFlg", value = "0"
            });
            condition = CommonUtil.GetLoginIPCondition(condition);

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                MonitorServer = MonitorServerDal.GetMonitorServerAll(condition, conn);
                conn.Close();
                return(MonitorServer);
            }
        }
        public IList <ManualBackupServer> GetManualBackupServerList()
        {
            OdbcConnection             conn;
            IList <ManualBackupServer> ManualBackupServer;
            //add condition DBServerIP——2014-06-04 wjd modified
            IList <SearchCondition> condition = new List <SearchCondition>();

            condition.Add(new SearchCondition {
                con = "deleteFlg=?", param = "@deleteFlg", value = "0"
            });
            //condition = CommonUtil.GetLoginIPCondition(condition);

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                ManualBackupServer = ManualBackupServerDal.GetManualBackupServer(condition, conn);
                conn.Close();
                return(ManualBackupServer);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Get lists from BackupServerGroup of the All DB
        /// </summary>
        /// 2014-06-04 wjd add
        /// <returns></returns>
        public IList <BackupServerGroup> GetBackupServerGroupListAll()
        {
            OdbcConnection            conn;
            IList <BackupServerGroup> BackupServerGroup;

            IList <SearchCondition> condition = new List <SearchCondition>();

            condition.Add(new SearchCondition {
                con = "deleteFlg=?", param = "@deleteFlg", value = "0"
            });
            condition = CommonUtil.GetLoginIPCondition(condition);

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                BackupServerGroup = BackupServerGroupDal.GetBackupServerGroupAll(condition, conn);
                conn.Close();
                return(BackupServerGroup);
            }
        }
        public ManualBackupServer GetManualBackupServerById(int BackupServerId)
        {
            OdbcConnection             conn;
            IList <ManualBackupServer> ManualBackupServer;
            //add condition DBServerIP——2014-06-04 wjd modified
            IList <SearchCondition> condition = new List <SearchCondition>();

            condition.Add(new SearchCondition {
                con = "id=?", param = "@id", value = BackupServerId.ToString()
            });
            //condition = CommonUtil.GetLoginIPCondition(condition);

            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                ManualBackupServer = ManualBackupServerDal.GetManualBackupServer(condition, conn);
                if (ManualBackupServer.Count > 0)
                {
                    return(ManualBackupServer[0]);
                }
                conn.Close();
                return(null);
            }
        }
Esempio n. 9
0
        public IList <MonitorFileListen> GetMonitorFileListenListByPage(string fileName, string monitorServerId, string dirname, int pindex, int psize)
        {
            OdbcConnection            conn;
            IList <MonitorFileListen> MonitorFileListen;

            //simplify sql——2014-07-03 wjd modified
            string where = "";//deleteFlg = 0  AND monitorType<>'削除'

            //monitorServerId format: DBServerIP|monitorServerId Id——2014-07-06 wjd modified
            string DBServerIP = "";
            string msId       = "";

            if (monitorServerId.Trim('|').IndexOf('|') > 0)
            {
                string[] array = monitorServerId.Trim('|').Split('|');
                DBServerIP = "'" + array[0] + "'";
                msId       = array[1];
            }
            else
            {
                DBServerIP = Common.CommonUtil.GetLoginIPWithQuote();
                msId       = monitorServerId;
            }

            string sql = string.Empty;

            //file or folder
            if (fileName != "")
            {
                if (dirname == "0")
                {
                    sql  = @"select *,ROW_NUMBER() over(order by createDate) as row from MonitorFileListen ";
                    sql += " where monitorFileName like '%" + fileName + "%'";// AND monitorFileRelativeDirectory not like '%\\" + fileName + "%'
                }
                else
                {
                    sql = @"select *,ROW_NUMBER() over(order by createDate) as row
                       from (select *,ROW_NUMBER() over (PARTITION by monitorFileRelativeDirectory order by monitorFileRelativeDirectory) rowno FROM MonitorFileListen ";


                    sql += "where monitorFileRelativeDirectory like '%\\" + fileName + "%'";// id IN(select min(id) from (SELECT min(id) as id,min(CHARINDEX('\\" + fileName + "', monitorFileRelativeDirectory)) AS patindexs FROM monitorFileListen where deleteFlg=0 and monitorType<>'削除' group by monitorFileRelativeDirectory) as a group by a.patindexs) AND
                }
                sql += " AND ";
            }

            //one or all monitorServers
            if (msId != "-1")
            {
                sql += " monitorServerID = " + msId + " AND  ";
            }

            //add condition DBServerIP——2014-06-04 wjd modified
            sql += " DBServerIP in (" + DBServerIP + ") ";

            if (dirname == "1")
            {
                sql += " ) as b where rowno=1 ";
            }
            using (conn = OdbcHelper.CreateConntionAll())
            {
                conn.Open();
                MonitorFileListen = MonitorFileListenDal.GetMonitorFileListenPage(sql, pindex, psize, conn);
                conn.Close();
                return(MonitorFileListen);
            }
        }