Beispiel #1
0
        public void RollBackTransaction()
        {
            string FUNCTION_NAME = "RollBackTransaction";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (m_transaction == null)
            {
                throw new Exception("Tracsaction cannot be null");
            }
            else
            {
                m_transactionRefCnt--;
                if (m_transactionRefCnt == 0)
                {
                    m_transaction.Rollback();
                    m_transaction.Dispose();
                    m_transaction = null;
                    if (m_connection.State != ConnectionState.Closed)
                    {
                        CloseConnection();
                    }
                }
            }
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
        public static void SetExcludeStationList(string ExcludeStationId)
        {
            string FUNCTION_NAME = "SetExcludeStationList";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (String.IsNullOrEmpty(ExcludeStationId))
            {
                m_ExcludeStationList = "-1";

                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Exclude Station List is empty");
            }
            else
            {
                m_ExcludeStationList = ExcludeStationId;

                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Exclude Station List - " + m_ExcludeStationList);
            }


            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
Beispiel #3
0
        public void BeginTransaction()
        {
            string FUNCTION_NAME = "BeginTransaction";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (m_transaction != null)
            {
                m_transactionRefCnt++;
            }
            else
            {
                if (m_connection != null)
                {
                    m_transaction = m_connection.BeginTransaction();
                    m_transactionRefCnt++;
                }
                else
                {
                    throw new Exception("No Connection object created");
                }
            }
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
        public void SetParameters(string Exclude_StationId)
        {
            string FUNCTION_NAME = "SetParameters";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered");

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Exclude_StationId - " + Exclude_StationId);
            //verify and set exclude station id list
            string [] ExcludeStationIdList;
            string    ResExcludeStationIdList = null;

            ExcludeStationIdList = Exclude_StationId.Split(',');

            foreach (string StationId in ExcludeStationIdList)
            {
                int  StationId_Int;
                bool result = Int32.TryParse(StationId, out StationId_Int);

                //add only if valid integer
                if (result && StationId_Int >= 0)
                {
                    if (!String.IsNullOrEmpty(ResExcludeStationIdList))
                    {
                        ResExcludeStationIdList += ',';
                    }

                    ResExcludeStationIdList += StationId;
                }
            }

            m_Exclude_StationId_List = ResExcludeStationIdList;
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Final Exclude_StationId - " + m_Exclude_StationId_List);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Exited");
        }
        public void TrainTimeTableView_FormClosed()
        {
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Form Closed");

            return;
        }
        public Dictionary <int, List <TrainTimeTableData> > CreateTrainDataDictionary(List <TrainTimeTableData> DataList)
        {
            string FUNCTION_NAME = "CreateTrainDataDictionary";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            Dictionary <int, List <TrainTimeTableData> > timeTableDataRes = new Dictionary <int, List <TrainTimeTableData> >();

            //go through all the records, and form a hash table,
            //with train id as key and train timetable data list as value
            foreach (TrainTimeTableData record in DataList)
            {
                List <TrainTimeTableData> timeTableDataList;
                if (timeTableDataRes.ContainsKey(record.TrainServiceId))
                {
                    timeTableDataList = timeTableDataRes[record.TrainServiceId];
                    timeTableDataList.Add(record);
                }
                else
                {
                    timeTableDataList = new List <TrainTimeTableData>();
                    timeTableDataList.Add(record);
                    timeTableDataRes[record.TrainServiceId] = timeTableDataList;
                }
            }

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");

            return(timeTableDataRes);
        }
Beispiel #7
0
        public DatabaseSession GetDatabaseSession(string connectionString)
        {
            string FUNCTION_NAME = "GetDatabaseSession";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function_Entered");

            if (connectionString != null)
            {
                DatabaseSession session = m_sessionStore.GetSession(connectionString);
                if (session == null)
                {
                    CreateDatabaseSession(connectionString);
                    session = m_sessionStore.GetSession(connectionString);
                }
                m_sessionStore.StoreCurrentSession(session);

                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Function_Exited");
                return(session);
            }

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function_Exited");
            return(null);
        }
Beispiel #8
0
        public bool CheckDatabaseConnection()
        {
            string FUNCTION_NAME = "CheckDatabaseConnection";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");
            // int connectionCounter = 0;
            bool boolConnected = false;

            //while (!boolConnected && connectionCounter < 3)
            //{
            try
            {
                if (m_connection == null)
                {
                    m_connection = GetConnection(m_dbType);
                    //set the connection string
                    m_connection.ConnectionString = m_ConnectionString;
                    //open the connection
                    m_connection.Open();
                    m_connection.Close();
                }
                else
                {
                    if (m_connection.State != ConnectionState.Open)
                    {
                        m_connection.Open();
                        m_connection.Close();
                    }
                    else
                    {
                        if (m_transaction == null)
                        {
                            m_connection.Close();
                            m_connection.Open();
                            m_connection.Close();
                        }
                    }
                }
                boolConnected = true;
            }
            catch (Exception localException)
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, localException.ToString());
            }
            //   connectionCounter++;
            //}


            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, string.Format("Database {0} Status = {1}", m_ConnectionString, boolConnected ? "ONLINE" : "OFFLINE"));

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function_Exited");

            return(boolConnected);
        }
Beispiel #9
0
        public DatabaseSession GetDatabaseSession()
        {
            string FUNCTION_NAME = "GetDatabaseSession";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            bool bConnected = false;
            int  nTrytimes  = 0;

            while (!bConnected && nTrytimes++ <= MAX_TIMES)
            {
                DatabaseSession currentSession = m_sessionStore.GetCurrentSession();
                if (currentSession != null && currentSession.IsTransactionOpen())
                {
                    LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                           EDebugLevelManaged.DebugInfo, "Transaction open in current Session");

                    if (currentSession.CheckDatabaseConnection())
                    {
                        LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                               EDebugLevelManaged.DebugInfo, "Function Exited");
                        return(currentSession);
                    }
                }
                else
                {
                    string connectionString = DBConnectionStrings.GetInstance().GetConnectionString();
                    if (connectionString != null)
                    {
                        DatabaseSession session = m_sessionStore.GetSession(connectionString);
                        if (session == null)
                        {
                            CreateDatabaseSession(connectionString);
                            session = m_sessionStore.GetSession(connectionString);
                        }
                        if (session.CheckDatabaseConnection())
                        {
                            /*if (m_DBSwitched.Length != 0 && (m_DBSwitched == connectionString))
                             * {
                             *  m_DBSwitched = "";
                             * }*/
                            m_sessionStore.StoreCurrentSession(session);
                            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
                            return(session);
                        }
                        else
                        {
                            // m_DBSwitched = connectionString;
                            // DBConnectionStrings.GetInstance().UpdateDBStatus(connectionString, DBStatus.DB_OFFLINE);
                        }
                    }
                }
            }
            throw new DatabaseConnectionException("No Database Connection");
        }
Beispiel #10
0
        public override void onInitGenericGUICompleted()
        {
            string FUNCTION_NAME     = "onInitGenericGUICompleted";
            string exclude_stationId = getGuiEntityParameterValue(EXCLUDE_STATION_ID);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Exclude_stationId - " + exclude_stationId);
            TrainTimeTableViewer.View.TrainTimeTableView frm = (TrainTimeTableViewer.View.TrainTimeTableView)m_pMainFrm;
            frm.SetParameters(exclude_stationId);
        }
Beispiel #11
0
        public DatabaseSession(string connectionString)
        {
            string FUNCTION_NAME = "DatabaseSession";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered.");

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, string.Format("Database Connection String = {0}", connectionString));

            m_dbType           = GetDatabaseTypeFromString(connectionString);
            m_ConnectionString = connectionString.Substring(connectionString.IndexOf(DAOHelper.DB_Delimiter) + 1) + CONNECTION_POOLING_STRING;
        }
        /// <summary>
        /// Initialise chart
        /// </summary>
        /// <param name="minValue">the min timestamp </param>
        /// <param name="maxValue">the max timestamp </param>
        /// <param name="TimeInterval">time interval </param>
        public void InitialiseChart(DateTime MinValue, DateTime MaxValue, int TimeInterval)

        {
            string FUNCTION_NAME = "InitialiseChart";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered");

            timeTableChartCtrl1.ClearAllSeriesAndMarkers();
            timeTableChartCtrl1.InitChartBefore(MinValue, MaxValue, TimeInterval, TrainTimeTableConst.MINOR_INTERVAL_NUM, TrainTimeTableConst.MAJOR_GRID_LINES_MAX_NUM);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Exited.");
        }
Beispiel #13
0
        public void StartTimeChanged(object sender, EventArgs e)
        {
            string FUNCTION_NAME = "StartTimeChanged";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            m_View.SetMinEndTime();

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
Beispiel #14
0
        public void ClearDataCache()
        {
            string FUNCTION_NAME = "ClearDataCache";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered.");

            TrainTimeTableDAO.ClearCache();

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited.");
        }
Beispiel #15
0
        public void CloseConnection()
        {
            string FUNCTION_NAME = "CloseConnection";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            m_sessionFactory.GetDatabaseSession().CloseConnection();

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
        public static void ReleaseInstance()
        {
            string FUNCTION_NAME = "ReleaseInstance";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");
            if (m_instance != null)
            {
                m_instance = null;
            }
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
Beispiel #17
0
        public bool OpenConnection(string ConnectionString)
        {
            string FUNCTION_NAME = "OpenConnection";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            bool bRet = m_sessionFactory.GetDatabaseSession(ConnectionString).OpenConnection();

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
            return(bRet);
        }
Beispiel #18
0
        public void setExcludeStationList()
        {
            string FUNCTION_NAME = "setExcludeStationList";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered.");

            m_Model.ExcludeStationIdList = m_View.ExcludeStationId;


            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited.");
        }
Beispiel #19
0
        public override Form CreateMainForm()
        {
            string FUNCTION_NAME = ".CreateMainForm";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "CreateMainForm");
            ConfigureFileHelper.GetInstance().init();

            ViewManager.GetInstance().RegisterViewFactory(new TimeTableViewFactory());
            IView view = ViewManager.GetInstance().GetView(TrainTimeTableConst.TrainTimeTableView);  //viewID is ""
            Form  frm  = (Form)view;


            return(frm);
        }
        public static void ClearCache()
        {
            string FUNCTION_NAME = "ClearCache";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            m_TrainDataCachePractical = null;
            m_TrainDataCachePlanned   = null;


            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
Beispiel #21
0
        public void CreateDatabaseSession(string ConnectionString)
        {
            string FUNCTION_NAME = "CreateDatabaseSession";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function_Entered");

            DatabaseSession session = new DatabaseSession(ConnectionString);

            m_sessionStore.Store(ConnectionString, session);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function_Exited");
        }
        public List <TrainTimeTableData> GetTrainTimeTableData(bool plannedData, int TrainServiceId, DateTime Date)
        {
            string FUNCTION_NAME = "GetTrainTimeTableData";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered.");

            TrainTimeTableDAO timetableDAO = TrainTimeTableDAO.GetInstance();

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Getting Data For TrainServiceId" + TrainServiceId.ToString() + ", Date " + Date.ToShortDateString());

            return(timetableDAO.GetTrainTimeTableData(plannedData, TrainServiceId, Date));
        }
Beispiel #23
0
        private DBType GetDatabaseTypeFromString(string databaseConnectionString)
        {
            string FUNCTION_NAME = "GetDatabaseTypeFromString";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered.");

            //connection string will have dbtype at the first of the string with ';' as delimiter.
            string dbTypeString = databaseConnectionString.Substring(0, databaseConnectionString.IndexOf(DAOHelper.DB_Delimiter));
            DBType dbType       = DAOHelper.GetDbType(dbTypeString);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, string.Format("Database Type = {0}", dbType.ToString()));
            return(dbType);
        }
Beispiel #24
0
        //static lock for instance variable todo

        public static SimpleDatabase GetInstance()
        {
            string FUNCTION_NAME = "GetInstance";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (s_SimpleDatabase == null)
            {
                s_SimpleDatabase = new SimpleDatabase();
            }
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
            return(s_SimpleDatabase);
        }
        public void ShowTimeTable(int TrainServiceId, bool Planned, DateTime Date)
        {
            string FUNCTION_NAME = "ShowTimeTable";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered.");

            m_View.Initialise(Convert.ToString(TrainServiceId), Planned);
            List <TrainTimeTableData> TimeTableList = m_Model.GetTrainTimeTableData(Planned, TrainServiceId, Date);

            m_View.AddTrainTimings(TimeTableList);

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited.");
        }
        /// <summary>
        /// This function is called for drawing practical chart.
        /// </summary>
        /// <param name="mode">
        public void DrawPracticalChart(Dictionary <int, List <TrainTimeTableData> > PracticalData)
        {
            string FUNCTION_NAME = "DrawPracticalChart";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(), EDebugLevelManaged.DebugInfo, "Function Entered.");

            try
            {
                this.Cursor         = System.Windows.Forms.Cursors.WaitCursor;
                StartButton.Enabled = false;

                foreach (KeyValuePair <int, List <TrainTimeTableData> > practicalTimeTbl in PracticalData)
                {
                    string lblName    = practicalTimeTbl.Key.ToString();
                    string seriesName = "Practical" + lblName;

                    timeTableChartCtrl1.AddPracticalSeries(seriesName, "Line", true, lblName, 1, true);

                    foreach (TrainTimeTableData Data in practicalTimeTbl.Value)
                    {
                        LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                               EDebugLevelManaged.DebugInfo, "Data Point(" + Data.StationID + "," + Data.ArrTime + " Added to Series " + seriesName);

                        timeTableChartCtrl1.AddPoint(seriesName, Data.StationID, Data.StationName, Data.ArrTime);

                        LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                               EDebugLevelManaged.DebugInfo, "Data Point(" + Data.StationID + "," + Data.ArrTime + " Added to Series " + seriesName);

                        timeTableChartCtrl1.AddPoint(seriesName, Data.StationID, Data.StationName.ToString(), Data.DeptTime);
                    }
                }

                StartButton.Enabled = true;
                this.Cursor         = System.Windows.Forms.Cursors.Default;
            }

            catch (Exception localException)
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, localException.ToString());
            }

            finally
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Function Exited");
            }
        }
        public static TrainTimeTableDAO GetInstance()
        {
            string FUNCTION_NAME = "GetInstance";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (m_instance == null)
            {
                m_instance = new TrainTimeTableDAO();
            }

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
            return(m_instance);
        }
Beispiel #28
0
        public bool IsTransactionOpen()
        {
            string FUNCTION_NAME = "IsTransactionOpen";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            if (m_transaction != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #29
0
        public void ChartMouseWheel(object sender, MouseEventArgs e)
        {
            string FUNCTION_NAME = "ChartMouseWheel";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            //if chart is empty return
            if (m_View.GetTimeTableChartCtl().IsChartEmpty())
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Function Exited Without Zoom Operation, Chart Is Empty");
                return;
            }
            //only zoom if mouse position within chartArea
            float XMin, XMax, YMin, YMax;

            m_View.GetTimeTableChartCtl().GetChartAreaBoundary(out XMin, out XMax, out YMin, out YMax);


            if (e.X < XMin || e.X > XMax || e.Y < YMin || e.Y > YMax)
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, "Function Exited Without Zoom Operation, Mouse Outside ChartArea");
                return;
            }
            try
            {
                if (e.Delta < 0)
                {
                    m_View.GetTimeTableChartCtl().ZoomOut(m_View.GetTimeInterval() * TrainTimeTableConst.MINOR_INTERVAL_NUM * TrainTimeTableConst.MAJOR_GRID_LINES_MAX_NUM);
                }

                if (e.Delta > 0)
                {
                    m_View.GetTimeTableChartCtl().Zoom(e.Location.X, e.Location.Y);
                }
            }
            catch (Exception localException)
            {
                LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                       EDebugLevelManaged.DebugInfo, localException.ToString());
            }

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");
        }
        public List <TrainTimeTableData> GetCacheTrainTimeTableData(bool isPlanned, int TrainServiceId)
        {
            string FUNCTION_NAME = "GetCacheTrainTimeTableData";

            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Entered");

            //if data available in cache return cache data
            if (isPlanned && m_TrainDataCachePlanned != null)
            {
                if (m_TrainDataCachePlanned.ContainsKey(TrainServiceId))
                {
                    LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                           EDebugLevelManaged.DebugInfo, "Return Cache Planned Data");

                    return(m_TrainDataCachePlanned[TrainServiceId]);
                }
                else
                {
                    LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                           EDebugLevelManaged.DebugInfo, "No Cache Planned Data");

                    return(null);
                }
            }
            else if (!isPlanned && m_TrainDataCachePractical != null)
            {
                if (m_TrainDataCachePractical.ContainsKey(TrainServiceId))
                {
                    LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                           EDebugLevelManaged.DebugInfo, "Return Cache Practical Data");

                    return(m_TrainDataCachePractical[TrainServiceId]);
                }
                else
                {
                    LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                           EDebugLevelManaged.DebugInfo, "No Cache Practical Data");

                    return(null);
                }
            }
            LogHelperCli.GetInstance().Log_Generic(CLASS_NAME + "." + FUNCTION_NAME, LogHelperCli.GetInstance().GetLineNumber(),
                                                   EDebugLevelManaged.DebugInfo, "Function Exited");

            return(null);
        }