/// <summary> /// queues up a new emailstatistics /// </summary> /// <param name="values">settings of the emailstatistics to be generated</param> public static void generate_dataemail(statistics_values values, bool useSeparateThread) { #region checks whether thread has to be started at first... if (started_thread == null) { started_thread = new mailthread(useSeparateThread); if (useSeparateThread) { started_thread.Start(); } } #endregion Hashtable h_params = new Hashtable(); string entry_id = ""; h_params.Add("requestor_email", values.permss_user); h_params.Add("from", values.from); h_params.Add("until", values.until); h_params.Add("row_number", values.row_number); h_params.Add("ordering", values.ordering); entry_id = DB.execProc("insert_queued_statistics", h_params).Rows[0][0].ToString(); values.queue_entry_id = entry_id; started_thread.emailstatistics.Enqueue(values); if (!useSeparateThread) { started_thread.generate_statisticsemail_processingqueue(); } }
/// <summary> /// queues up a new emailreport /// </summary> /// <param name="values">settings of the emailreport to be generated</param> public static void generate_dataemail(report_values values, bool useSeparateThread) { #region checks whether thread has to be started at first... if (started_thread == null) { started_thread = new mailthread(useSeparateThread); if (useSeparateThread) { started_thread.Start(); } } #endregion //log queue entry in database Hashtable h_params = new Hashtable(); string entry_id=""; //for amster report h_params.Add("requestor_email", values.permss_user); h_params.Add("from", values.from); h_params.Add("until", values.until); //if (!values.IsMasterReport) //{ h_params.Add("questionnaire_FK", values.questionnaire_id); h_params.Add("schedule_id", values.schedule_id); h_params.Add("schedule_master_id", values.schedule_master_id); //h_params.Add("ismasterreport", values.IsMasterReport); //h_params.Add("heading", values.heading); entry_id = DB.execProc("insert_queued_report", h_params).Rows[0][0].ToString(); //} //else //{ // h_params.Add("master_fk", values.schedule_id); // int reportId = 0; // if (int.TryParse(values.schedule_id, out reportId)) // { // MasterReportQueueEntryDto entry = new MasterReportQueueEntryDto(values.permss_user, values.from, values.until, reportId); // QueueFacade.CreateQueueEntry(entry); // } //} //queueing (adding to queue) an emailreport values.queue_entry_id = entry_id; started_thread.emailreports.Enqueue(values); if (!useSeparateThread) { //if no separate thread is used then directly dequeue and process report started_thread.generate_dataemail_processingqueue(); } }