public bool IsRecordApproved(Guid recordGuid)
{
try
{
bool result = false;
string sql = "SELECT state FROM UFRecords WHERE Id = @recordId";
var reader = umbraco.BusinessLogic.Application.SqlHelper.ExecuteReader(sql, SqlParameter("@recordId", recordGuid.ToString()));
while(reader.Read())
{
int state = reader.GetInt("state");
if (state == 4)
result = true;
}
return result;
}
catch (Exception)
{
// If anything went wrong, we just want to approve the record
return false;
}
}
IParameter SqlParameter(string parameterName, object value)
{
return (umbraco.BusinessLogic.Application.SqlHelper.CreateParameter(parameterName, value));
}
Check the state of a record from C#
Hi all,
I'm currently working on a project where I'm using Contour. On a UserControl, I need to check if a record has been approved or not.
I've tried to make use of the State property on the Record object, but without any luck.
Is there any way to, programaticall, check the current state of a record? :-)
Thanks in advance.
All the best,
Bo
I went and wrote my own helper method for it:
is working on a reply...