本文整理汇总了C#中vwarDAL.ContentObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ContentObject.GetType方法的具体用法?C# ContentObject.GetType怎么用?C# ContentObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vwarDAL.ContentObject
的用法示例。
在下文中一共展示了ContentObject.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateContentObject
/// <summary>
///
/// </summary>
/// <param name="co"></param>
public void UpdateContentObject(ContentObject co)
{
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
int id = 0;
using (var command = conn.CreateCommand())
{
command.CommandText = "{CALL UpdateContentObject(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?); }";
command.CommandType = System.Data.CommandType.StoredProcedure;
var properties = co.GetType().GetProperties();
foreach (var prop in properties)
{
if (prop.PropertyType == typeof(String) && prop.GetValue(co, null) == null)
{
prop.SetValue(co, String.Empty, null);
}
}
FillCommandFromContentObject(co, command);
id = int.Parse(command.ExecuteScalar().ToString());
}
SaveKeywords(conn, co, id);
}
}
示例2: GetContentObjectById
/// <summary>
///
/// </summary>
/// <param name="pid"></param>
/// <param name="updateViews"></param>
/// <param name="getReviews"></param>
/// <param name="revision"></param>
/// <returns></returns>
public ContentObject GetContentObjectById(string pid, bool updateViews, bool getReviews = true, int revision = -1)
{
if (String.IsNullOrEmpty(pid))
{
return null;
}
List<ContentObject> results = new List<ContentObject>();
ContentObject resultCO = null;
if (false)//(_Memory.ContainsKey(co.PID))
{
//co = _Memory[co.PID];
}
else
{
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
using (var command = conn.CreateCommand())
{
command.CommandText = "{CALL GetContentObject(?);}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("targetpid", pid);
//command.Parameters.AddWithValue("pid", pid);
using (var result = command.ExecuteReader())
{
int NumberOfRows = 0;
while (result.Read())
{
NumberOfRows++;
var co = new ContentObject()
{
PID = pid,
Reviews = new List<Review>()
};
var properties = co.GetType().GetProperties();
foreach (var prop in properties)
{
if (prop.PropertyType == typeof(String) && prop.GetValue(co, null) == null)
{
prop.SetValue(co, String.Empty, null);
}
}
FillContentObjectFromResultSet(co, result);
LoadTextureReferences(co, conn);
LoadMissingTextures(co, conn);
LoadSupportingFiles(co, conn);
LoadReviews(co, conn);
co.Keywords = LoadKeywords(conn, co.PID);
results.Add(co);
}
ContentObject highest = null;
if (results.Count > 0)
{
if (revision == -1)
{
highest = (from r in results
orderby r.Revision descending
select r).First();
}
else
{
highest = (from r in results
where r.Revision == revision
select r).First();
}
resultCO = highest;
}
else
return null;
}
}
}
}
if (updateViews)
{
System.Data.Odbc.OdbcConnection secondConnection = GetConnection();
{
using (var command = secondConnection.CreateCommand())
{
command.CommandText = "{CALL IncrementViews(?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("targetpid", pid);
command.ExecuteNonQuery();
}
//.........这里部分代码省略.........