本文整理汇总了C#中ServiceHost.Contracts.Linked.AppObjects.Identification类的典型用法代码示例。如果您正苦于以下问题:C# Identification类的具体用法?C# Identification怎么用?C# Identification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Identification类属于ServiceHost.Contracts.Linked.AppObjects命名空间,在下文中一共展示了Identification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAll
public Task SendAll(BroadcastMessage message, Identification identification)
{
// Call the addMessage method on all clients
message.UserName = identification.Username;
message.When = DateTime.Now;
return Clients.All.Broadcast(message);
}
示例2: BeginGetUser
public IAsyncResult BeginGetUser(int id, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0) {
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
var task = Task<User>.Factory.StartNew(process => DoGetUser(id), state);
return task.ContinueWith(res => callback(task));
}
示例3: BeginGetBusinessClosedDays
public IAsyncResult BeginGetBusinessClosedDays(Identification identification, DateTime startDate, DateTime endDate, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0) {
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
var task = Task<SmartCollection<BusinessClosedDay>>.Factory.StartNew(process => DoGetBusinessClosedDays(identification, startDate, endDate), state);
return task.ContinueWith(res => callback(task));
}
示例4: BeginGetAnalytes
public IAsyncResult BeginGetAnalytes(bool addAny, bool includeInActive, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0) {
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
var task = Task<SmartCollection<Analyte>>.Factory.StartNew(process => DoGetAnalytes(addAny, includeInActive, identification), state);
return task.ContinueWith(res => callback(task));
}
示例5: BeginGetInventoryItem
public IAsyncResult BeginGetInventoryItem(int id, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0)
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
if (!AppLib.IsAuthorized(identification, ModuleNames.Inventory.ToString()))
throw new FaultException<ServiceFault>(new ServiceFault("User account is not Authorized.", "Authorization"), new FaultReason("Restricted"));
var task = Task<InventoryItem>.Factory.StartNew(process => DoGetInventoryItem(id, identification.Token), state);
return task.ContinueWith(res => callback(task));
}
示例6: BeginGetChangeHistory
public IAsyncResult BeginGetChangeHistory(string moduleName, int rootModelKey, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0) throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
//if (!AppLib.IsAuthorized(identification, SysLib.GetOptionName(ModuleNames.Orders, ModelNamesEnum.SampleTest, ModuleAction.Create, ModuleAction.Report)))
// throw new FaultException<ServiceFault>(new ServiceFault("User account is not Authorized.", "Authorization"), new FaultReason("Restricted"));
// TODO: if isauthorized
var task = Task<SmartCollection<AuditedModelValue>>.Factory.StartNew(process => DoGetChangeHistory(moduleName, rootModelKey, identification), state);
return task.ContinueWith(res => callback(task));
}
示例7: BeginGetUsers
public IAsyncResult BeginGetUsers(string searchString, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
// JSON POST Sample = {"searchString":"Test","searchFields":["FirstName"]}
if (AppLib.VerifyToken(identification.Token) <= 0)
{
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
var task = Task<SmartCollection<User>>.Factory.StartNew(process => DoGetUsers(searchString), state);
return task.ContinueWith(res => callback(task));
}
示例8: BeginCancelSample
public IAsyncResult BeginCancelSample(int arlNumber, SampleNote note, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
identification.UserId = AppLib.VerifyToken(identification.Token);
if (identification.UserId <= 0) {
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
if (!AppLib.IsAuthorized(identification, SysLib.GetOptionName(ModuleNames.Samples, ModelNamesEnum.Sample, ModuleAction.Cancel)))
throw new FaultException<ServiceFault>(new ServiceFault("User account is not Authorized.", "Authorization"), new FaultReason("Restricted"));
var task = Task<int>.Factory.StartNew(process => DoCancelSample(arlNumber, note, identification), state);
return task.ContinueWith(res => callback(task));
}
示例9: GetClientComplaintsOpenCount
private string GetClientComplaintsOpenCount(ref MsSqlPersistence dbConnection, ref SqlCommand dbCommand, Identification identification)
{
try
{
bool canApproveComplaints = AppLib.IsAuthorized(identification, SysLib.GetOptionName(ModuleNames.Clients, ModelNamesEnum.Complaint, ModuleAction.Approve));
int returnValue = 0;
dbCommand.CommandType = CommandType.StoredProcedure;
dbCommand.CommandText = "uspGetClientComplaintsOpenCount";
dbCommand.Parameters.Clear();
dbCommand.Parameters.Add("@UserId", System.Data.SqlDbType.Int).Value = identification.UserId;
returnValue = (int)dbConnection.ExecuteScalar(dbCommand);
return returnValue <= 0 ? string.Empty : returnValue.ToString();
}
catch
{
throw;
}
}
示例10: SaveClientComplaint
public int SaveClientComplaint(ref MsSqlPersistence dbConnection, ref SqlCommand dbCommand, ClientComplaint complaint, Identification identification)
{
try
{
int returnValue = 0;
if (complaint.IsDirty)
{
SystemDAO.SaveChangeAudit<ClientComplaint>(ref dbConnection, ref dbCommand,
GetClientComplaint(ref dbConnection, ref dbCommand, complaint.Pk),
complaint,
ModuleNames.Clients,
complaint.ClientId,
identification.UserId);
dbCommand.Parameters.Clear();
dbCommand.CommandType = CommandType.StoredProcedure;
dbCommand.CommandText = "uspUpdateClientComplaint";
dbCommand.Parameters.Add("@ClientComplaintId", System.Data.SqlDbType.Int).Value = complaint.ClientComplaintId;
dbCommand.Parameters.Add("@ClientId", System.Data.SqlDbType.Int).Value = complaint.ClientId;
dbCommand.Parameters.Add("@ClassificationId", System.Data.SqlDbType.Int).Value = complaint.ClassificationId;
dbCommand.Parameters.Add("@StatusYN", System.Data.SqlDbType.Int).Value = (bool)complaint.StatusYN;
dbCommand.Parameters.Add("@Description", System.Data.SqlDbType.NVarChar, 100).Value = complaint.Description;
dbCommand.Parameters.Add("@ARLNumber", System.Data.SqlDbType.NVarChar, 100).Value = complaint.ARLNumber;
dbCommand.Parameters.Add("@RootCause", System.Data.SqlDbType.NVarChar, 100).Value = complaint.RootCause;
dbCommand.Parameters.Add("@NotifyUserId", System.Data.SqlDbType.Int).Value = complaint.NotifyUserId;
dbCommand.Parameters.Add("@CorrectiveAction", System.Data.SqlDbType.NVarChar, 100).Value = complaint.CorrectiveAction;
dbCommand.Parameters.Add("@CorrectiveActionDate", System.Data.SqlDbType.DateTime).Value = DateTime.Now;
dbCommand.Parameters.Add("@CorrectiveActionUserId", System.Data.SqlDbType.Int).Value = complaint.CorrectiveActionUserId;
dbCommand.Parameters.Add("@ModifiedDate", System.Data.SqlDbType.DateTime).Value = complaint.CorrectiveActionDate != null ? (SqlDateTime)complaint.CorrectiveActionDate : SqlDateTime.Null;
dbCommand.Parameters.Add("@ModifiedBy", System.Data.SqlDbType.Int).Value = identification.UserId;
returnValue += dbConnection.ExecuteCommand(dbCommand);
}
return returnValue;
}
catch
{
throw;
}
}
示例11: DoCreateMultiSampleInvoice
public string DoCreateMultiSampleInvoice(string arlNumbers, Identification identification)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
using (SampleDAO dao = new SampleDAO())
{
return dao.CreateMultiSampleInvoice(arlNumbers, identification);
}
}
示例12: DoSaveUser
public int DoSaveUser(User user, Identification identification)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
//Validate Object
if (!user.ValidateModel())
throw new FaultException<ServiceFault>(new ServiceFault(user.CurrentErrors), new FaultReason(SysVars.InvalidFormat));
if (user.UserId == null) {
using (UserDAO dao = new UserDAO()) {
if (dao.IsDuplicateUserName(user.Username))
throw new FaultException<ServiceFault>(new ServiceFault("Duplicate User Name", "Rejected"), new FaultReason("Duplicate User Name Found."));
}
}
using (UserDAO dao = new UserDAO()) {
return dao.SaveUser(user, identification.Token, identification.UserId);
}
}
示例13: DoRemoveInventoryItemNote
public int DoRemoveInventoryItemNote(int id, Identification identification)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
using (InventoryDAO dao = new InventoryDAO())
{
return dao.RemoveInventoryNote(id, identification.UserId);
}
}
示例14: DoRemoveUser
public int DoRemoveUser(int id, Identification identification)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
using (UserDAO dao = new UserDAO()) {
return dao.RemoveUser(id, identification.UserId);
}
}
示例15: BeginSearchInventory
public IAsyncResult BeginSearchInventory(string searchString, Collection<SearchItem> searchItems, Identification identification, AsyncCallback callback, object state)
{
logger.Log(LogLevel.Trace, AppLib.GetCaller(logger));
if (AppLib.VerifyToken(identification.Token) <= 0)
{
throw new FaultException<ServiceFault>(new ServiceFault("Invalid Authentication", "Authorization"), new FaultReason("Unauthorized"));
}
var task = Task<SmartCollection<InventoryItem>>.Factory.StartNew(process => DoSearchInventory(searchString, searchItems, identification), state);
return task.ContinueWith(res => callback(task));
}