public static void emailLogUpdater(ClarifyDataRow record, HistoryItem historyItem, ISchemaCache schemaCache) { var log = new StringBuilder(); var from = record.AsString("sender"); var to = record.AsString("recipient"); var cclist = record.AsTrimmedString("cc_list"); var subject = doesEmailLogSubjectExist(schemaCache) ? record.AsTrimmedString("x_subject") : ""; var message = record.AsString("message"); var isoDate = record.AsDateTime("creation_time").ToString("s", CultureInfo.InvariantCulture); log.Append(HistoryParsers.BEGIN_EMAIL_LOG_HEADER); log.AppendLine("{0}: {1}{2}".ToFormat(HistoryBuilderTokens.LOG_EMAIL_DATE, HistoryParsers.BEGIN_ISODATE_HEADER, isoDate)); const string headerFormat = "{0}: {1}"; log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_FROM, from)); log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_TO, to)); if (cclist.IsNotEmpty()) log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_CC, cclist)); if (subject.IsNotEmpty()) log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_SUBJECT, subject)); log.Append(HistoryParsers.END_EMAIL_LOG_HEADER); log.AppendLine(message); historyItem.Detail = log.ToString(); }
public HistoryItemEmployee Assemble(ClarifyDataRow actEntryRecord) { var proxy = actEntryRecord.AsString("proxy"); if (proxy.IsEmpty()) { return(null); } var ds = _session.CreateDataSet(); var generic = ds.CreateGeneric("empl_user"); generic.Filter(_ => _.Equals("login_name", proxy)); generic.Query(); if (generic.Rows.Count == 0) { return(null); } var employeeRecord = generic.Rows[0]; var name = "{0} {1}".ToFormat(employeeRecord.AsString("first_name"), employeeRecord.AsString("last_name")); var id = employeeRecord.AsInt("employee"); return(new HistoryItemEmployee { Name = name, Firstname = employeeRecord.AsString("first_name"), Lastname = employeeRecord.AsString("last_name"), Id = id, Login = proxy }); }
private static void timeAndExpensesUpdater(ClarifyDataRow record, HistoryItem historyItem) { var timeDescribed = TimeSpan.FromSeconds(record.AsInt("total_time")); var expense = Convert.ToDecimal(record["total_exp"]).ToString("C"); var notes = record.AsString("notes"); var detail = HistoryBuilderTokens.LOG_EXPENSES_DETAIL.ToFormat(Environment.NewLine, timeDescribed, expense, notes); historyItem.Detail = detail; }
private static void setInternalLog(ClarifyDataRow row, HistoryItem dto, string noteField) { var isNewInternalNote = row.AsInt("x_is_internal") == 1; var notes = row.AsString(noteField); var @internal = row.AsString("internal"); dto.Detail = isNewInternalNote ? "" : notes; dto.Internal = isNewInternalNote ? notes : @internal; }