public ContentResult GetTimesheetProcessingProgress(string id) { ControllerContext.HttpContext.Response.Headers.Add("cache-control", "no-cache"); return(Content("{ \"status\" : \"" + LongRunningTaskBase.GetStatus(id).ToString() + "\", \"statusMessage\" : \"" + LongRunningTaskBase.GetStatusMessage(id).ToString() + "\" }")); }
protected void createEXPTRANSACTIONS(LongRunningTaskBase task, OracleConnection conn, String date0, String date1) { using (OracleCommand command = conn.CreateCommand()) { string sql = "SELECT TRANSACTIONS.EXEC_DATE, TRANSACTIONS.DESCR, T_DETAILS.NAME, T_DETAILS.AMOUNT, T_DETAILS.CUR, PROJECTS.SHORT_NAME, TRANSACTIONS.BITRIX_NUMBER,\n" + " TRANSACTIONS.EXPENSE_TYPE_CODE, EXPENSE_TYPES.SHORT_NAME,\n" + " FROMBOOK.SHORT_NAME, FROMBOOK.BOOK_ID,\n" + " UNITS.UNIT_INDEX, UNITS.SHORT_NAME,\n" + " T_TYPES.NAME,\n" + " FROMBOOK.BOOK_INDEX, FROMBOOK.GROUP_ID,\n" + " TOBOOK.SHORT_NAME, TOBOOK.BOOK_ID, TOBOOK.BOOK_INDEX, TOBOOK.GROUP_ID,\n" + " TRANSACTIONS.ORG\n" + " FROM DK_PROD.TRANSACTIONS\n" + " LEFT OUTER JOIN DK_PROD.T_DETAILS ON TRANSACTIONS.T_ID = T_DETAILS.T_ID\n" + " LEFT OUTER JOIN DK_PROD.PROJECTS ON TRANSACTIONS.PROJECT_ID = PROJECTS.PROJECT_ID\n" + " LEFT OUTER JOIN DK_PROD.BOOKS FROMBOOK ON TRANSACTIONS.FROM_BOOK = FROMBOOK.BOOK_ID\n" + " LEFT OUTER JOIN DK_PROD.BOOKS TOBOOK ON TRANSACTIONS.TO_BOOK = TOBOOK.BOOK_ID\n" + " LEFT OUTER JOIN DK_PROD.T_TYPES ON TRANSACTIONS.T_TYPE = T_TYPES.T_TYPE\n" + " LEFT OUTER JOIN DK_PROD.EXPENSE_TYPES ON TRANSACTIONS.EXPENSE_TYPE_CODE = EXPENSE_TYPES.CODE\n" + " LEFT OUTER JOIN DK_PROD.UNITS ON TRANSACTIONS.UNIT_ID = UNITS.UNIT_ID\n" + " WHERE TRANSACTIONS.EXEC_DATE between to_date('" + date0 + "', 'YYYY-MM-DD') AND to_date('" + date1 + "', 'YYYY-MM-DD')\n" + " AND TRANSACTIONS.PROJECT_ID is not null\n" + " AND TRANSACTIONS.T_TYPE IN (2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16)\n" + " AND TRANSACTIONS.FROM_BOOK is not null\n" + " ORDER BY TRANSACTIONS.EXEC_DATE"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { try { int recordsCount = 0; while (reader.Read()) { TRANSACTIONSRecord tr = new TRANSACTIONSRecord(); EXP_TRANSACTIONS.Add(tr); tr.EXEC_DATE = reader.GetOracleValue(0).ToString(); try { int i = tr.EXEC_DATE.IndexOf(' '); if (i > 0) { tr.EXEC_DATE = tr.EXEC_DATE.Substring(0, i); } } catch (Exception ex) { tr.EXEC_DATE = ""; } tr.DESCR = reader.GetOracleValue(1).ToString(); tr.T_DETAILS_NAME = reader.GetOracleValue(2).ToString(); try { tr.T_DETAILS_AMOUNT = (double)(reader.GetDouble(3)); } catch (Exception ex) { tr.T_DETAILS_AMOUNT = 0; } tr.T_DETAILS_CUR = reader.GetOracleValue(4).ToString(); tr.PROJECT_SHORT_NAME = reader.GetOracleValue(5).ToString(); try { tr.BITRIX_NUMBER = reader.GetOracleValue(6).ToString(); tr.EXPENSE_TYPE_CODE = reader.GetOracleValue(7).ToString(); tr.EXPENSE_TYPE_SHORT_NAME = reader.GetOracleValue(8).ToString(); tr.FROMBOOK_SHORT_NAME = reader.GetOracleValue(9).ToString(); tr.FROMBOOK_ID = reader.GetOracleValue(10).ToString(); tr.UNIT_INDEX = reader.GetOracleValue(11).ToString(); tr.UNIT_SHORT_NAME = reader.GetOracleValue(12).ToString(); tr.T_TYPE_NAME = reader.GetOracleValue(13).ToString(); tr.FROMBOOK_INDEX = reader.GetOracleValue(14).ToString(); tr.FROMBOOK_GROUP_ID = reader.GetOracleValue(15).ToString(); tr.TOBOOK_SHORT_NAME = reader.GetOracleValue(16).ToString(); tr.TOBOOK_ID = reader.GetOracleValue(17).ToString(); tr.TOBOOK_INDEX = reader.GetOracleValue(18).ToString(); tr.TOBOOK_GROUP_ID = reader.GetOracleValue(19).ToString(); tr.ORG = reader.GetOracleValue(20).ToString(); } catch (Exception) { } recordsCount++; task.SetStatus(50 + 2 * recordsCount / 500, "Прочитано записей о транзакциях: " + recordsCount.ToString()); } } catch (Exception e) { task.SetStatus(-1, "Ошибка: " + e.Message); } reader.Close(); } } }