本文整理汇总了C#中vwarDAL.ContentObject类的典型用法代码示例。如果您正苦于以下问题:C# ContentObject类的具体用法?C# ContentObject怎么用?C# ContentObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentObject类属于vwarDAL命名空间,在下文中一共展示了ContentObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModelDownloaded
public static String ModelDownloaded(ContentObject co)
{
System.Threading.ParameterizedThreadStart t = new System.Threading.ParameterizedThreadStart(ModelDownloaded_thread);
System.Threading.Thread th = new System.Threading.Thread(t);
th.Start(co);
return "Thread fired";
}
开发者ID:immersiveeducation,项目名称:3D-Repository,代码行数:7,代码来源:3DR_LR_Bridge.cs
示例2: button1_Click
private void button1_Click(object sender, RoutedEventArgs e)
{
ContentObject co = new ContentObject();
co.PID = "adl:1";
co.SubmitterEmail = "[email protected]";
co.Keywords="test,boat,model,gun";
string result = LR_3DR_Bridge.ModelUploadedInternal(co);
}
开发者ID:grrizzly,项目名称:3D-Repository,代码行数:8,代码来源:MainWindow.xaml.cs
示例3: DeleteContentObject
public void DeleteContentObject(ContentObject co)
{
string pid = co.PID.Replace(":", "_");
string dir = m_DataDir + pid +"\\";
foreach (string file in Directory.GetFiles(dir))
{
File.Delete(file);
}
Directory.Delete(dir);
}
开发者ID:windrobin,项目名称:3D-Repository,代码行数:10,代码来源:LocalFileSystemStore.cs
示例4: ValidationViewSubmitButton_Click
protected void ValidationViewSubmitButton_Click(object sender, EventArgs e)
{
/* if (this.FedoraContentObject == null || String.IsNullOrEmpty(this.FedoraContentObject.PID))
{
FedoraContentObject = DAL.GetContentObjectById(ContentObjectID, false, false); ;
}*/
vwarDAL.IDataRepository dal = (new vwarDAL.DataAccessFactory()).CreateDataRepositorProxy(); ;
FedoraContentObject = dal.GetContentObjectById(ContentObjectID, false, false);
if (!string.IsNullOrEmpty(this.UnitScaleTextBox.Text))
{
this.FedoraContentObject.UnitScale = this.UnitScaleTextBox.Text.Trim();
}
this.FedoraContentObject.UpAxis = this.UpAxisRadioButtonList.SelectedValue.Trim();
//polygons
int numPolys = 0;
if (int.TryParse(NumPolygonsTextBox.Text, out numPolys))
{
FedoraContentObject.NumPolygons = numPolys;
}
int numTextures = 0;
if (int.TryParse(NumTexturesTextBox.Text, out numTextures))
{
FedoraContentObject.NumTextures = numTextures;
}
FedoraContentObject.Enabled = true;
dal.UpdateContentObject(this.FedoraContentObject);
//redirect
Response.Redirect(Website.Pages.Types.FormatModel(this.ContentObjectID));
dal.Dispose();
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:35,代码来源:Edit.ascx.cs
示例5: PopulateValidationViewMetadata
protected void PopulateValidationViewMetadata(ContentObject co)
{
UnitScaleTextBox.Text = co.UnitScale;
try
{
UpAxisRadioButtonList.SelectedValue = co.UpAxis;
}
catch { }
NumPolygonsTextBox.Text = co.NumPolygons.ToString();
NumTexturesTextBox.Text = co.NumTextures.ToString();
UVCoordinateChannelTextBox.Text = "1";
if (!String.IsNullOrEmpty(co.ScreenShot))
{
ThumbnailImage.ImageUrl =
Page.ResolveClientUrl("~/Public/Serve.ashx") + "?pid=" + co.PID + "&mode=GetThumbnail";
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:18,代码来源:Edit.ascx.cs
示例6: UploadSponsorLogo
private void UploadSponsorLogo(vwarDAL.IDataRepository dal, ContentObject co)
{
if (this.SponsorLogoRadioButtonList.SelectedItem != null)
{
switch (this.SponsorLogoRadioButtonList.SelectedValue.Trim())
{
case "0": //use profile logo
//use profile logo if use current and there's an empty file name otherwise don't change
if (string.IsNullOrEmpty(co.SponsorLogoImageFileName))
{
DataTable dt = UserProfileDB.GetUserProfileSponsorLogoByUserName(Context.User.Identity.Name);
if (dt != null && dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
if (dr["Logo"] != System.DBNull.Value && dr["LogoContentType"] != System.DBNull.Value && !string.IsNullOrEmpty(dr["LogoContentType"].ToString()))
{
var data = (byte[])dr["Logo"];
using (MemoryStream s = new MemoryStream())
{
s.Write(data, 0, data.Length);
s.Position = 0;
//filename
co.SponsorLogoImageFileName = "sponsor.jpg";
if (!string.IsNullOrEmpty(dr["FileName"].ToString()))
{
co.SponsorLogoImageFileName = dr["FileName"].ToString();
}
FedoraContentObject.SponsorLogoImageFileNameId =
dal.SetContentFile(s, co, co.SponsorLogoImageFileName);
}
}
}
}
break;
case "1": //Upload logo
if (this.SponsorLogoFileUpload.FileContent.Length > 0 && !string.IsNullOrEmpty(this.SponsorLogoFileUpload.FileName))
{
co.SponsorLogoImageFileName = this.SponsorLogoFileUpload.FileName;
co.DeveloperLogoImageFileNameId = dal.SetContentFile(this.SponsorLogoFileUpload.FileContent, co, this.SponsorLogoFileUpload.FileName);
}
break;
case "2": //none
break;
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:59,代码来源:Edit.ascx.cs
示例7: LoadReviews
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="connection"></param>
private void LoadReviews(ContentObject co, OdbcConnection connection)
{
using (var command = connection.CreateCommand())
{
command.CommandText = "{CALL GetReviews(?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("pid", co.PID);
var result = command.ExecuteReader();
while (result.Read())
{
co.Reviews.Add(new Review()
{
Rating = int.Parse(result["Rating"].ToString()),
Text = result["Text"].ToString(),
SubmittedBy = result["SubmittedBy"].ToString(),
SubmittedDate = DateTime.Parse(result["SubmittedDate"].ToString())
});
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:25,代码来源:MySqlMetadataStore.cs
示例8: AddMissingTexture
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="filename"></param>
/// <param name="type"></param>
/// <param name="UVset"></param>
/// <returns></returns>
public bool AddMissingTexture(ContentObject co, string filename, string type, int UVset)
{
System.Data.Odbc.OdbcConnection connection = GetConnection();
{
using (var command = connection.CreateCommand())
{
//AddMissingTexture(pid,filename,texturetype,uvset)
command.CommandText = "{CALL AddMissingTexture(?,?,?,?,?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("filename", filename);
command.Parameters.AddWithValue("texturetype", type);
command.Parameters.AddWithValue("uvset", UVset);
command.Parameters.AddWithValue("pid", co.PID);
command.Parameters.AddWithValue("revision", co.Revision);
var result = command.ExecuteReader();
co.MissingTextures.Add(new Texture(filename, type, 0));
}
}
return true;
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:30,代码来源:MySqlMetadataStore.cs
示例9: 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();
}
//.........这里部分代码省略.........
开发者ID:adlnet,项目名称:3D-Repository,代码行数:101,代码来源:MySqlMetadataStore.cs
示例10: GetAllContentObjects
public IEnumerable<ContentObject> GetAllContentObjects(string UserName)
{
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
List<ContentObject> objects = new List<ContentObject>();
using (var command = conn.CreateCommand())
{
command.CommandText = "{CALL GetAllContentObjectsVisibleToUser(?)}";
command.Parameters.AddWithValue("uname", UserName);
command.CommandType = System.Data.CommandType.StoredProcedure;
using (var resultSet = command.ExecuteReader())
{
while (resultSet.Read())
{
var co = new ContentObject();
FillContentObjectFromResultSet(co, resultSet);
LoadReviews(co, conn);
co.Keywords = LoadKeywords(conn, co.PID);
objects.Add(co);
}
}
}
return objects;
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:28,代码来源:MySqlMetadataStore.cs
示例11: DeleteContentObject
/// <summary>
///
/// </summary>
/// <param name="co"></param>
public void DeleteContentObject(ContentObject co)
{
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
using (var command = conn.CreateCommand())
{
command.CommandText = "{CALL DeleteContentObject(?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.Add("targetpid", System.Data.Odbc.OdbcType.VarChar, 45).Value = co.PID;
command.ExecuteNonQuery();
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:19,代码来源:MySqlMetadataStore.cs
示例12: AddSupportingFile
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="filename"></param>
/// <param name="description"></param>
public void AddSupportingFile(ContentObject co, string filename, string description, string dsid)
{
System.Data.Odbc.OdbcConnection connection = GetConnection();
{
using (var command = connection.CreateCommand())
{
//AddMissingTexture(pid,filename,texturetype,uvset)
command.CommandText = "{CALL AddSupportingFile(?,?,?,?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("newfilename", filename);
command.Parameters.AddWithValue("newdescription", description);
command.Parameters.AddWithValue("newcontentobjectid", co.PID);
command.Parameters.AddWithValue("newdsid", dsid);
var result = command.ExecuteReader();
//while (result.Read())
//{
co.SupportingFiles.Add(new SupportingFile(filename, description,dsid));
// }
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:31,代码来源:MySqlMetadataStore.cs
示例13: SaveKeywords
/// <summary>
///
/// </summary>
/// <param name="conn"></param>
/// <param name="co"></param>
/// <param name="id"></param>
private void SaveKeywords(OdbcConnection conn, ContentObject co, int id)
{
char[] delimiters = new char[] { ',' };
string[] words = co.Keywords.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
string[] oldKeywords = LoadKeywords(conn, co.PID).Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
List<String> wordsToSave = new List<string>();
foreach (var word in words)
{
bool shouldSave = true;
foreach (var oldWord in oldKeywords)
{
if (oldWord.Equals(word, StringComparison.InvariantCultureIgnoreCase))
{
shouldSave = false;
break;
}
}
if (shouldSave)
{
wordsToSave.Add(word);
}
}
words = wordsToSave.ToArray();
foreach (var keyword in words)
{
int keywordId = 0;
using (var command = conn.CreateCommand())
{
command.CommandText = "{CALL InsertKeyword(?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("newKeyword", keyword);
keywordId = int.Parse(command.ExecuteScalar().ToString());
}
using (var cm = conn.CreateCommand())
{
cm.CommandText = "{CALL AssociateKeyword(?,?)}";
cm.CommandType = System.Data.CommandType.StoredProcedure;
cm.Parameters.AddWithValue("coid", id);
cm.Parameters.AddWithValue("kid", keywordId);
cm.ExecuteNonQuery();
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:49,代码来源:MySqlMetadataStore.cs
示例14: LoadSupportingFiles
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="connection"></param>
/// <returns></returns>
private bool LoadSupportingFiles(ContentObject co, OdbcConnection connection)
{
using (var command = connection.CreateCommand())
{
command.CommandText = "{CALL GetSupportingFiles(?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("pid", co.PID);
var result = command.ExecuteReader();
while (result.Read())
{
co.SupportingFiles.Add(new SupportingFile(result["Filename"].ToString(), result["Description"].ToString(), result["dsid"].ToString()));
}
}
return true;
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:21,代码来源:MySqlMetadataStore.cs
示例15: httpSearch
private bool httpSearch(string term, ContentObject target)
{
bool found = false;
string urlTemplate = String.Format(_baseUrl + "/Search/{0}/json?ID={1}", term, _apiKey);
List<SearchResult> results = _serializer.Deserialize<List<SearchResult>>(getRawJSON(urlTemplate));
foreach (SearchResult sr in results)
{
if (sr.PID.Equals(target.PID))
{
found = true;
break;
}
}
return found;
}
开发者ID:jamjr,项目名称:3D-Repository,代码行数:17,代码来源:RestAPITest.cs
示例16: FillContentObjectFromResultSet
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="resultSet"></param>
private void FillContentObjectFromResultSet(ContentObject co, OdbcDataReader resultSet)
{
try
{
co.PID = resultSet["PID"].ToString();
co.ArtistName = resultSet["ArtistName"].ToString();
co.AssetType = resultSet["AssetType"].ToString();
co.CreativeCommonsLicenseURL = resultSet["CreativeCommonsLicenseURL"].ToString();
co.Description = resultSet["Description"].ToString();
co.DeveloperLogoImageFileName = resultSet["DeveloperLogoFileName"].ToString();
co.DeveloperLogoImageFileNameId = resultSet["DeveloperLogoFileId"].ToString();
co.DeveloperName = resultSet["DeveloperName"].ToString();
co.DisplayFile = resultSet["DisplayFileName"].ToString();
co.DisplayFileId = resultSet["DisplayFileId"].ToString();
co.Downloads = int.Parse(resultSet["Downloads"].ToString());
co.Format = resultSet["Format"].ToString();
co.IntentionOfTexture = resultSet["IntentionOfTexture"].ToString();
DateTime temp;
if (DateTime.TryParse(resultSet["LastModified"].ToString(), out temp))
{
co.LastModified = temp;
}
if (DateTime.TryParse(resultSet["LastViewed"].ToString(), out temp))
{
co.LastViewed = temp;
}
co.Location = resultSet["ContentFileName"].ToString();
co.MoreInformationURL = resultSet["MoreInfoUrl"].ToString();
co.NumPolygons = int.Parse(resultSet["NumPolygons"].ToString());
co.NumTextures = int.Parse(resultSet["NumTextures"].ToString());
co.ScreenShot = resultSet["ScreenShotFileName"].ToString();
co.ScreenShotId = resultSet["ScreenShotFileId"].ToString();
co.SponsorLogoImageFileName = resultSet["SponsorLogoFileName"].ToString();
co.SponsorLogoImageFileNameId = resultSet["SponsorLogoFileId"].ToString();
co.SponsorName = resultSet["SponsorName"].ToString();
co.SubmitterEmail = resultSet["Submitter"].ToString();
co.Title = resultSet["Title"].ToString();
co.Thumbnail = resultSet["ThumbnailFileName"].ToString();
co.ThumbnailId = resultSet["ThumbnailFileId"].ToString();
co.UnitScale = resultSet["UnitScale"].ToString();
co.UpAxis = resultSet["UpAxis"].ToString();
if (DateTime.TryParse(resultSet["UploadedDate"].ToString(), out temp))
{
co.UploadedDate = temp;
}
co.UVCoordinateChannel = resultSet["UVCoordinateChannel"].ToString();
co.Views = int.Parse(resultSet["Views"].ToString());
co.Revision = Convert.ToInt32(resultSet["Revision"].ToString());
var RequiresResubmit = resultSet["requiressubmit"].ToString();
var RequiresResubmitValue = int.Parse(RequiresResubmit);
co.RequireResubmit = RequiresResubmitValue != 0;
co.OriginalFileName = resultSet["OriginalFileName"].ToString();
co.OriginalFileId = resultSet["OriginalFileId"].ToString();
}
catch
{
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:65,代码来源:MySqlMetadataStore.cs
示例17: FillContentObjectLightLoad
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="resultSet"></param>
private void FillContentObjectLightLoad(ContentObject co, OdbcDataReader resultSet)
{
try
{
co.PID = resultSet["PID"].ToString();
co.Description = resultSet["Description"].ToString();
co.Title = resultSet["Title"].ToString();
co.ScreenShot = resultSet["ScreenShotFileName"].ToString();
co.ScreenShotId = resultSet["ScreenShotFileId"].ToString();
co.Views = int.Parse(resultSet["Views"].ToString());
co.ThumbnailId = resultSet["ThumbnailFileId"].ToString();
co.Thumbnail = resultSet["ThumbnailFileName"].ToString();
}
catch
{
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:22,代码来源:MySqlMetadataStore.cs
示例18: GetContentObjectsByField
public IEnumerable<ContentObject> GetContentObjectsByField(string field, string value, string identity)
{
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
List<ContentObject> objects = new List<ContentObject>();
using (var command = conn.CreateCommand())
{
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "{CALL GetContentObjectsByField(?,?,?)}";
command.Parameters.AddWithValue("field", field);
command.Parameters.AddWithValue("val", value);
command.Parameters.AddWithValue("uname", identity);
using (var resultSet = command.ExecuteReader())
{
while (resultSet.Read())
{
var co = new ContentObject();
FillContentObjectLightLoad(co, resultSet);
objects.Add(co);
}
}
}
return objects;
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:28,代码来源:MySqlMetadataStore.cs
示例19: LoadMissingTextures
/// <summary>
///
/// </summary>
/// <param name="co"></param>
/// <param name="connection"></param>
private void LoadMissingTextures(ContentObject co, OdbcConnection connection)
{
using (var command = connection.CreateCommand())
{
command.CommandText = "{CALL GetMissingTextures(?,?)}";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("pid", co.PID);
command.Parameters.AddWithValue("revision", co.Revision);
var result = command.ExecuteReader();
while (result.Read())
{
co.MissingTextures.Add(new Texture(result["Filename"].ToString(), result["Type"].ToString(), int.Parse(result["UVSet"].ToString())));
}
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:20,代码来源:MySqlMetadataStore.cs
示例20: GetContentObjectsByKeywords
public IEnumerable<ContentObject> GetContentObjectsByKeywords(string keywords, string identity)
{
//We must transform the list into something MySQL finds acceptible in its syntax
char[] delimiters = new char[] { ',' };
string[] list = keywords.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
string escapeTemplate = "'{0}'";
//Add quotes around each of the list items, while also escaping any existing quotes
for (int i = 0; i < list.Length; i++)
list[i] = String.Format(escapeTemplate, list[i].Replace("'", "\'"));
keywords = String.Join(",", list);
System.Data.Odbc.OdbcConnection conn = GetConnection();
{
List<ContentObject> objects = new List<ContentObject>();
using (var cmd = conn.CreateCommand())
{
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "{CALL GetContentObjectsByKeywords(?,?)}";
cmd.Parameters.AddWithValue("keylist", keywords);
cmd.Parameters.AddWithValue("uname", identity);
using (var results = cmd.ExecuteReader())
{
while (results.HasRows && results.Read())
{
ContentObject co = new ContentObject();
FillContentObjectLightLoad(co, results);
objects.Add(co);
}
}
}
return objects;
}
}
开发者ID:adlnet,项目名称:3D-Repository,代码行数:37,代码来源:MySqlMetadataStore.cs
注:本文中的vwarDAL.ContentObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论