本文整理汇总了C#中OpenDMS.Storage.Providers.EngineRequest类的典型用法代码示例。如果您正苦于以下问题:C# EngineRequest类的具体用法?C# EngineRequest怎么用?C# EngineRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EngineRequest类属于OpenDMS.Storage.Providers命名空间,在下文中一共展示了EngineRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public override void Test()
{
OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
request.Engine = _engine;
request.Database = _db;
request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
request.OnProgress += new EngineBase.ProgressDelegate(Progress);
request.OnComplete += new EngineBase.CompletionDelegate(Complete);
request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
request.OnError += new EngineBase.ErrorDelegate(Error);
request.AuthToken = _window.Session.AuthToken;
request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;
Clear();
Search.Query query = new Search.Query();
Search.Tokens.Field tags = new Search.Tokens.Field("tags");
tags.Tokens.Add(new Search.Tokens.Term("tag1"));
query.Add(tags);
Search.Tokens.Field content = new Search.Tokens.Field("attachment");
content.Tokens.Add(new Search.Tokens.Term("content"));
query.Add(content);
WriteLine("Starting SearchTest test...");
_start = DateTime.Now;
_engine.Search(request, new SearchArgs(query));
}
示例2: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
WriteLine("SearchTest.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
}
示例3: Test
public override void Test()
{
OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
request.Engine = _engine;
request.Database = _db;
request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
request.OnProgress += new EngineBase.ProgressDelegate(Progress);
request.OnComplete += new EngineBase.CompletionDelegate(Complete);
request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
request.OnError += new EngineBase.ErrorDelegate(Error);
request.AuthToken = _window.Session.AuthToken;
request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;
Clear();
WriteLine("Starting ModifyResourceUsageRightsTemplate test...");
OpenDMS.Storage.Security.UsageRight ur1 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("administrators"), OpenDMS.Storage.Security.Authorization.ResourcePermissionType.All);
OpenDMS.Storage.Security.UsageRight ur2 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("users"),
OpenDMS.Storage.Security.Authorization.ResourcePermissionType.Checkout |
OpenDMS.Storage.Security.Authorization.ResourcePermissionType.ReadOnly);
System.Collections.Generic.List<OpenDMS.Storage.Security.UsageRight> list = new System.Collections.Generic.List<OpenDMS.Storage.Security.UsageRight>();
list.Add(ur1);
list.Add(ur2);
_start = DateTime.Now;
_engine.ModifyResourceUsageRightsTemplate(request, list);
}
示例4: EngineAction
private void EngineAction(EngineRequest request, EngineActionType actionType, bool willSendProgress)
{
if (willSendProgress)
WriteLine("ModifyResourceUsageRightsTemplate.EngineAction - Type: " + actionType.ToString() + " Expecting Progress Reports.");
else
WriteLine("ModifyResourceUsageRightsTemplate.EngineAction - Type: " + actionType.ToString() + " NOT Expecting Progress Reports.");
}
示例5: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
Tuple<Resource, OpenDMS.Storage.Data.Version> r = (Tuple<Resource, OpenDMS.Storage.Data.Version>)result;
WriteLine("CreateNewResource.Complete - Resource: " + r.Item1.ResourceId.ToString() + " and Version: " + r.Item2.VersionId.ToString() + " successfully created in " + duration.TotalMilliseconds.ToString() + "ms.");
}
示例6: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
ResourceUsageRightsTemplate template = (ResourceUsageRightsTemplate)result;
WriteLine("ModifyResourceUsageRightsTemplate.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
}
示例7: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
GlobalUsageRights gur = (GlobalUsageRights)result;
WriteLine("GetGlobalPermissions.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
}
示例8: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
List<OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply.Entry> results = (List<OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply.Entry>)result;
WriteLine("DeleteResource.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
for(int i=0; i<results.Count; i++)
WriteLine("\tId: " + results[i].Id.ToString());
}
示例9: Test
public override void Test()
{
OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
request.Engine = _engine;
request.Database = _db;
request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
request.OnProgress += new EngineBase.ProgressDelegate(Progress);
request.OnComplete += new EngineBase.CompletionDelegate(Complete);
request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
request.OnError += new EngineBase.ErrorDelegate(Error);
request.AuthToken = _window.Session.AuthToken;
request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;
Clear();
OpenDMS.Storage.Providers.CreateResourceArgs resourceArgs = new CreateResourceArgs()
{
VersionArgs = new CreateVersionArgs()
};
resourceArgs.Metadata = new OpenDMS.Storage.Data.Metadata();
resourceArgs.Tags = new List<string>();
resourceArgs.Tags.Add("Tag1");
resourceArgs.Tags.Add("Tag2");
resourceArgs.Title = "Test resource";
resourceArgs.VersionArgs.Extension = "txt";
resourceArgs.VersionArgs.Metadata = new OpenDMS.Storage.Data.Metadata();
System.IO.FileStream fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
byte[] bytes = System.Text.Encoding.ASCII.GetBytes("This is a test content file.");
fs.Write(bytes, 0, bytes.Length);
fs.Flush();
fs.Close();
fs.Dispose();
fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] data = md5.ComputeHash(fs);
string output = "";
fs.Close();
md5.Dispose();
fs.Dispose();
for (int i = 0; i < data.Length; i++)
output += data[i].ToString("x2");
resourceArgs.VersionArgs.Md5 = output;
resourceArgs.VersionArgs.Content = new OpenDMS.Storage.Data.Content(bytes.Length, new OpenDMS.Storage.Data.ContentType("text/plain"), "testdoc.txt");
WriteLine("Starting CreateNewResource test...");
_start = DateTime.Now;
_engine.CreateNewResource(request, resourceArgs);
}
示例10: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
Tuple<OpenDMS.Storage.Data.Resource, OpenDMS.Storage.Data.Version> res =
(Tuple<OpenDMS.Storage.Data.Resource, OpenDMS.Storage.Data.Version>)result;
WriteLine("ModifyVersion.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
WriteLine("\tId: " + res.Item2.VersionId.ToString());
}
示例11: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
OpenDMS.Storage.Providers.CouchDB.Commands.PutDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.PutDocumentReply)reply;
if (r.Ok)
WriteLine("ModifyGroup.Complete - success in " + duration.TotalMilliseconds.ToString() + "ms.");
else
WriteLine("ModifyGroup.Complete - failed in " + duration.TotalMilliseconds.ToString() + "ms.");
}
示例12: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
Tuple<OpenDMS.Storage.Data.Version, Newtonsoft.Json.Linq.JObject> res =
(Tuple<OpenDMS.Storage.Data.Version, Newtonsoft.Json.Linq.JObject>)result;
OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply)reply;
WriteLine("CheckoutVersion.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
WriteLine("\tId: " + res.Item1.VersionId.ToString());
}
示例13: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
DateTime stop = DateTime.Now;
TimeSpan duration = stop - _start;
OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply)reply;
OpenDMS.Storage.Providers.CouchDB.Transitions.User txUser = new OpenDMS.Storage.Providers.CouchDB.Transitions.User();
OpenDMS.Storage.Security.User user = txUser.Transition(r.Document);
WriteLine("GetUser.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
WriteLine("\tId: " + user.Id + ", Name: " + user.Username);
}
示例14: Complete
private void Complete(EngineRequest request, ICommandReply reply, object result)
{
OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply)reply;
OpenDMS.Storage.Providers.CouchDB.Transitions.GroupCollection gc = new OpenDMS.Storage.Providers.CouchDB.Transitions.GroupCollection();
List<OpenDMS.Storage.Security.Group> groups = gc.Transition(r.View);
for (int i = 0; i < groups.Count; i++)
{
comboBox1.Invoke(new MethodInvoker(delegate { comboBox1.Items.Add(groups[i]); }));
}
comboBox1.Invoke(new MethodInvoker(delegate { panel1.Visible = false; }));
}
示例15: win_OnLoginClick
void win_OnLoginClick(string username, string password)
{
System.Security.Cryptography.SHA512Managed sha512 = new System.Security.Cryptography.SHA512Managed();
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(password);
string encPassword = System.Convert.ToBase64String(sha512.ComputeHash(bytes));
EngineRequest request = new EngineRequest();
request.Engine = _engine;
request.Database = _db;
request.OnComplete = new EngineBase.CompletionDelegate(OnAuthenticated);
request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;
_engine.AuthenticateUser(request, username, encPassword);
}