예제 #1
0
        void FilterGrid()
        {
            NotificationData filterNotificationData = new NotificationData();

            filterNotificationData.MachineCode = filterMachine.Text.Equals(filterMachineLabel) ? null : filterMachine.Text;
            NotificationData.errorCategory category = NotificationData.errorCategory.NA;
            Enum.TryParse(filterCategory.Text, out category);
            filterNotificationData.category          = category;
            filterNotificationData.FilterNotifyStart = DateTime.Parse(filterStartDate.Value.ToString());
            filterNotificationData.FilterNotifyEnd   = DateTime.Parse(filterEndDate.Value.ToString());
            notificationGrid.ItemsSource             = objGeneralDba.GetNotifications(filterNotificationData);
        }
예제 #2
0
        public NotificationData GetTriggerDataUsingNotificationQuery(string query)
        {
            NotificationData notificationData = (NotificationData)null;

            try
            {
                using (OracleConnection conn = new OracleConnection(Connection.connectionString))
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    using (OracleDataReader oracleDataReader = new OracleCommand(query, conn).ExecuteReader())
                    {
                        if (oracleDataReader.HasRows)
                        {
                            if (oracleDataReader.Read())
                            {
                                notificationData = new NotificationData();
                                NotificationData.errorCategory category = NotificationData.errorCategory.TRIGGER;
                                Enum.TryParse(Convert.ToString(oracleDataReader["TRIGGER_TYPE"]), out category);
                                notificationData.category = category;
                                if (notificationData.category == NotificationData.errorCategory.NA)
                                {
                                    notificationData.category = NotificationData.errorCategory.TRIGGER;
                                }
                                if (notificationData.category == NotificationData.errorCategory.ERROR)
                                {
                                    notificationData.ErrorCode = Convert.ToString(oracleDataReader["N_VALUE"]);
                                }
                                notificationData.MachineCode = Convert.ToString(oracleDataReader["MACHINE"]);
                                //notificationData.TriggerStatus = int.Parse(Convert.ToString(oracleDataReader["IS_TRIGGER"])) == 1;
                                notificationData.IsCleared = !(int.Parse(Convert.ToString(oracleDataReader["IS_TRIGGER"])) == 1);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(notificationData);
        }