/// <summary> /// Converts Data row returned by stored procedure to a Task object /// </summary> /// <param name="datarow">Data row to be converted</param> /// <returns>Converted Task object returned</returns> private SearchAlertsTaskBEO ConvertToTask(DataRow datarow) { SearchAlertsTaskBEO searchAlertsTaskBeo; try { DocumentQueryEntity tmpSearchContext = null; if (!datarow[Constants.GA_SEARCH_QUERY].Equals(DBNull.Value)) { tmpSearchContext = (DocumentQueryEntity)XmlUtility.DeserializeObject (datarow[Constants.GA_SEARCH_QUERY].ToString(), typeof(DocumentQueryEntity)); } searchAlertsTaskBeo = new SearchAlertsTaskBEO { SearchAlert = new SearchAlertEntity { AlertId = (datarow[Constants.GA_SEARCH_ALERT_ID].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_SEARCH_ALERT_ID]), Duration = (datarow[Constants.GA_DURATION_IN_MINUTES].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt32(datarow[Constants.GA_DURATION_IN_MINUTES]), LastRunDate = (datarow[Constants.GA_LAST_RUN_DATE].Equals(DBNull.Value)) ? Constants.MSSQL2005_MINDATE : Convert.ToDateTime(datarow[Constants.GA_LAST_RUN_DATE]), Name = (datarow[Constants.GA_SEARCH_ALERT_NAME].Equals(DBNull.Value)) ? string.Empty : datarow[Constants.GA_SEARCH_ALERT_NAME].ToString(), NextRunDate = (datarow[Constants.GA_NEXT_RUN_DATE].Equals(DBNull.Value)) ? Constants.MSSQL2005_MINDATE : Convert.ToDateTime(datarow[Constants.GA_NEXT_RUN_DATE].ToString().Trim()), NotificationId = (datarow[Constants.GA_NOTIFICATION_ID].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_NOTIFICATION_ID]), OwnerId = (datarow[Constants.GA_OWNER_ID].Equals(DBNull.Value)) ? string.Empty : datarow[Constants.GA_OWNER_ID].ToString(), ActualOccurrenceCount = (datarow[Constants.GA_ACUAL_OCCURANCE_COUNT].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_ACUAL_OCCURANCE_COUNT]), CreatedBy = (datarow[Constants.GA_CREATED_BY].Equals(DBNull.Value)) ? String.Empty : datarow[Constants.GA_CREATED_BY].ToString(), DocumentQuery = tmpSearchContext, IsActive = Convert.ToBoolean(datarow[Constants.IsActive]) } }; } catch { //--RVWSEarchBEO type is deprecated and no longer supported. hence past records can not be processed and returned.. return(null); } // return the task object return(searchAlertsTaskBeo); }
/// <summary> /// Converts Data row returned by stored procedure to a Task object /// </summary> /// <param name="datarow">Data row to be converted</param> /// <returns>Converted Task object returned</returns> private SearchAlertsTaskBEO ConvertToTask(DataRow datarow) { SearchAlertsTaskBEO searchAlertsTaskBeo; try { DocumentQueryEntity tmpSearchContext = null; if (!datarow[Constants.GA_SEARCH_QUERY].Equals(DBNull.Value)) { tmpSearchContext = (DocumentQueryEntity)XmlUtility.DeserializeObject (datarow[Constants.GA_SEARCH_QUERY].ToString(), typeof(DocumentQueryEntity)); } searchAlertsTaskBeo = new SearchAlertsTaskBEO { SearchAlert = new SearchAlertEntity { AlertId = (datarow[Constants.GA_SEARCH_ALERT_ID].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_SEARCH_ALERT_ID]), Duration = (datarow[Constants.GA_DURATION_IN_MINUTES].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt32(datarow[Constants.GA_DURATION_IN_MINUTES]), LastRunDate = (datarow[Constants.GA_LAST_RUN_DATE].Equals(DBNull.Value)) ? Constants.MSSQL2005_MINDATE : Convert.ToDateTime(datarow[Constants.GA_LAST_RUN_DATE]), Name = (datarow[Constants.GA_SEARCH_ALERT_NAME].Equals(DBNull.Value)) ? string.Empty : datarow[Constants.GA_SEARCH_ALERT_NAME].ToString(), NextRunDate = (datarow[Constants.GA_NEXT_RUN_DATE].Equals(DBNull.Value)) ? Constants.MSSQL2005_MINDATE : Convert.ToDateTime(datarow[Constants.GA_NEXT_RUN_DATE].ToString().Trim()), NotificationId = (datarow[Constants.GA_NOTIFICATION_ID].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_NOTIFICATION_ID]), OwnerId = (datarow[Constants.GA_OWNER_ID].Equals(DBNull.Value)) ? string.Empty : datarow[Constants.GA_OWNER_ID].ToString(), ActualOccurrenceCount = (datarow[Constants.GA_ACUAL_OCCURANCE_COUNT].Equals(DBNull.Value)) ? Constants.INTEGER_INITIALIZE_VALUE : Convert.ToInt64(datarow[Constants.GA_ACUAL_OCCURANCE_COUNT]), CreatedBy = (datarow[Constants.GA_CREATED_BY].Equals(DBNull.Value)) ? String.Empty : datarow[Constants.GA_CREATED_BY].ToString(), DocumentQuery = tmpSearchContext, IsActive = Convert.ToBoolean(datarow[Constants.IsActive]) } }; } catch { //--RVWSEarchBEO type is deprecated and no longer supported. hence past records can not be processed and returned.. return null; } // return the task object return searchAlertsTaskBeo; }