void OpenBreadcrump(HistoryElement history) { //Destroy all breadcrumps after the one clicked GMButton button = breadcrumps.FirstOrDefault(b => b.Value == history).Key; if (button != null) { int childIndex = button.transform.GetSiblingIndex(); for (int i = transform.childCount - 1; i >= childIndex; --i) { Transform breadcrump = transform.GetChild(i); GMButton _button = breadcrump.GetComponent <GMButton>(); if (_button != null) { breadcrumps.Remove(_button); Destroy(_button.gameObject); } } } this.Publish(new Service.DevUIService.Events.NewDataTable() { // since this is a single object and the DataBrowser is meant for lists, wrap the object in a list objectList = history.objectList, tableTitle = history.historyTitle, }); }
public async Task AddHistoryElement(long id, HistoryElement historyElement) { var organization = await GetByIdAsync(id); if (organization != null) { organization.History.Add(historyElement); await UpdateAsync(organization); } }
public static void AddLogEntry(HistoryElement element) { using (ConnectionPool.ConnectionUsable usable = new ConnectionPool.ConnectionUsable()) { using (NpgsqlCommand command = usable.Connection.CreateCommand()) { command.CommandText = $"INSERT INTO t_history(msgtimestamp, source, status, message) Values (@time, '{element.Source}', '{element.Status}', '{element.Message}');"; command.Parameters.AddWithValue("@time", NpgsqlDbType.Timestamp, element.TimeStamp); command.ExecuteNonQuery(); } } }
public HistoryItem(HistoryElement element) { InitializeComponent(); Server from = Switcher.Servers.First(x => x.UID == element.FromUID); Server to = Switcher.Servers.First(x => x.UID == element.ToUID); lblFrom.Text = from.ServerName; lblTo.Text = to.ServerName; lblDateTime.Text = $"{element.DateTime.ToShortDateString()} {element.DateTime.ToShortTimeString()}"; pctrServerIconFrom.Image = from.Icon; pctrServerIconTo.Image = to.Icon; }
public void AddToHistory(HistoryElement element) { if (!recordHystory) { return; } recordStack.Add(element); if (redoStack.Count != 0) { redoStack.Clear(); } }
void SpawnBreadcrump(HistoryElement historyElement) { GMButton breadcrump = Instantiate(breadcrumpTemplate); breadcrump.transform.SetParent(transform, false); if (!breadcrump.gameObject.activeSelf) { breadcrump.gameObject.SetActive(true); } breadcrump.GetComponentInChildren <Text>().text = historyElement.historyTitle; breadcrump.onClick.AddListener( () => OpenBreadcrump(historyElement) ); breadcrumps.Add(breadcrump, historyElement); }
public async Task AddHistoryElement(long id, HistoryElement historyElement) { Contact contact = await Entities .Include(x => x.Address) .Include(x => x.ContactPossibilities) .Include(x => x.Events) .ThenInclude(y => y.Event) .Include(x => x.OrganizationContacts) .Include(x => x.History) .FirstOrDefaultAsync(x => x.Id == id); if (contact != null) { contact.History.Add(historyElement); await UpdateAsync(contact); } }
private void Canvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (line && e.LeftButton == MouseButtonState.Released) { currentPosition = new Point(0, 0); List <UIElement> copy = new List <UIElement>(); copy.AddRange(HistoryElement); History.Add(copy); HistoryElement.Clear(); UndoButton.IsEnabled = (UndoList.Count <= 0); } if (rectangle && e.LeftButton == MouseButtonState.Released) { HistoryElement.Add(_rectangle); _rectangle = new Rectangle(); List <UIElement> copy = new List <UIElement>(); copy.AddRange(HistoryElement); History.Add(copy); HistoryElement.Clear(); UndoButton.IsEnabled = (UndoList.Count <= 0); } if (ellipse && e.LeftButton == MouseButtonState.Released) { HistoryElement.Add(_ellipse); _ellipse = new Ellipse(); List <UIElement> copy = new List <UIElement>(); copy.AddRange(HistoryElement); History.Add(copy); HistoryElement.Clear(); UndoButton.IsEnabled = (UndoList.Count <= 0); } if (triangle && e.LeftButton == MouseButtonState.Released) { HistoryElement.Add(_triangle); _triangle = new Polygon(); List <UIElement> copy = new List <UIElement>(); copy.AddRange(HistoryElement); History.Add(copy); HistoryElement.Clear(); UndoButton.IsEnabled = (UndoList.Count <= 0); } }
// Update is called once per frame void FixedUpdate() { if (history.Count != 0) { if (iteration < history.Count) { historyMoment = history[iteration]; if (!historyMoment.getJump() && !collidersAreSimilar()) { if (errors > 8) { camera.Death(transform.gameObject); } else { errors++; } } else { errors = 0; } transform.position = historyMoment.getPosition(); cosmonaut.rotation = historyMoment.getRotation(); animator.SetBool("run", historyMoment.getRunning()); Debug.Log("Rot" + historyMoment.getRotation().eulerAngles); if (historyMoment.getF()) { actionScript.action(); Debug.Log("КОРОБКА"); } iteration++; } else { if (actionScript.getBox() != null) { actionScript.throwBox(); } transform.gameObject.SetActive(false); } } }
public void AddCalledElementInOrder(HistoryElement element) { if (debug) { if (lastFrame != Time.frameCount) { calledElementsInOrder.Clear(); lastFrame = Time.frameCount; } calledElementsInOrder.Add(element); if (stepByStep) { Debug.Break(); } } else { calledElementsInOrder.Clear(); } }
private string GetElementCollumn(HistoryElement element, int collumn) { switch (collumn) { case 0: return(PrimaryCellConverter(element.TimeStamp)); case 1: return(element.Status); case 2: return(element.Source); case 3: return(element.Message); default: throw new IndexOutOfRangeException(); } }
public ActionResult CreateNewEntry(HistoryElement element) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } using (ConnectionPool.ConnectionUsable usable = new ConnectionPool.ConnectionUsable()) { using (NpgsqlCommand command = usable.Connection.CreateCommand()) { command.CommandText = $"INSERT INTO t_history(msgtimestamp, source, status, message) Values (@time, @source, @status, @message);"; command.Parameters.AddWithValue("@time", NpgsqlDbType.Timestamp, element.TimeStamp); command.Parameters.AddWithValue("@source", NpgsqlDbType.Text, element.Source); command.Parameters.AddWithValue("@status", NpgsqlDbType.Text, element.Status); command.Parameters.AddWithValue("@message", NpgsqlDbType.Text, element.Message); command.ExecuteNonQuery(); } } return(Ok()); }
public void AddToHistory(HistoryElement element) { if (!recordHystory) return; recordStack.Add(element); if (redoStack.Count != 0) redoStack.Clear(); }
private string GetSettings(int subscriptionId) { var subscription = Query.Subscriptions.GetInfo(subscriptionId); if (subscription != null) { var plans = Query.Plans.GetList(); var plan = plans.Where(p => p.planId == subscription.planId).First(); var scaffold = new Scaffold("/Views/Subscription/settings.html"); scaffold.Bind(new { subscription = new { plan.name, price = (subscription.pricePerUser * subscription.totalUsers).ToString("C"), users = subscription.totalUsers, schedule = subscription.paySchedule == 0 ? "month" : "year", plural = subscription.totalUsers > 1 ? "s" : "", owner = subscription.ownerName } }); if (subscription.userId == User.userId) { //subscription belongs to user, show billing info & other options (upgrade, downgrade, cancel) var outstanding = Query.Subscriptions.GetOutstandingBalance(User.userId); var subscriptionAge = (DateTime.Now - subscription.datestarted).TotalMinutes; scaffold.Bind(new { outstanding = new { price = outstanding.totalOwed.ToString("C"), duedate = outstanding.duedate.Value.ToShortDateString(), when = outstanding.duedate.Value < DateTime.Now ? "was" : "will be" } }); scaffold.Show("is-outstanding"); scaffold.Show("can-cancel"); if (outstanding.duedate.Value < DateTime.Now) { scaffold.Show("is-overdue"); } if (subscription.paySchedule == Query.Models.PaySchedule.monthly) { scaffold.Show("is-monthly"); } if (subscription.planId >= 1) { //show modify option scaffold.Show("can-modify"); if (subscription.totalUsers > 1) { scaffold.Show("is-team"); } else { scaffold.Show("is-not-team"); } if (subscription.planId == 1) { scaffold.Show("no-downgrade"); } } if ((subscription.planId != 4 && subscription.planId != 8) || subscription.totalUsers < 10000) { //show modify option scaffold.Show("can-modify"); } if (subscriptionAge < (5 * 24) * 60) { //TODO: Check for existing campaigns that have been ran //subscription is less than 5 days old & no campaigns have been run, //allow user to cancel subscription with a full refund scaffold.Show("is-new"); } else { if (subscription.paySchedule == Query.Models.PaySchedule.yearly) { scaffold.Show("is-old-year"); //get total months since subscription start until today var months = (int)Math.Round(((TimeSpan)(DateTime.Now - subscription.datestarted)).Days / 30.0); //calculate the end date for a yearly subscription ending //at the end of this monthly billing cycle var subscriptionEnd = subscription.datestarted.AddMonths(months + 1); subscriptionEnd = new DateTime(subscriptionEnd.Year, subscriptionEnd.Month, subscriptionEnd.Day, 0, 0, 0); //reset time to midnight scaffold.Bind(new { cancellation = new { enddate = subscriptionEnd.ToShortDateString() } }); } else { scaffold.Show("is-old-month"); } } //load payment history var paymentItem = new Scaffold("/Views/Subscription/settings/payment-item.html"); var payments = Query.Payments.GetList(User.userId); var html = new StringBuilder(); foreach (var payment in payments) { paymentItem.Bind(new { payment = new { datecreated = payment.datepaid.ToString("yyyy/MM/dd h:mm tt"), amount = payment.payment.ToString("C") } }); html.Append(paymentItem.Render()); } scaffold["payments"] = html.ToString(); //load invoices var invoiceItem = new Scaffold("/Views/Subscription/settings/invoice-item.html"); var invoices = Query.Invoices.GetList(User.userId); html = new StringBuilder(); var duedate = outstanding.duedate; if (duedate.HasValue) { duedate = (new DateTime(duedate.Value.Year, duedate.Value.Month, duedate.Value.Day)).AddDays(-3); } foreach (var invoice in invoices) { var item = new { datecreated = invoice.datedue.ToString("yyyy/MM/dd"), amount = invoice.subtotal.ToString("C"), status = outstanding.unpaidInvoiceId.HasValue ? (outstanding.unpaidInvoiceId.Value <= invoice.invoiceId ? (duedate >= DateTime.Now ? "Overdue" : "Due") : "Paid" ) : "Paid" }; invoiceItem.Bind(new { invoice = item }); if (item.status == "Due" || item.status == "Overdue") { invoiceItem.Show("important"); } html.Append(invoiceItem.Render()); } scaffold["invoices"] = html.ToString(); //load subscription changes var historyItem = new Scaffold("/Views/Subscription/settings/history-item.html"); var subscriptions = Query.Subscriptions.GetHistory(User.userId); var team = Query.Teams.GetByOwner(User.userId); var members = Query.TeamMembers.GetList(team.teamId).OrderByDescending(o => o.datecreated); html = new StringBuilder(); var items = new List <HistoryItem>(); var historyItems = new List <HistoryElement>(); //add list of members to history foreach (var member in members) { items.Add(new HistoryItem() { member = member, dateCreated = new DateTime(member.datecreated.Year, member.datecreated.Month, member.datecreated.Day), type = 0 }); } //add list of subscriptions to history foreach (var sub in subscriptions) { items.Add(new HistoryItem() { subscription = sub, dateCreated = new DateTime(sub.datestarted.Year, sub.datestarted.Month, sub.datestarted.Day), type = 1 }); } //sort history items items = items.OrderByDescending(o => o.dateCreated).ThenBy(o => o.type).ToList(); //generate subscription changes var currItem = new HistoryElement(); var currPlanId = -99; var count = 0; var actionType = ""; foreach (var item in items) { count += 1; var date = item.dateCreated.ToString("yyyy/MM/dd"); if (currItem.datecreated != date || item.type != currItem.type || item.type == 1) { if (item.type != 0 && item.subscription.planId == currPlanId) { continue; } if (item.type != 0) { currPlanId = item.subscription.planId; } if (currItem.description != null) { historyItems.Add(currItem); } if (count == items.Count) { actionType = "Started Subscription with "; } else { actionType = "Changed Subscription to "; } currItem = new HistoryElement() { datecreated = date, description = item.type == 0 ? "Added Member" : actionType + Common.Plans.NameFromId(item.subscription.planId) + " plan", members = item.type == 0 ? "1" : "", type = item.type }; } else { if (item.type == 0) { currItem.description = "Added Members"; currItem.members = (int.Parse(currItem.members) + 1).ToString(); } } } if (currItem.description != null) { historyItems.Add(currItem); } foreach (var item in historyItems) { historyItem.Bind(new { history = item }); html.Append(historyItem.Render()); } scaffold["history"] = html.ToString(); } return(scaffold.Render()); } else { return(Error("Subscription does not exist")); } }
private void Canvas_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { if (line && e.LeftButton == MouseButtonState.Pressed) { _line = new Line(); _line.Stroke = Color; _line.StrokeStartLineCap = PenLineCap.Round; _line.StrokeEndLineCap = PenLineCap.Round; _line.StrokeThickness = Thickness; _line.X1 = currentPosition.X; _line.Y1 = currentPosition.Y - 80; _line.X2 = e.GetPosition(this).X; _line.Y2 = e.GetPosition(this).Y - 80; currentPosition = e.GetPosition(this); Canvas.Children.Add(_line); HistoryElement.Add(_line); } if (rectangle && e.LeftButton == MouseButtonState.Pressed) { _rectangle.Stroke = Color; _rectangle.StrokeThickness = Thickness; if ((bool)fill) { _rectangle.Fill = Color; } Canvas.SetLeft(_rectangle, currentPosition.X); Canvas.SetTop(_rectangle, currentPosition.Y); var pos = e.GetPosition(Canvas); var x = Math.Min(pos.X, currentPosition.X); var y = Math.Min(pos.Y, currentPosition.Y); var w = Math.Max(pos.X, currentPosition.X) - x; var h = Math.Max(pos.Y, currentPosition.Y) - y; _rectangle.Width = w; _rectangle.Height = h; Canvas.SetLeft(_rectangle, x); Canvas.SetTop(_rectangle, y); } if (ellipse && e.LeftButton == MouseButtonState.Pressed) { _ellipse.Stroke = Color; _ellipse.StrokeThickness = Thickness; if ((bool)fill) { _ellipse.Fill = Color; } Canvas.SetLeft(_ellipse, currentPosition.X); Canvas.SetTop(_ellipse, currentPosition.Y); var pos = e.GetPosition(Canvas); var x = Math.Min(pos.X, currentPosition.X); var y = Math.Min(pos.Y, currentPosition.Y); var w = Math.Max(pos.X, currentPosition.X) - x; var h = Math.Max(pos.Y, currentPosition.Y) - y; _ellipse.Width = w; _ellipse.Height = h; Canvas.SetLeft(_ellipse, x); Canvas.SetTop(_ellipse, y); } if (triangle && e.LeftButton == MouseButtonState.Pressed) { _triangle.Stroke = Color; _triangle.StrokeThickness = Thickness; if ((bool)fill) { _triangle.Fill = Color; } Canvas.SetLeft(_triangle, currentPosition.X); Canvas.SetTop(_triangle, currentPosition.Y); var pos = e.GetPosition(Canvas); Point p1 = new Point(0, pos.Y - currentPosition.Y); Point p2 = new Point(pos.X - currentPosition.X, pos.Y - currentPosition.Y); Point p3 = new Point((pos.X - currentPosition.X) / 2, 0); _triangle.Points[0] = p1; _triangle.Points[1] = p2; _triangle.Points[2] = p3; Canvas.SetLeft(_triangle, currentPosition.X); Canvas.SetTop(_triangle, currentPosition.Y); } }