private static void PopulateRecord(Record record, System.Data.IDataReader reader) { record.Concurrency = Utilities.ToByteArray(reader["Concurrency"]); record.DateCreated = Utilities.ToNDateTime(reader["DateCreated"]); record.DateUpdated = Utilities.ToNDateTime(reader["DateUpdated"]); record.CreatedBy = Utilities.ToString(reader["CreatedBy"]); record.UpdatedBy = Utilities.ToString(reader["UpdatedBy"]); }
/// <summary> /// Calls the data layer to save the record object. /// The record's RecordId is used to determine if the save operation is an insert or an update. /// </summary> /// <param name="record">The record object containing the data to be saved.</param> public static void SaveRecord(Record record) { new DataLayer().SaveRecord(record, (record.NullableRecordId == null) ? record.CreatedBy : record.UpdatedBy); }
public static void DeleteRecord(Record record) { DataLayer dl = new DataLayer(); String type = record.GetType().ToString(); dl.DeleteRecord(Utilities.ToLong(record.RecordId), type.Substring(type.LastIndexOf(".") + 1, (type.Length - (type.LastIndexOf(".") + 1)))); }
public void SaveRecordExtended(Record record, string procName) { SqlParameter[] sqlParams = record.SqlParameters(); System.Data.Common.DbCommand cmd = _db.GetStoredProcCommand(procName); AddParameters(cmd, sqlParams); _db.ExecuteScalar(cmd); }
public void SaveRecord(Record record, string currentUser, string procName) { SqlParameter[] sqlParams = record.SqlParameters(); System.Data.Common.DbCommand cmd = _db.GetStoredProcCommand(procName); AddParameters(cmd, sqlParams); AddParameters(cmd, new SqlParameter[] { new SqlParameter("CurrentUser", currentUser) }); record.Concurrency = Utilities.ToByteArray(_db.ExecuteScalar(cmd)); record.RecordId = (long)_db.GetParameterValue(cmd, record.TypeName + "ID"); }
public void SaveRecord(Record record) { SqlParameter[] sqlParams = record.SqlParameters(); System.Data.Common.DbCommand cmd = _db.GetStoredProcCommand("procSave" + record.TypeName); AddParameters(cmd, sqlParams); record.Concurrency = Utilities.ToByteArray(_db.ExecuteScalar(cmd)); record.RecordId = (long)_db.GetParameterValue(cmd, record.TypeName + "ID"); }