public static void OnReceive(UserContext context) { string data = string.Empty; try { mCounter++; data = context.DataFrame.ToString(); Console.WriteLine("Data Received From [" + context.ClientAddress.ToString() + "] - " + data + " (" + data.Length.ToString() + " - " + mCounter.ToString() + ")"); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } //context.Send("Hello2"); if (data == "PING") { context.Send("PONG!"); } else if (data == "abc") { string sendData = new string('x', 32768); context.Send(sendData); } else { //context.Send("Echo back: " + data); } }
private void OnReceive(UserContext context) { Console.WriteLine("Received Data From :" + context.ClientAddress); string jsonString = context.DataFrame.ToString(); ParseIncoming(new AlchemySession(context), jsonString); }
public PresentationRepository() { this.context = new UserContext(); this.dbSet = context.Set<PresentationModel>(); this.dbSetTag = context.Set<Tag>(); this.dbRatings = context.Set<RatingsModel>(); }
private void ReceivedMsg(UserContext context) { string message = context.DataFrame.ToString(); if (message.Contains("left")) { bool dblClick = false; if (message.Contains("dbl")) { dblClick = true; } MouseController.MouseLeft(dblClick); } else if (message.Contains("right")) { MouseController.MouseRight(); } else if (message.Contains("key")) { HandleKeyIn(message); } else { string move = context.DataFrame.ToString(); string[] XandY = move.Split(','); int mX = Int32.Parse(XandY[0]); int mY = Int32.Parse(XandY[1]); int[] mousePos = MouseController.GetMousePosition(); mX = mousePos[0] + mX; mY = mousePos[1] + mY; MouseController.moveMouse(mX, mY); } }
public ICommand GetCommand(CommandType commandType, UserContext userContext, ResourceType entityType, EntityMetadata entityMetadata, string membershipId) { if (entityType.Name == "CommandInvocation") { CommandType commandType1 = commandType; switch (commandType1) { case CommandType.Create: case CommandType.Read: case CommandType.Delete: { return new GICommand(commandType, this.runspaceStore, entityType, userContext, membershipId); } case CommandType.Update: { throw new NotImplementedException(); } default: { throw new NotImplementedException(); } } } else { throw new NotImplementedException(); } }
public bool QuotaCheckAndUpdate(UserContext userContext, UserQuota quota) { bool flag; lock (this.syncObject) { if (this.CheckConcurrentRequestQuota(quota.MaxConcurrentRequests)) { if (this.CheckRequestPerTimeSlotQuota(quota.MaxRequestsPerTimeSlot, quota.TimeSlotSize)) { Usage usage = this; usage.concurrentRequests = usage.concurrentRequests + 1; this.requests.Increment(quota.TimeSlotSize); TraceHelper.Current.UserQuotaSucceeded(userContext.Name); TraceHelper.Current.DebugMessage(string.Concat("Usage.QuotaCheckAndUpdate called. Concurrent requests = ", this.concurrentRequests)); flag = true; } else { DataServiceController.Current.QuotaSystem.UserQuotaViolation.Increment(); TraceHelper.Current.UserQuotaViolation(userContext.Name, "MaxRequestPerTimeSlot quota violation"); DataServiceController.Current.PerfCounters.UserQuotaViolationsPerSec.Increment(); flag = false; } } else { DataServiceController.Current.QuotaSystem.UserQuotaViolation.Increment(); TraceHelper.Current.UserQuotaViolation(userContext.Name, "MaxConcurrentRequest quota violation"); DataServiceController.Current.PerfCounters.UserQuotaViolationsPerSec.Increment(); flag = false; } } return flag; }
public static void OnDisconnect(UserContext context) { Console.WriteLine("Client Disconnection From : " + context.ClientAddress); if (presenter != null && presenter.ClientAddress == context.ClientAddress) { Console.WriteLine("Oh shit we lost the tv."); // Reset everything. // F**k this whole thing needs to be rewritten presenter = null; acceptingPlayers = true; players.ForEach(x => x.Send(JsonConvert.SerializeObject(new { Type = CommandType.End }), false, true)); players.Clear(); } //throw new Exception("Yeah nar we don't handle disconnects"); /*var remove = players.FirstOrDefault(x => x.ClientAddress.Equals(context.ClientAddress)); if (remove != null) { players.Remove(remove); Console.WriteLine(context.ClientAddress); }*/ }
public virtual void SignIn(User user, bool createPersistentCookie) { var now = DateTime.UtcNow.ToLocalTime(); var ticket = new FormsAuthenticationTicket( 1, user.Username, now, now.Add(_expirationTimeSpan), createPersistentCookie, user.Username, FormsAuthentication.FormsCookiePath); var encryptedTicket = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); cookie.HttpOnly = true; if (ticket.IsPersistent) { cookie.Expires = ticket.Expiration; } cookie.Secure = FormsAuthentication.RequireSSL; cookie.Path = FormsAuthentication.FormsCookiePath; if (FormsAuthentication.CookieDomain != null) { cookie.Domain = FormsAuthentication.CookieDomain; } _httpContext.Response.Cookies.Add(cookie); _cachedUser = user; var userContext = new UserContext { User = user }; foreach(var authenticationEventHandler in _authenticationEventHandlers) { authenticationEventHandler.SignIn(userContext); } }
public static void ProcessedRequestHandler(object source, DataServiceProcessingPipelineEventArgs args) { TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler entered"); if (args != null) { args.OperationContext.Trace(); } UserContext userContext = new UserContext(CurrentRequestHelper.Identity, CurrentRequestHelper.Certificate); if (DataServiceController.Current.IsRequestProcessingStarted(userContext)) { try { DataServiceController.Current.SetRequestProcessingState(userContext, false); UserDataCache.UserDataEnvelope userDataEnvelope = DataServiceController.Current.UserDataCache.Get(userContext); using (userDataEnvelope) { userDataEnvelope.Data.Usage.RequestProcessed(); } TraceHelper.Current.RequestProcessingEnd(); } finally { DataServiceController.Current.UserDataCache.TryUnlockKey(userContext); TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler exited"); } return; } else { TraceHelper.Current.DebugMessage("QuotaSystem.ProcessedRequestHandler IsRequestProcessingStarted returned false"); return; } }
public static XElement exportUploadSettingsToXml(this IUserSettings settings, UserContext context) { return new XElement("uploadSettings", new XElement("maxWidth", settings.maxUploadImageWidth), new XElement("maxHeight", settings.maxUploadImageHeight) ); }
static void OnDisconnect(UserContext context) { lock (ActiveContexts) { Write("Disconnected", context); ActiveContexts.Remove(context); } }
public void SaveOrUpdateUser(User user) { using (var db = new UserContext()) { db.Users.AddOrUpdate(user); db.SaveChanges(); } }
/// <summary> /// Event fired when a client connects to the Alchemy Websockets server instance. /// Adds the client to the online users list. /// </summary> /// <param name="context">The user's connection context</param> public static void OnConnect(UserContext context) { Console.WriteLine("Client Connection From : " + context.ClientAddress); var me = new User {Context = context}; OnlineUsers.TryAdd(me, String.Empty); }
public void Build(Microsoft.Management.Odata.Schema.Schema logicalSchema, Microsoft.Management.Odata.Schema.Schema userSchema, UserContext userContext, string membershipId) { Envelope<PSRunspace, UserContext> envelope = this.runspaceStore.Borrow(userContext, membershipId); using (envelope) { this.Build(logicalSchema, userSchema, envelope.Item.Runspace); } }
public ReferredEntityInstance(DSResource resource, UserContext userContext, ResourceType type, EntityMetadata metadata, string membershipId) { this.userContext = userContext; this.resourceType = type; this.metadata = metadata; this.membershipId = membershipId; this.resource = resource; }
public static void OnDisconnect(UserContext context) { Console.WriteLine("Client Disconnected : " + context.ClientAddress.ToString()); // Remove the connection Object from the thread-safe collection UserContext uc; UserContexts.TryRemove(context.ClientAddress.ToString(), out uc); }
/// <summary> /// Event fired when a client connects to the Alchemy Websockets server instance. /// Adds the client to the online users list. /// </summary> /// <param name="AContext">The user's connection context</param> public static void OnConnect(UserContext AContext) { Console.WriteLine("Client Connection From : " + AContext.ClientAddress.ToString()); User me = new User(); me.Context = AContext; OnlineUsers.Add(me); }
public GICommand(CommandType commandType, ExclusiveItemStore<PSRunspace, UserContext> runspaceStore, ResourceType entityType, UserContext userContext, string membershipId) { this.commandType = commandType; this.runspaceStore = runspaceStore; this.entityType = entityType; this.userContext = userContext; this.membershipId = membershipId; this.parameters = new Dictionary<string, object>(); }
public PlayerController( IPlayerQueries playerQueries, IPlayerCommands playerCommands, IPlayerActions playerActions, UserContext userContext) : base(userContext) { _playerQueries = playerQueries; _playerCommands = playerCommands; _playerActions = playerActions; }
public static void OnConnected(UserContext context) { Utilities.Logger.Debug("New websocket connection : " + context.ClientAddress.ToString()); var client = new WebClientConnection(context); lock (Clients) { Clients.Add(new WebClientConnection(context)); } }
public override void CreateRole(string roleName) { var newRole = new Role() { Name = roleName }; using (var context = new UserContext()) { context.Roles.Add(newRole); context.SaveChanges(); } }
static void OnConnect(UserContext context) { lock (ActiveContexts) { Write("Connected", context); ActiveContexts.Add(context); new Thread(() => HandleClient(context)).Start(); } }
public void AcquisitionDateCanBeChangedByUserToSpecifyACustomValue() { var context = new UserContext(new Dictionary<string, string>()); DateTimeOffset testValue = DateTimeOffset.Now; context.AcquisitionDate = testValue; Assert.Equal(testValue, context.AcquisitionDate); }
public void TearDown() { var context = new UserContext(ConnectionString); foreach (var user in context.Users) { context.Users.Remove(user); } context.SaveChanges(); }
public ActionResult Create(Attendee attendee) { List<Attendee> attendees = new List<Attendee>(); attendees.Add(attendee); IRegistrationManager regManager = UnityCache.ResolveDefault<IRegistrationManager>(); UserContext uc = new UserContext(); uc.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; Registration reg = regManager.ProcessRegistration(uc, attendees); return View(); }
public ViewResult Submit(string email, string password) { var userContext = new UserContext(); userContext.Email = email; userContext.Password = password; var userContextJson = JsonConvert.SerializeObject(userContext); AddToQueue(userContextJson); ViewBag.Message = "Registration Completed Successfully, you will recieve a confirmation mail shortly."; return View("Index"); }
public ActionResult Index(User user) { using (var userContext = new UserContext()) { userContext.Users.Add(user); userContext.SaveChanges(); ViewBag.user = user; return View("Result"); } }
/// <summary> /// Initializes a new instance of the <see cref="Context"/> class. /// </summary> protected Context(TcpClient connection) { Connection = connection; Buffer = new byte[_bufferSize]; UserContext = new UserContext(this); HeaderStream = new MemoryStream(); if (connection != null) UserContext.ClientAddress = connection.Client.RemoteEndPoint; }
public List<User> GetUsers(int? take, int? skip) { List<User> result = new List<User>(); using (var db = new UserContext()) { var users = db.Users.Include("PhoneNumbers").ToList(); result = users; } return result; }
public ActionResult FindSafeUser(User user) { using (var userContext = new UserContext()) { List<User> users = userContext.Users.Where(u => u.Login == user.Login && u.Password == user.Password) .ToList(); ViewBag.users = users; } return View("ResultUsers"); }
public ProfileIndexModel(UserContext userContext, UserManager userManager) { this.UserContext = userContext; this.UserManager = userManager; }
public UserService(IOptions <Settings> settings) { _context = new UserContext(settings); }
public RentController(RentaContext context, UserManager <ApplicationUser> userManager, UserContext userContext) { _context = context; _userManager = userManager; _userContext = userContext; }
public HeatMapRepository(M3PactContext m3PactContext, IPendingChecklistRepository pendingChecklistRepository) { _m3PactContext = m3PactContext; _pendingChecklistRepository = pendingChecklistRepository; userContext = UserHelper.getUserContext(); }
public AccountController(UserContext context) { db = context; }
public static void GetFolders(UserContext userContext, out OwaStoreObjectId[] folderIds, out string[] folderNames, out string[] folderClassNames, out int folderCount) { folderIds = new OwaStoreObjectId[10]; folderNames = new string[10]; folderClassNames = new string[10]; folderCount = 0; SimpleConfiguration <TargetFolderMRUEntry> simpleConfiguration = new SimpleConfiguration <TargetFolderMRUEntry>(userContext); simpleConfiguration.Load(); bool flag = false; int i = 0; while (i < simpleConfiguration.Entries.Count) { if (i >= 10) { break; } OwaStoreObjectId owaStoreObjectId = null; try { owaStoreObjectId = OwaStoreObjectId.CreateFromString(simpleConfiguration.Entries[i].FolderId); } catch (OwaInvalidIdFormatException) { simpleConfiguration.Entries.RemoveAt(i); flag = true; continue; } if (!userContext.IsPublicFoldersAvailable() && owaStoreObjectId.IsPublic) { i++; } else { Folder folder = null; string text = null; string text2 = null; try { folder = Utilities.GetFolder <Folder>(userContext, owaStoreObjectId, new PropertyDefinition[0]); if (Utilities.IsFolderSegmentedOut(folder.ClassName, userContext)) { i++; continue; } text2 = folder.ClassName; text = Utilities.GetDisplayNameByFolder(folder, userContext); } catch (ObjectNotFoundException) { simpleConfiguration.Entries.RemoveAt(i); flag = true; continue; } catch (StorageTransientException) { i++; continue; } finally { if (folder != null) { folder.Dispose(); folder = null; } } folderIds[folderCount] = owaStoreObjectId; folderNames[folderCount] = text; folderClassNames[folderCount] = text2; folderCount++; i++; } } while (simpleConfiguration.Entries.Count > 10) { simpleConfiguration.Entries.RemoveAt(10); flag = true; } if (flag) { simpleConfiguration.Save(); } }
public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } applicationElement = ApplicationElement.NotSet; type = string.Empty; action = string.Empty; state = string.Empty; Item item = null; Item item2 = null; Item item3 = null; bool flag = false; BodyFormat bodyFormat = BodyFormat.TextPlain; PreFormActionResponse result; try { HttpContext httpContext = owaContext.HttpContext; UserContext userContext = owaContext.UserContext; item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2); RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled; if (userContext.IsIrmEnabled) { try { flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus); } catch (RightsManagementPermanentException exception) { decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception); } } if (!flag) { bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext); } string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false); bool flag2 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext); bool flag3 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type); bool flag4 = flag3 || (flag2 && Utilities.IsSMime(item)) || flag; ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None; if (flag4) { replyForwardFlags |= ReplyForwardFlags.DropBody; } if (flag3 || flag) { replyForwardFlags |= ReplyForwardFlags.DropHeader; } StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item); item3 = ReplyForwardUtilities.CreateReplyItem(flag2 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId); if (flag) { using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item)) { itemAttachment.Save(); goto IL_160; } } if (Utilities.IsIrmRestrictedAndNotDecrypted(item)) { ReplyForwardUtilities.SetAlternateIrmBody(item3, flag2 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName)); } IL_160: type = "IPM.Note"; if (flag3) { item3.ClassName = "IPM.Note.Mobile.SMS"; type = "IPM.Note.Mobile.SMS"; ReplyForwardUtilities.RemoveInvalidRecipientsFromSmsMessage((MessageItem)item3); } item3.Save(SaveMode.ResolveConflicts); item3.Load(); PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[] { "cb", "smime" }); preFormActionResponse.ApplicationElement = ApplicationElement.Item; preFormActionResponse.Type = type; preFormActionResponse.Action = "Reply"; preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String()); if (flag4) { preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request)); if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item)) { preFormActionResponse.AddParameter("cb", "1"); } } if (userContext.IsInOtherMailbox(item)) { preFormActionResponse.AddParameter("fOMF", "1"); } if (flag) { preFormActionResponse.AddParameter("fIrmAsAttach", "1"); } result = preFormActionResponse; } finally { if (item != null) { item.Dispose(); item = null; } if (item2 != null) { item2.Dispose(); item2 = null; } if (item3 != null) { item3.Dispose(); item3 = null; } } return(result); }
public Login LoginOptions(UserContext context) { return(new Login()); }
public UserController(UserContext userContext, ILogger <UserController> logger, ICapPublisher capPublisher) { _userContext = userContext; _logger = logger; _capPublisher = capPublisher; }
// Token: 0x060025AE RID: 9646 RVA: 0x000DA4AF File Offset: 0x000D86AF public SingleLineItemContentsForVirtualList(ViewDescriptor viewDescriptor, ColumnId sortedColumn, SortOrder sortOrder, UserContext userContext, SearchScope folderScope) : base(viewDescriptor, sortedColumn, sortOrder, userContext, folderScope) { }
// Token: 0x060025AD RID: 9645 RVA: 0x000DA4A1 File Offset: 0x000D86A1 public SingleLineItemContentsForVirtualList(ViewDescriptor viewDescriptor, ColumnId sortedColumn, SortOrder sortOrder, UserContext userContext) : this(viewDescriptor, sortedColumn, sortOrder, userContext, SearchScope.SelectedFolder) { }
public static void ResolveOneRecipient(string name, UserContext userContext, List <RecipientAddress> addresses) { AnrManager.ResolveOneRecipient(name, userContext, addresses, new AnrManager.Options()); }
private static void AddContacts(UserContext userContext, AnrManager.Options options, PropertyDefinition[] properties, object[][] results, List <RecipientAddress> addresses) { if (results != null && results.GetLength(0) > 0) { int i = 0; while (i < results.GetLength(0)) { object[] results2 = results[i]; Participant participant = null; string displayName = null; string text = Utilities.NormalizePhoneNumber(AnrManager.FindFromResultsMapping(ContactSchema.MobilePhone, properties, results2) as string); VersionedId versionedId = AnrManager.FindFromResultsMapping(ItemSchema.Id, properties, results2) as VersionedId; if (!options.ResolveAgainstAllContacts && !options.IsDefaultRoutingType("MOBILE")) { participant = (AnrManager.FindFromResultsMapping(ContactBaseSchema.AnrViewParticipant, properties, results2) as Participant); displayName = participant.DisplayName; goto IL_1AB; } Participant participant2 = AnrManager.FindFromResultsMapping(DistributionListSchema.AsParticipant, properties, results2) as Participant; if (participant2 != null) { participant = participant2; displayName = participant.DisplayName; goto IL_1AB; } if (options.IsDefaultRoutingType("MOBILE")) { if (!string.IsNullOrEmpty(text)) { displayName = (AnrManager.FindFromResultsMapping(StoreObjectSchema.DisplayName, properties, results2) as string); participant = new Participant(displayName, text, "MOBILE", new StoreParticipantOrigin(versionedId), new KeyValuePair <PropertyDefinition, object> [0]); } else if (options.OnlyAllowDefaultRoutingType) { goto IL_339; } } if (!(participant == null)) { goto IL_1AB; } Participant participant3 = AnrManager.FindFromResultsMapping(ContactSchema.Email1, properties, results2) as Participant; Participant participant4 = AnrManager.FindFromResultsMapping(ContactSchema.Email2, properties, results2) as Participant; Participant participant5 = AnrManager.FindFromResultsMapping(ContactSchema.Email3, properties, results2) as Participant; if (participant3 != null && !string.IsNullOrEmpty(participant3.EmailAddress)) { participant = participant3; displayName = participant.DisplayName; goto IL_1AB; } if (participant4 != null && !string.IsNullOrEmpty(participant4.EmailAddress)) { participant = participant4; displayName = participant.DisplayName; goto IL_1AB; } if (participant5 != null && !string.IsNullOrEmpty(participant5.EmailAddress)) { participant = participant5; displayName = participant.DisplayName; goto IL_1AB; } goto IL_1AB; IL_339: i++; continue; IL_1AB: RecipientAddress recipientAddress = new RecipientAddress(); recipientAddress.MobilePhoneNumber = text; recipientAddress.DisplayName = displayName; recipientAddress.AddressOrigin = AddressOrigin.Store; if (participant != null) { if (Utilities.IsMapiPDL(participant.RoutingType) && Utilities.IsFlagSet((int)options.RecipientBlockType, 2)) { goto IL_339; } recipientAddress.RoutingType = participant.RoutingType; recipientAddress.EmailAddressIndex = ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex; if (!string.IsNullOrEmpty(participant.EmailAddress)) { recipientAddress.RoutingAddress = participant.EmailAddress; if (string.CompareOrdinal(recipientAddress.RoutingType, "EX") == 0) { string text2 = participant.TryGetProperty(ParticipantSchema.SmtpAddress) as string; if (string.IsNullOrEmpty(text2)) { IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext); ADRecipient adrecipient = null; try { adrecipient = recipientSession.FindByLegacyExchangeDN(recipientAddress.RoutingAddress); } catch (NonUniqueRecipientException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "AnrManager.GetNamesByAnrFromContacts: NonUniqueRecipientException was thrown by FindByLegacyExchangeDN: {0}", ex.Message); } if (adrecipient == null || adrecipient.HiddenFromAddressListsEnabled) { goto IL_339; } recipientAddress.SmtpAddress = adrecipient.PrimarySmtpAddress.ToString(); } else { recipientAddress.SmtpAddress = text2; } } else if (string.CompareOrdinal(recipientAddress.RoutingType, "SMTP") == 0) { recipientAddress.SmtpAddress = recipientAddress.RoutingAddress; } } } if (Utilities.IsMapiPDL(recipientAddress.RoutingType)) { recipientAddress.IsDistributionList = true; } if (versionedId != null) { recipientAddress.StoreObjectId = versionedId.ObjectId; } addresses.Add(recipientAddress); goto IL_339; } } }
public UserTestController(UserContext userContext) { _userContext = userContext; }
public UserController(UserContext context) { _context = context; }
public User User(UserContext context) { return(context.Authorize()); }
public static IList <TargetFolderMRUEntry> AddAndGetFolders(OwaStoreObjectId folderId, UserContext userContext) { SimpleConfiguration <TargetFolderMRUEntry> simpleConfiguration = new SimpleConfiguration <TargetFolderMRUEntry>(userContext); simpleConfiguration.Load(); bool flag = false; ReadOnlyCollection <TargetFolderMRUEntry> result = new ReadOnlyCollection <TargetFolderMRUEntry>(simpleConfiguration.Entries); while (simpleConfiguration.Entries.Count > 10) { simpleConfiguration.Entries.RemoveAt(10); flag = true; } int i = 0; while (i < simpleConfiguration.Entries.Count) { OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromString(simpleConfiguration.Entries[i].FolderId); if (owaStoreObjectId.Equals(folderId)) { if (i == 0) { if (flag) { simpleConfiguration.Save(); } return(result); } simpleConfiguration.Entries.RemoveAt(i); break; } else { i++; } } if (simpleConfiguration.Entries.Count == 10) { simpleConfiguration.Entries.RemoveAt(9); } simpleConfiguration.Entries.Insert(0, new TargetFolderMRUEntry(folderId)); simpleConfiguration.Save(); return(result); }
// Token: 0x06001A9B RID: 6811 RVA: 0x0009A163 File Offset: 0x00098363 public CalendarAdapter(UserContext userContext, StoreObjectId storeObjectId) : this(userContext, OwaStoreObjectId.CreateFromSessionFolderId(userContext, userContext.MailboxSession, storeObjectId)) { }
public static AttachmentPolicy.Level GetLevelForAttachment(string fileExtension, string mimeType, UserContext userContext) { if (fileExtension == null) { throw new ArgumentNullException("fileExtension"); } AttachmentPolicy attachmentPolicy; if (userContext != null) { attachmentPolicy = userContext.AttachmentPolicy; } else { attachmentPolicy = OwaConfigurationManager.Configuration.AttachmentPolicy; } if (mimeType == null || !attachmentPolicy.DirectFileAccessEnabled) { return(AttachmentPolicy.Level.Block); } AttachmentPolicy.Level level = attachmentPolicy.GetLevel(fileExtension, AttachmentPolicy.TypeSignifier.File); if (level == AttachmentPolicy.Level.Allow) { return(level); } AttachmentPolicy.Level level2 = attachmentPolicy.GetLevel(mimeType, AttachmentPolicy.TypeSignifier.Mime); if (level2 == AttachmentPolicy.Level.Allow) { return(level2); } if (level == AttachmentPolicy.Level.Unknown && level2 == AttachmentPolicy.Level.Unknown) { return(attachmentPolicy.TreatUnknownTypeAs); } if (level < level2) { return(level); } return(level2); }
public static AttachmentPolicy.Level GetAttachmentLevel(Attachment attachment, UserContext userContext) { if (attachment == null) { throw new ArgumentNullException("attachment"); } return(AttachmentLevelLookup.GetAttachmentLevel(attachment.AttachmentType, attachment.FileExtension, attachment.ContentType ?? attachment.CalculatedContentType, userContext)); }
/// <summary> /// To calculate riskscores for each client on changing heatmap items /// </summary> private void RecalculateRiskScores() { try { UserContext userContext = UserHelper.getUserContext(); List <Client> clientIds = _m3PactContext.Client?.Where(c => c.IsActive == DomainConstants.RecordStatusActive).ToList(); if (clientIds?.Count > 0) { int weeklyChecklistTypeId = _m3PactContext.CheckListType.Where(c => c.CheckListTypeCode == DomainConstants.WEEK && c.RecordStatus == DomainConstants.RecordStatusActive).FirstOrDefault().CheckListTypeId; int monthlyChecklistTypeId = _m3PactContext.CheckListType.Where(c => c.CheckListTypeCode == DomainConstants.MONTH && c.RecordStatus == DomainConstants.RecordStatusActive).FirstOrDefault().CheckListTypeId; int metricTypeId = _m3PactContext.CheckListType.Where(c => c.CheckListTypeCode == DomainConstants.M3 && c.RecordStatus == DomainConstants.RecordStatusActive).FirstOrDefault().CheckListTypeId; List <HeatMapItem> weeklyHeatMapItems = _pendingChecklistRepository.GetHeatMapWithType(weeklyChecklistTypeId); List <HeatMapItem> monthlyHeatMapItems = _pendingChecklistRepository.GetHeatMapWithType(monthlyChecklistTypeId); List <HeatMapItem> metricHeatMapItems = _pendingChecklistRepository.GetHeatMapWithType(metricTypeId); foreach (Client client in clientIds) { ClientHeatMapRisk existingRiskScore = _m3PactContext.ClientHeatMapRisk.Where(c => c.ClientId == client.ClientId).OrderByDescending(c => c.ClientHeatMapRiskId)?.FirstOrDefault(); if (existingRiskScore != null) { //To Calculate Metric scores and insert into item table and update Riskscore table if (existingRiskScore.M3dailyDate != null) { List <ClientHeatMapItemScore> metricHeatmapScores = _pendingChecklistRepository.GetHeatMapScoresToUpdate(existingRiskScore.M3dailyDate.Value, client.ClientId, metricTypeId); List <HeatMapItem> metricItemsToAdd = metricHeatMapItems.Where(c => !metricHeatmapScores.Select(d => d.HeatMapItemId).Contains(c.HeatMapItemId))?.ToList(); if (metricItemsToAdd?.Count > 0) { int existingMetricscore = _pendingChecklistRepository.GetScore(existingRiskScore.ClientHeatMapRiskId, DomainConstants.M3).Value; var heatMapItemKpisResponse = (from metricData in _m3PactContext.M3metricClientKpiDaily join metricHeatMapData in metricItemsToAdd on metricData.KpiId equals metricHeatMapData.Kpiid select new { metricData, metricHeatMapData }).Where(x => x.metricData.InsertedDate == existingRiskScore.M3dailyDate && x.metricData.ClientId == client.ClientId).ToList(); List <ClientHeatMapItemScore> metricHeatMapItemsToSave = new List <ClientHeatMapItemScore>(); if (heatMapItemKpisResponse.Any()) { foreach (var item in heatMapItemKpisResponse) { ClientHeatMapItemScore heatMapItemScore = new ClientHeatMapItemScore(); heatMapItemScore.Score = item.metricData.IsDeviated ? DomainConstants.HeatMapScore : 0; heatMapItemScore.ClientId = item.metricData.ClientId; heatMapItemScore.HeatMapItemId = item.metricHeatMapData.HeatMapItemId; heatMapItemScore.HeatMapItemDate = existingRiskScore.M3dailyDate.Value; heatMapItemScore.RecordStatus = DomainConstants.RecordStatusActive; heatMapItemScore.CreatedDate = DateTime.Now; heatMapItemScore.CreatedBy = DomainConstants.Admin; heatMapItemScore.ModifiedDate = DateTime.Now; heatMapItemScore.ModifiedBy = DomainConstants.Admin; metricHeatMapItemsToSave.Add(heatMapItemScore); } _m3PactContext.ClientHeatMapItemScore.AddRange(metricHeatMapItemsToSave); metricHeatmapScores = metricHeatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); metricHeatmapScores.AddRange(metricHeatMapItemsToSave); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingMetricscore) + metricHeatmapScores.Sum(c => c.Score); } } } //To Calculate Weekly changed scores and insert nto item table and update Riskscore table if (existingRiskScore.ChecklistWeeklyDate != null) { List <ClientHeatMapItemScore> heatmapScores = _pendingChecklistRepository.GetHeatMapScoresToUpdate(existingRiskScore.ChecklistWeeklyDate.Value, client.ClientId, weeklyChecklistTypeId); int existingWeeklyscore = _pendingChecklistRepository.GetScore(existingRiskScore.ClientHeatMapRiskId, DomainConstants.WEEK).Value; if (weeklyHeatMapItems?.Count > 0) { List <HeatMapItem> itemToAdd = weeklyHeatMapItems.Where(c => !heatmapScores.Select(d => d.HeatMapItemId).Contains(c.HeatMapItemId))?.ToList(); if (itemToAdd?.Count > 0) { List <ClientChecklistResponseBusinessModel> submittedResponse = _pendingChecklistRepository.GetWeeklyPendingChecklistQuestions(client.ClientCode, existingRiskScore.ChecklistWeeklyDate.Value, DomainConstants.WEEK); List <ClientHeatMapItemScore> heatMapItemsToSave = _pendingChecklistRepository.MapHeatMapItemScores(client.ClientId, existingRiskScore.ChecklistWeeklyDate.Value, submittedResponse, itemToAdd); _m3PactContext.ClientHeatMapItemScore.AddRange(heatMapItemsToSave); heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); heatmapScores.AddRange(heatMapItemsToSave); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingWeeklyscore) + heatmapScores.Sum(c => c.Score); } else { heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingWeeklyscore) + heatmapScores.Sum(c => c.Score); } } else { existingRiskScore.ChecklistWeeklyDate = null; heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingWeeklyscore) + heatmapScores.Sum(c => c.Score); } } else if (weeklyHeatMapItems?.Count > 0) { DateTime?checklistSubmittedDate = _pendingChecklistRepository.GetLastSubmittedChecklist(client.ClientId, weeklyChecklistTypeId); if (checklistSubmittedDate != null && checklistSubmittedDate != default(DateTime)) { List <ClientChecklistResponseBusinessModel> submittedResponse = _pendingChecklistRepository.GetWeeklyPendingChecklistQuestions(client.ClientCode, checklistSubmittedDate.Value, DomainConstants.WEEK); List <ClientHeatMapItemScore> heatMapItemsToSave = _pendingChecklistRepository.MapHeatMapItemScores(client.ClientId, checklistSubmittedDate.Value, submittedResponse, weeklyHeatMapItems); if (heatMapItemsToSave?.Count > 0) { _m3PactContext.ClientHeatMapItemScore.AddRange(heatMapItemsToSave); existingRiskScore.RiskScore = (existingRiskScore.RiskScore) + heatMapItemsToSave?.Sum(c => c.Score); existingRiskScore.ChecklistWeeklyDate = checklistSubmittedDate; } } } // //To Calculate Weekly changed scores and insert into item table and update Riskscore table if (existingRiskScore.ChecklistMonthlyDate != null) { List <ClientHeatMapItemScore> heatmapScores = _pendingChecklistRepository.GetHeatMapScoresToUpdate(existingRiskScore.ChecklistMonthlyDate.Value, client.ClientId, monthlyChecklistTypeId); int existingMonthlyscore = _pendingChecklistRepository.GetScore(existingRiskScore.ClientHeatMapRiskId, DomainConstants.MONTH).Value; if (monthlyHeatMapItems?.Count > 0) { List <HeatMapItem> itemsToAdd = monthlyHeatMapItems.Where(c => !heatmapScores.Select(d => d.HeatMapItemId).Contains(c.HeatMapItemId))?.ToList(); if (itemsToAdd?.Count > 0) { List <ClientChecklistResponseBusinessModel> submittedResponse = _pendingChecklistRepository.GetWeeklyPendingChecklistQuestions(client.ClientCode, existingRiskScore.ChecklistMonthlyDate.Value, DomainConstants.MONTH); List <ClientHeatMapItemScore> heatMapItemsToSave = _pendingChecklistRepository.MapHeatMapItemScores(client.ClientId, existingRiskScore.ChecklistMonthlyDate.Value, submittedResponse, itemsToAdd); _m3PactContext.ClientHeatMapItemScore.AddRange(heatMapItemsToSave); heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); heatmapScores.AddRange(heatMapItemsToSave); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingMonthlyscore) + heatmapScores.Sum(c => c.Score); } else { heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList(); existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingMonthlyscore) + heatmapScores.Sum(c => c.Score); } } else { existingRiskScore.ChecklistMonthlyDate = null; heatmapScores = heatmapScores.Where(c => c.HeatMapItem.StartTime <= DateTime.Now && c.HeatMapItem.EndTime >= DateTime.Now)?.ToList();//check existingRiskScore.RiskScore = (existingRiskScore.RiskScore - existingMonthlyscore) + heatmapScores.Sum(c => c.Score); } } else if (monthlyHeatMapItems?.Count > 0) { DateTime?checklistSubmittedDate = _pendingChecklistRepository.GetLastSubmittedChecklist(client.ClientId, monthlyChecklistTypeId); if (checklistSubmittedDate != null && checklistSubmittedDate != default(DateTime)) { List <ClientChecklistResponseBusinessModel> submittedResponse = _pendingChecklistRepository.GetWeeklyPendingChecklistQuestions(client.ClientCode, checklistSubmittedDate.Value, DomainConstants.MONTH); List <ClientHeatMapItemScore> heatMapItemsToSave = _pendingChecklistRepository.MapHeatMapItemScores(client.ClientId, checklistSubmittedDate.Value, submittedResponse, monthlyHeatMapItems); if (heatMapItemsToSave?.Count > 0) { _m3PactContext.ClientHeatMapItemScore.AddRange(heatMapItemsToSave); existingRiskScore.RiskScore = (existingRiskScore.RiskScore) + heatMapItemsToSave?.Sum(c => c.Score); existingRiskScore.ChecklistMonthlyDate = checklistSubmittedDate; } } } existingRiskScore.ModifiedBy = userContext.UserId; existingRiskScore.ModifiedDate = DateTime.Now; existingRiskScore.EffectiveTime = DateTime.Now; _m3PactContext.ClientHeatMapRisk.Update(existingRiskScore); } } _m3PactContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void Build(Microsoft.Management.Odata.Schema.Schema logicalSchema, Microsoft.Management.Odata.Schema.Schema userSchema, UserContext userContext, string membershipId) { ResourceSet resourceSet = null; if (logicalSchema.ResourceSets.TryGetValue("CommandInvocations", out resourceSet)) { string str = "PowerShell.CommandInvocation"; userSchema.AddEntity(str, true, logicalSchema); userSchema.EntityMetadataDictionary.Add(str, logicalSchema.EntityMetadataDictionary[str]); userSchema.PopulateAllRelevantResourceTypes(logicalSchema); } }
private static AttachmentPolicy.Level GetAttachmentLevel(AttachmentType attachmentType, string fileExtension, string mimeType, UserContext userContext) { if (attachmentType == AttachmentType.Ole || attachmentType == AttachmentType.EmbeddedMessage) { return(AttachmentPolicy.Level.Allow); } return(AttachmentLevelLookup.GetLevelForAttachment(fileExtension, mimeType, userContext)); }
public static RecipientAddress ResolveAnrString(string name, bool resolveContactsFirst, UserContext userContext) { return(AnrManager.ResolveAnrString(name, new AnrManager.Options { ResolveContactsFirst = resolveContactsFirst }, userContext)); }
public ResourceOwnerPasswordValidator(UserContext userContext) { _userContext = userContext; }
public static AttachmentPolicy.Level GetAttachmentLevel(AttachmentInfo attachmentInfo, UserContext userContext) { if (attachmentInfo == null) { throw new ArgumentNullException("attachmentInfo"); } return(AttachmentLevelLookup.GetAttachmentLevel(attachmentInfo.AttachmentType, attachmentInfo.FileExtension, attachmentInfo.ContentType, userContext)); }
public AuthService(UserContext context, IOptions <SecretOptions> options) { this.context = context; this.jwtSecret = options.Value.JWTSecret; }
public TimeGroupByList2(ColumnId sortedColumn, SortOrder sortOrder, ItemList2 itemList, UserContext userContext) : base(sortedColumn, sortOrder, itemList, userContext) { List <TimeRange> timeRanges = TimeRange.GetTimeRanges(userContext); TimeGroupByList2.TimeGroupRange[] array = new TimeGroupByList2.TimeGroupRange[timeRanges.Count]; for (int i = 0; i < timeRanges.Count; i++) { array[i] = new TimeGroupByList2.TimeGroupRange(timeRanges[i]); if (timeRanges[i].Range == TimeRange.RangeId.Today) { this.todayIndex = i; } } base.SetGroupRange(array); }
public static RecipientAddress ResolveAnrString(string name, AnrManager.Options options, UserContext userContext) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (Globals.ArePerfCountersEnabled) { OwaSingleCounters.NamesChecked.Increment(); } AnrManager.NameParsingResult parsingResult = AnrManager.ParseNameBeforeAnr(name, options); if (options.ResolveContactsFirst) { return(AnrManager.ResolveAnrStringFromContacts(userContext, parsingResult, options, () => AnrManager.ResolveAnrStringFromAD(userContext, parsingResult, options, () => AnrManager.ResolveAnrStringToOneOffEmail(name, options)))); } return(AnrManager.ResolveAnrStringFromAD(userContext, parsingResult, options, () => AnrManager.ResolveAnrStringFromContacts(userContext, parsingResult, options, () => AnrManager.ResolveAnrStringToOneOffEmail(name, options)))); }
public UserRepository(UserContext context) { _context = context; }