public Store(ICatalog catalog, IInventory inventory, IHistory history, float capital) { Money = capital; this.catalog = catalog; this.inventory = inventory; this.history = history; }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Session = new SessionOperations(this); Devices = new Devices(this); Dings = new Dings(this); History = new History(this); BaseUri = new System.Uri("https://api.ring.com"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
private void UpdateTempAttachments(IHistory history) { WorkItem workItem = PageWorkItem; if (workItem == null) { return; } object oStrTempAssociationID = workItem.State["TempAssociationID"]; if (oStrTempAssociationID == null) { return; } string strTempAssociationID = oStrTempAssociationID.ToString(); Type typ = EntityContext.EntityType; IList <IAttachment> attachments = Rules.GetAttachmentsFor(typ, strTempAssociationID); if (attachments != null) { foreach (IAttachment attachment in attachments) { attachment.HistoryId = history.Id.ToString(); attachment.ActivityId = history.ActivityId; attachment.AccountId = history.AccountId; attachment.ContactId = history.ContactId; attachment.Save(); /* Move the attachment from the \Attachment\_temporary path to the \Attachment path. */ Rules.MoveTempAttachment(attachment); } } workItem.State.Remove("TempAssociationID"); }
internal BrowsingContext(IConfiguration configuration, Sandboxes security) { _configuration = configuration; _security = security; _loader = this.CreateDocumentLoader(); _history = this.CreateHistory(); }
internal BrowsingContext(IConfiguration configuration, Sandboxes security) { _configuration = configuration; _security = security; _loader = this.CreateLoader(); _history = this.CreateHistory(); }
public static void Save(IHistory orgHistory, User user, HistoryAction action = HistoryAction.Создал) { HistoryList historyList = HistoryList.GetUniqueInstance(); History history; if (action == HistoryAction.Удалил) { history = new History(orgHistory, user); history.Action = action; } else { var list = historyList.GetList(orgHistory); if (list.Count == 2) { history = historyList.GetItem(orgHistory, HistoryAction.едактировал); history._user = user; } else { history = new History(orgHistory, user); history.Action = (list.Count == 0) ? HistoryAction.Создал : HistoryAction.едактировал; } } history._datetime = DateTime.Now; history.Save(); historyList.Add(history); }
private History(IHistory history, User user) { ID = history.ID; Name = history.ShortName; Type = history.Type; _user = user; }
public static void Save(IHistory orgHistory, User user, HistoryAction action = HistoryAction.Создал) { HistoryList historyList = HistoryList.GetUniqueInstance(); History history; if (action == HistoryAction.Удалил) { history = new History(orgHistory, user); history.Action = action; } else { var list = historyList.GetList(orgHistory); if (list.Count == 2) { history = historyList.GetItem(orgHistory, HistoryAction.Редактировал); history._user = user; } else { history = new History(orgHistory, user); history.Action = (list.Count == 0) ? HistoryAction.Создал : HistoryAction.Редактировал; } } history._datetime = DateTime.Now; history.Save(); historyList.Add(history); }
private void Delete(LineShape line, IHistory history) { if (line.Owner != null && line.Owner is Layer) { (line.Owner as Layer).Shapes.RemoveWithHistory(line, history); } }
internal BrowsingContext(IConfiguration configuration, Sandboxes security) { _configuration = configuration; _security = security; _loader = this.CreateService<IDocumentLoader>(); _history = this.CreateService<IHistory>(); }
/// <summary> /// Removes all items from the source list with history. /// </summary> /// <typeparam name="T">The item type.</typeparam> /// <param name="source">The source list.</param> /// <param name="history">The history object.</param> public static void ClearWithHistory <T>(this IList <T> source, IHistory history) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (history == null) { throw new ArgumentNullException(nameof(history)); } if (source.Count > 0) { T[] items = source.ToArray(); Action redo = () => { foreach (var item in items) { source.Remove(item); } }; Action undo = () => { foreach (var item in items) { source.Add(item); } }; history.Snapshot(undo, redo); redo.Invoke(); } }
internal HistoryContext(IHistory history, IScheduler outputScheduler) { _history = history; var CanUndo = CanRecord .CombineLatest(history.CanUndo, (recordable, executable) => recordable && executable); Undo = ReactiveCommand.CreateFromObservable <Unit, HistoryEntry>( unit => history.Undo(entry => ResolveCommand(entry).Discard(entry)), CanUndo, outputScheduler); var CanRedo = CanRecord .CombineLatest(history.CanRedo, (recordable, executable) => recordable && executable); Redo = ReactiveCommand.CreateFromObservable <Unit, HistoryEntry>( unit => history.Redo(entry => ResolveCommand(entry).Execute(entry)), CanRedo, outputScheduler); Clear = ReactiveCommand.CreateFromObservable( history.Clear, history.CanClear, outputScheduler); }
public Server(IDisplay disp) { history = new History(); display = disp; players = new List <BasePlayer>(); MaxTry = 100; }
public HistoryProxy() { ChannelFactory <IHistory> channelFactory = new ChannelFactory <IHistory> (new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:7017/IHistory")); proxy = channelFactory.CreateChannel(); }
public static ReactiveCommandWithHistory <TParam, TResult> CreateWithHistoryFromObservable <TParam, TResult>( string commandKey, Func <TParam, TResult, IObservable <TResult> > execute, Func <TParam, TResult, IObservable <TResult> > discard, IHistory history, IObservable <bool>?canExecute = null, IScheduler?outputScheduler = null) { if (history == null) { throw new ArgumentNullException(nameof(history)); } if (discard == null) { throw new ArgumentNullException(nameof(discard)); } if (execute == null) { throw new ArgumentNullException(nameof(execute)); } return(CreateWithHistoryFromObservable( commandKey, execute, discard, HistoryContext.GetContext(history, outputScheduler), canExecute, outputScheduler)); }
public static ReactiveCommandWithHistory <Unit, TResult> CreateWithHistory <TResult>( string commandKey, Func <TResult, TResult> execute, Func <TResult, TResult> discard, IHistory history, IObservable <bool>?canExecute = null, IScheduler?outputScheduler = null) { if (history == null) { throw new ArgumentNullException(nameof(history)); } if (discard == null) { throw new ArgumentNullException(nameof(discard)); } if (execute == null) { throw new ArgumentNullException(nameof(execute)); } return(CreateWithHistory <Unit, TResult>(commandKey, (param, result) => execute(result), (param, result) => discard(result), history, canExecute, outputScheduler)); }
public static ReactiveCommandWithHistory <Unit, Unit> CreateWithHistory( string commandKey, Action execute, Action discard, IHistory history, IObservable <bool>?canExecute = null, IScheduler?outputScheduler = null) { if (history == null) { throw new ArgumentNullException(nameof(history)); } if (discard == null) { throw new ArgumentNullException(nameof(discard)); } if (execute == null) { throw new ArgumentNullException(nameof(execute)); } return(CreateWithHistory <Unit, Unit>(commandKey, (param, result) => { execute(); return Unit.Default; }, (param, result) => { discard(); return Unit.Default; }, history, canExecute, outputScheduler)); }
public static ReactiveCommandWithHistory <Unit, Unit> CreateWithHistoryFromTask( string commandKey, Func <CancellationToken, Task> execute, Func <CancellationToken, Task> discard, IHistory history, IObservable <bool>?canExecute = null, IScheduler?outputScheduler = null) { if (history == null) { throw new ArgumentNullException(nameof(history)); } if (discard == null) { throw new ArgumentNullException(nameof(discard)); } if (execute == null) { throw new ArgumentNullException(nameof(execute)); } return(CreateWithHistoryFromObservable <Unit, Unit>(commandKey, (param, result) => Observable.StartAsync(ct => execute(ct)), (param, result) => Observable.StartAsync(ct => discard(ct)), history, canExecute, outputScheduler)); }
internal BrowsingContext(IBrowsingContext parent, Sandboxes security) : this(security) { _parent = parent; _creator = _parent.Active; _history = GetService <IHistory>(); }
private void SetScheduledByLabel(IHistory history) { Sage.Platform.Application.IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Application.IContextService>(true); Sage.Platform.TimeZone tz = context["TimeZone"] as Sage.Platform.TimeZone; if (tz != null) { string startDate = tz.UTCDateTimeToLocalTime(history.StartDate).Date.ToShortDateString(); string createdate = tz.UTCDateTimeToLocalTime(history.CreateDate).Date.ToShortDateString(); if (history.Timeless) { startDate = history.StartDate.Date.ToShortDateString(); } string userName; IUser createUser = Sage.Platform.EntityFactory.GetById <IUser>(history.UserId); if (createUser != null) { userName = createUser.UserInfo.UserName; } else { if (history.CreateUser.ToUpper().Trim() == "PROCESS") { userName = "******"; } else { userName = "******"; } } CreateUser.Text = GetLocalResourceObject("rsScheduledOn") + " " + createdate + " " + GetLocalResourceObject("rsBy") + " " + userName + " " + GetLocalResourceObject("rsOriginallyFor") + " " + startDate; } }
public static void Rotate(IEnumerable <IBaseShape> shapes, double angle, IHistory history) { var groupBox = new GroupBox(shapes.ToList()); if (groupBox.Boxes.Length <= 0) { return; } var boxes = groupBox.Boxes.ToList(); var previous = new List <(IPointShape point, double x, double y)>(); var next = new List <(IPointShape point, double x, double y)>(); var radians = angle * Math.PI / 180.0; var centerX = groupBox.Bounds.CenterX; var centerY = groupBox.Bounds.CenterY; foreach (var point in boxes.SelectMany(box => box.Points).Distinct()) { PointUtil.Rotate(point, radians, centerX, centerY, out var x, out var y); previous.Add((point, point.X, point.Y)); next.Add((point, x, y)); point.X = x; point.Y = y; } history.Snapshot(previous, next, (p) => previous.ForEach(p => { p.point.X = p.x; p.point.Y = p.y; })); }
internal BrowsingContext(IEnumerable <Object> services, Sandboxes security) : this(security) { _services.AddRange(services); _originalServices = services; _history = GetService <IHistory>(); }
protected override void OnFormBound() { base.OnFormBound(); IHistory history = (IHistory)BindingSource.Current; SetScheduledByLabel(history); cmdDelete.OnClientClick = FormHelper.GetConfirmDeleteScript(); ClientBindingMgr.RegisterSaveButton(cmdOK); bool isEditAllowed = CurrentUserId == history.UserId || CurrentUserId == "ADMIN"; cmdDelete.Visible = isEditAllowed; cmdOK.Visible = isEditAllowed; ApplicationPage page = (ApplicationPage)Page; page.TitleBar.Image = ResolveUrl(GetTitleBarImage()); var parms = AppContext["ActivityParameters"] as System.Collections.Generic.Dictionary <string, string>; if ((parms != null) && parms.ContainsKey("AllowEditHistory")) { //means we dropped an email - the delete button should dissappear and cancel should delete the record... cmdDelete.Visible = false; } }
/// <summary> /// Adds item to the source list with history. /// </summary> /// <typeparam name="T">The item type.</typeparam> /// <param name="source">The source list.</param> /// <param name="item">The item to add.</param> /// <param name="history">The history object.</param> public static void AddWithHistory <T>(this IList <T> source, T item, IHistory history) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (item == null) { throw new ArgumentNullException(nameof(item)); } if (history == null) { throw new ArgumentNullException(nameof(history)); } int index = source.Count; void redo() => source.Insert(index, item); void undo() => source.RemoveAt(index); history.Snapshot(undo, redo); redo(); }
/// <summary> /// Removes item from the source list with history. /// </summary> /// <typeparam name="T">The item type.</typeparam> /// <param name="source">The source list.</param> /// <param name="index">The item index to remove.</param> /// <param name="history">The history object.</param> public static void RemoveWithHistory <T>(this IList <T> source, int index, IHistory history) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (index < 0) { throw new IndexOutOfRangeException("Index can not be negative."); } if (history == null) { throw new ArgumentNullException(nameof(history)); } var item = source[index]; void redo() => source.RemoveAt(index); void undo() => source.Insert(index, item); history.Snapshot(undo, redo); redo(); }
public Banned(Script script, IHistory history) : base(script, ((ClrFunction)script.Engine.Global["Collection"]).InstancePrototype) { this.script = script; this.history = history; this.PopulateFunctions(); }
public ActionResult CitiesUndo(DateTime time, int step) { TempData["IsAdminView"] = false; history = new HistoryCities(); step = history.Undone(step, time); return(RedirectToAction("Cities", "History", new { time = time, step = step })); }
public Collection(IHistory <TKey, TValue> history) { _history = history; _dictionary = new ConcurrentDictionary <TKey, TValue>(); _history.Replay(_dictionary); _history.Clear(); }
public void ReadHistoryTest() { IReadHistoryService hs = new ReadHistory(@"..\..\..\Saves\HistoriesTest\"); IHistory history = hs.Read("HistoryTest.json"); Assert.AreEqual(1, history.LastId); Assert.AreEqual(2, history.HistoryList.Count); }
public void MoveByWithHistory(double dx, double dy, IHistory history) { var previous = new { DeltaX = -dx, DeltaY = -dy, Shape }; var next = new { DeltaX = dx, DeltaY = dy, Shape }; history.Snapshot(previous, next, (s) => s.Shape.Move(null, s.DeltaX, s.DeltaY)); Shape.Move(null, dx, dy); }
/// <summary> /// Undo a history into the historys. /// </summary> /// <param name="history"> The history. </param> public static void Push(IHistory history) { HistoryBase.Instances.Add(history); if (HistoryBase.Instances.Count > HistoryBase.Limit) { HistoryBase.Instances.RemoveAt(0); } }
public ActionResult AuthorsRedo(DateTime time, int step) { TempData["IsAdminView"] = false; history = new HistoryAuthors(); step = history.Redone(step, time); return(RedirectToAction("Authors", "History", new { time = time, step = step })); }
public void MoveByWithHistory(decimal dx, decimal dy, IHistory history) { var previous = new { DeltaX = -dx, DeltaY = -dy, Shape = _shapeViewModel }; var next = new { DeltaX = dx, DeltaY = dy, Shape = _shapeViewModel }; history.Snapshot(previous, next, (s) => s.Shape.Move(null, s.DeltaX, s.DeltaY)); _shapeViewModel.Move(null, dx, dy); }
public static void TACCompleteStep( IActivity activity, string userId, string result, string resultCode, DateTime completeDate, ref IHistory hresult) { // TODO: Complete business rule implementation //========================================================= // TAC Code Here //========================================================= foreach (Sage.Entity.Interfaces.IActivityIssuer tmpAI in activity.ActivityIssuers ) { Sage.Entity.Interfaces.IHistoryIssuer tmpHI = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IHistoryIssuer>(); tmpHI.History = hresult; tmpHI.Accountid = tmpAI.AccountID ; tmpHI.Symbol = tmpAI.Symbol ; tmpHI.Save (); } }
public static void GetMRSymbolStep( IHistory history, out System.String result) { // TODO: Complete business rule implementation // TAC Code here string tmpResult = ""; foreach (Sage.Entity.Interfaces.IHistoryIssuer tmpIssuer in history.HistoryIssuers ) { tmpResult += tmpIssuer.Symbol + ", "; } if(String.IsNullOrEmpty(tmpResult)) { } else { //Clean the trailing comma tmpResult = tmpResult.Remove(tmpResult.Length - 1, 1); } //textsizeValue = textsizeValue .Substring(0, Len(textsizeValue ) - 1) ; result = tmpResult; }
public HomeViewModel(ILog log, IAccount account, ILocalize localize, IApplication application, IHistory history, INavigationService navigationService, IUser user, IRepository repository, IList<IExerciseType> exerciseTypes, ISettings settings) { _log = log; _localize = localize; _application = application; Account = account; _history = history; _history.OnHistoryItemsChanged += _history_OnHistoryItemsChanged; _NavigationService = navigationService; User = user; ExerciseTypes = exerciseTypes; _repository = repository; _settings = settings; _settings.OnSettingsChanged += _settings_OnSettingsChanged; _settings.Load(); _history.Load(); _repository.Single<User>(1).ContinueWith(t => { var foundUser = t.Result; if (foundUser == null) { //this is first load of the app, set it up _repository.Insert<User>(this.User).ContinueWith(task => { this.User = this.User; Account.AccessToken = this.User.RunkeeperToken; }); } else { User = foundUser; Account.AccessToken = foundUser.RunkeeperToken; } }); if (_exerciseTypes == null || _exerciseTypes.Count == 0 || (_exerciseTypes.Count == 1 && _exerciseTypes[0].Id == 0)) { if (HomeViewModel.cachedTypes != null) { this.ExerciseTypes = HomeViewModel.cachedTypes; _log.Info("cache hit"); } else { _log.Info("cache miss"); this.ExerciseTypes = DefaultTypes; _log.Info("default types set, querying"); _repository.Query<ExerciseType>("select * from ExerciseType").ContinueWith(t => { _log.Info("query complete"); var types = t.Result; if (types == null || types.Count == 0) { _log.Info("db does not have Exercise types, loading default items"); foreach (var e in from tt in this.ExerciseTypes orderby tt.Id select tt) { _repository.Insert<ExerciseType>(e); } } else { _log.Info("all excecise types retreived from the db, update local data store"); this.ExerciseTypes = (from tt in types select tt).ToArray(); } _log.Info("cache extypes to static var"); HomeViewModel.cachedTypes = ExerciseTypes; }); } } }
private void SetScheduledByLabel(IHistory history) { Sage.Platform.Application.IContextService context = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Application.IContextService>(true); Sage.Platform.TimeZone tz = context["TimeZone"] as Sage.Platform.TimeZone; if (tz != null) { string startDate = tz.UTCDateTimeToLocalTime(history.StartDate).Date.ToShortDateString(); string createdate = tz.UTCDateTimeToLocalTime(history.CreateDate).Date.ToShortDateString(); if (history.Timeless) { startDate = history.StartDate.Date.ToShortDateString(); createdate = history.CreateDate.Date.ToShortDateString(); } string userName; IUser createUser = Sage.Platform.EntityFactory.GetById<IUser>(history.CreateUser); if (createUser != null) userName = createUser.UserInfo.UserName; else { if (history.CreateUser.ToUpper().Trim() == "PROCESS") { userName = "******"; } else { userName = "******"; } } CreateUser.Text = GetLocalResourceObject("rsScheduledOn") + " " + createdate + " " + GetLocalResourceObject("rsBy") + " " + userName + " " + GetLocalResourceObject("rsOriginallyFor") + " " + startDate; } }
/// <summary> /// Initializes a new instance of the <see cref="History_InfoViewModel" /> class. /// </summary> /// <param name="dialogService">The Dialog Service.</param> /// <param name="navigationService">The Navigation Service.</param> /// <param name="history">The History.</param> public History_InfoViewModel(IDialogService dialogService, INavigationService navigationService, IHistory history) { _dialogService = dialogService; _navigationService = navigationService; _history = history; }
public static void TACCompleteActivity(IActivity activity, string userId, string result, string resultCode, DateTime completeDate, ref IHistory historyresult) { }
private bool ScheduleFollowUp(IHistory hist) { ListBox lbFollowUp = FindCompActControl("FollowUp") as ListBox; if (lbFollowUp == null) return false; CheckBox cxCarryOverNotes = FindCompActControl("CarryOverNotes") as CheckBox; if (cxCarryOverNotes == null) return false; CheckBox cxCarryOverAttachments = FindCompActControl("CarryOverAttachments") as CheckBox; if (cxCarryOverAttachments == null) return false; if (lbFollowUp.SelectedValue == "None" || lbFollowUp.SelectedValue == "") return false; Dictionary<string, string> args = new Dictionary<string, string>(); args.Add("type", lbFollowUp.SelectedValue); if (cxCarryOverNotes.Checked || cxCarryOverAttachments.Checked) { args.Add("historyid", hist.Id.ToString()); } if (cxCarryOverNotes.Checked) { args.Add("carryovernotes", "true"); } if (cxCarryOverAttachments.Checked) { args.Add("carryoverattachments", "true"); } args.Add("aid", hist.AccountId); args.Add("cid", hist.ContactId); args.Add("oid", hist.OpportunityId); args.Add("tid", hist.TicketId); args.Add("lid", hist.LeadId); args.Add("leadname", hist.LeadName); args.Add("description", hist.Description); // if we're in batch mode (multiple complete from ActivityReminders) // pass that fact on to ScheduleActivity, so it can link to next activity in batch if (GetParam("mode") == "batch") args.Add("mode", "batch"); //Add issuers to list Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IHistoryIssuer> f = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IHistoryIssuer>(); Sage.Platform.Repository.ICriteria crit = f.CreateCriteria(); crit.Add(f.EF.Eq("HistoryId", hist.HistoryId)); int i = 0; foreach (Sage.Entity.Interfaces.IHistoryIssuer hi in crit.List<Sage.Entity.Interfaces.IHistoryIssuer>()) { hist.HistoryIssuers.Add(hi); args.Add("Issuer" + i, hi.Accountid); args.Add("IssuerSymbol" + i, hi.Symbol); i++; } args.Add("IssuerCount", Convert.ToString(i)); Link.ScheduleActivity(args); return true; }
protected void CreateTicketActivity(IHistory history) { TicketActivity.Rules.AddTicketActivityFromCompletedActivity(null, history.UserId, history.Result, history.ResultCode, history.CompletedDate, ref history); }
private void SetTitleBar(IHistory history) { string text = string.Format("{0} - {1}", Sage.Platform.Orm.Localization.Utility.GetLocalizedDisplayName(history.GetType()), history); image = Page.ResolveClientUrl("../../images/clear.gif"); lblDialogTitle.Text = string.IsNullOrEmpty(text) ? GetLocalResourceObject("DialogTitle").ToString() : text; //TODO: imgHistType is placeholder for History icons to be added at a later date imgHistType.ImageUrl = image; }
public void Constructor() { _history = InstantiateHistory(0); }
internal List<History> GetList(IHistory orgHistory) { return _list.Where(item => (item as History).ID == orgHistory.ID && (item as History).Type == orgHistory.Type).Select(item => item as History).ToList(); }
public HistoryTest() { _history = InstantiateHistory(25); }
public void TestConstructorSetsSize() { _history = InstantiateHistory(89); Assert.IsTrue(_history.Size == 89); }
private bool ScheduleFollowUp(IHistory hist) { ListBox lbFollowUp = FindCompActControl("FollowUp") as ListBox; if (lbFollowUp == null) return false; CheckBox cxCarryOverNotes = FindCompActControl("CarryOverNotes") as CheckBox; if (cxCarryOverNotes == null) return false; CheckBox cxCarryOverAttachments = FindCompActControl("CarryOverAttachments") as CheckBox; if (cxCarryOverAttachments == null) return false; if (lbFollowUp.SelectedValue == "None") return false; Dictionary<string, string> args = new Dictionary<string, string>(); args.Add("type", lbFollowUp.SelectedValue); if (cxCarryOverNotes.Checked || cxCarryOverAttachments.Checked) { args.Add("historyid", hist.Id.ToString()); } if (cxCarryOverNotes.Checked) { args.Add("carryovernotes", "true"); } if (cxCarryOverAttachments.Checked) { args.Add("carryoverattachments", "true"); } args.Add("aid", hist.AccountId); args.Add("cid", hist.ContactId); args.Add("oid", hist.OpportunityId); args.Add("tid", hist.TicketId); args.Add("lid", hist.LeadId); // if we're in batch mode (multiple complete from ActivityReminders) // pass that fact on to ScheduleActivity, so it can link to next activity in batch if (GetParam("mode") == "batch") args.Add("mode", "batch"); Link.ScheduleActivity(args); return true; }
private void UpdateEntityHistory(IHistory hist) { //Remove deleted Activity from Entity History List<EntityHistory> removeList = new List<EntityHistory>(); foreach (Sage.Platform.Application.EntityHistory eh in EntityContext.EntityHistory) { if (eh.EntityId.ToString() == hist.ActivityId) { removeList.Add(eh); } } foreach (Sage.Platform.Application.EntityHistory ehr in removeList) { EntityContext.EntityHistory.Remove(ehr); } }
public void SetUp() { _devices = new Dictionary<IDevice, int>(); for (var i = 0; i < 5; i++) { var device = NewDevice("Device " + i); _devices.Add(device, 0); } _events = Utilities.GenerateEvents<IEvent>(e => { var device = Utilities.Random.RandomElement(_devices.Keys); e.SetupGet(x => x.Entity).Returns(device); _devices[device] = _devices[device] + 1; }).ToList(); _historyMock = new Mock<IHistory<IEvent>>(); _historyMock.Setup(x => x.GetEnumerator()).Returns(() => _events.GetEnumerator()); _history = _historyMock.Object; }
private void LinkToNextDialog(IHistory hist) { string nextActivityInBatch = GetNextActivityInBatch(hist.ActivityId); if (ScheduleFollowUp(hist)) return; // handle batch mode in ActivityDetailsManager if (nextActivityInBatch != null) { Dictionary<string, string> args = new Dictionary<string, string>(); args.Add("mode", "batch"); Link.CompleteActivity(nextActivityInBatch, args); } }
private void AddEntityAssociation(IHistory history, string entityID, string entityType) { string simpleName = entityType.ToUpper().Replace("SAGE.ENTITY.INTERFACES.", ""); switch (simpleName) { case "IACCOUNT" : history.AccountId = entityID; break; case "ICONTACT" : history.ContactId = entityID; var con = EntityFactory.GetById<IContact>(entityID); history.AccountId = con.Account.Id.ToString(); history.AccountName = con.AccountName; history.LeadName = con.NameLF; break; case "ILEAD" : history.LeadId = entityID; var lead = EntityFactory.GetById<ILead>(entityID); history.AccountName = lead.Company; history.ContactName = lead.LeadNameFirstLast; break; case "IOPPORTUNITY" : history.OpportunityId = entityID; var opp = EntityFactory.GetById<IOpportunity>(entityID); if (opp != null) { history.AccountId = opp.Account.Id.ToString(); history.AccountName = opp.Account.AccountName; } break; case "ITICKET" : history.TicketId = entityID; var tic = EntityFactory.GetById<ITicket>(entityID); if (tic != null) { history.TicketNumber = tic.TicketNumber; history.AccountId = tic.Account.Id.ToString(); history.AccountName = tic.Account.AccountName; history.ContactId = tic.Contact.Id.ToString(); history.ContactName = tic.Contact.NameLF; } break; //default: // String tableName = GetTableName(entityType); // PropertyDescriptor propertyDescriptor = // TypeDescriptor.GetProperties(history).Find(String.Format("{0}Id", tableName), true); // if (propertyDescriptor != null) // propertyDescriptor.SetValue(history, entityID); // break; } }
private void UpdateActivityAttachments(IHistory history) { UpdateTempAttachments(history); IList<IAttachment> attachments = Rules.GetAttachmentsFor(typeof(IActivity), Activity.ActivityId); if (attachments == null) return; foreach (IAttachment attachment in attachments) { attachment.HistoryId = history.HistoryId; attachment.Save(); } }
public TrackingViewModel(ILog log, IAccount account, ILocalize localize, IApplication application, IGeoPositionWatcher<GeoCoordinate> coordinateProvider, IHistory history, IRepository repository, ISettings settings) { _log = log; _localize = localize; _application = application; _coordinateProvider = coordinateProvider; _history = history; _repository = repository; _settings = settings; Account = account; _started = false; _startTime = System.Environment.TickCount; _coordinateProvider.PositionChanged += _coordinateProvider_PositionChanged; _coordinateProvider.Start(); UICoordinates = new GeoCoordinateCollection(); _timer.Interval = TimeSpan.FromSeconds(1); _timer.Tick += Timer_Tick; MapCenter = new GeoCoordinate(0, 0); Heading = 0; ZoomLevel = 15; Pitch = 55; PedestrianFeaturesEnabled = true; LandmarksEnabled = true; DistanceDisplay = "0 km"; if (!_settings.IsMetric) DistanceDisplay = "0 mi"; PaceDisplay = "00:00"; CaloriesDisplay = "0"; TimeDisplay = "00:00"; StrokeColor = System.Windows.Media.Colors.Red; StrokeThickness = 5; Coordinates.Clear(); StartVisibility = (!_started ? Visibility.Visible : Visibility.Collapsed); StopVisibility = (_started ? Visibility.Visible : Visibility.Collapsed); PauseVisibility = (!_paused ? Visibility.Visible : Visibility.Collapsed); ResumeVisibility = (_paused ? Visibility.Visible : Visibility.Collapsed); }
private void UpdateTempAttachments(IHistory history) { if (!Form.IsInsert) return; WorkItem workItem = PageWorkItem; if (workItem == null) return; object oStrTempAssociationID = workItem.State["TempAssociationID"]; if (oStrTempAssociationID == null) return; string strTempAssociationID = oStrTempAssociationID.ToString(); Type typ = EntityContext.EntityType; IList<IAttachment> attachments = Rules.GetAttachmentsFor(typ, strTempAssociationID); if (attachments != null) { foreach (IAttachment attachment in attachments) { attachment.HistoryId = history.Id.ToString(); attachment.Save(); /* Move the attachment from the \Attachment\_temporary path to the \Attachment path. */ Rules.MoveTempAttachment(attachment); } } workItem.State.Remove("TempAssociationID"); }
public static void OnAfterInsertStep(IHistory history) { // NOTE: This empty step is here so that any Post Execute Step can be disabled easily. }
public History GetItem(IHistory orgHistory, HistoryAction action) { var list = GetList(orgHistory).Where(item => item.Action == action).ToList(); return (list.Count == 0) ? null : list.First(); }
void _history_OnHistoryItemsChanged(IHistory history, IList<IHistoryItem> changedItems) { Dispatcher("History"); }
private void Initialize() { _resultListView = new MvxListView(Context, null); AddSearchBox(); AddResultView(); AddProgressView(); _searcher = Mvx.Resolve<ISearcher>(); _history = Mvx.Resolve<IHistory>(); }
public string GetItemString(IHistory orgHistory, HistoryAction action) { History history = GetItem(orgHistory, action); return (history == null) ? string.Empty : history.ToString(); }