aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.JobRunsStartTimePatch/JobRunsStartTimePatch.cs
blob: eb5aef8ef06d18515105a3b6a8e6e78d6e6baaf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tango.BL;
using Tango.Core;
using Tango.PPC.Common.UpdatePackages;
using Tango.PPC.Shared.Updates;

namespace Tango.PPC.Packages.JobRunsStartTimePatch
{
    [PPCPackage(PackageType.Pre, "JobRuns StartTime Patch", false)]
    public class JobRunsStartTimePatch : ExtendedObject, IPPCPackage
    {
        public Task Run(PackageContext context)
        {
            return Task.Factory.StartNew(() =>
            {
                try
                {
                    LogManager.Log("Fixing corrupted job runs start time values...");

                    context.ReportProgress("Applying corrupted job runs start date patch...");

                    Thread.Sleep(5000); //Just so we can see something happened.

                    using (ObservablesContext db = ObservablesContext.CreateDefault())
                    {
                        db.Database.ExecuteSqlCommand("UPDATE JOB_RUNS SET START_DATE = ACTUAL_START_DATE WHERE START_DATE = '0001-01-01 00:00:00.000';");
                    }
                }
                catch (Exception ex)
                {
                    LogManager.Log(ex, "Error occurred while trying to apply job runs start date patch.");
                }
            });
        }
    }
}
class="w"> (String)GetValue(WatermarkProperty); } set { SetValue(WatermarkProperty, value); } } public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(String), typeof(TouchComboBox), new PropertyMetadata(null)); public object SelectedItem { get { return (object)GetValue(SelectedItemProperty); } set { SetValue(SelectedItemProperty, value); } } public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(TouchComboBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); public IList ItemsSource { get { return (IList)GetValue(ItemsSourceProperty); } set { SetValue(ItemsSourceProperty, value); } } public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IList), typeof(TouchComboBox), new PropertyMetadata(null)); public DataTemplate ItemTemplate { get { return (DataTemplate)GetValue(ItemTemplateProperty); } set { SetValue(ItemTemplateProperty, value); } } public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(TouchComboBox), new PropertyMetadata(null)); public DataTemplate SelectedItemTemplate { get { return (DataTemplate)GetValue(SelectedItemTemplateProperty); } set { SetValue(SelectedItemTemplateProperty, value); } } public static readonly DependencyProperty SelectedItemTemplateProperty = DependencyProperty.Register("SelectedItemTemplate", typeof(DataTemplate), typeof(TouchComboBox), new PropertyMetadata(null)); public String Title { get { return (String)GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(String), typeof(TouchComboBox), new PropertyMetadata(null)); public double MinPopupWidth { get { return (double)GetValue(MinPopupWidthProperty); } set { SetValue(MinPopupWidthProperty, value); } } public static readonly DependencyProperty MinPopupWidthProperty = DependencyProperty.Register("MinPopupWidth", typeof(double), typeof(TouchComboBox), new PropertyMetadata(300.0)); public double MinPopupHeight { get { return (double)GetValue(MinPopupHeightProperty); } set { SetValue(MinPopupHeightProperty, value); } } public static readonly DependencyProperty MinPopupHeightProperty = DependencyProperty.Register("MinPopupHeight", typeof(double), typeof(TouchComboBox), new PropertyMetadata(200.0)); public String DisplayMemberPath { get { return (String)GetValue(DisplayMemberPathProperty); } set { SetValue(DisplayMemberPathProperty, value); } } public static readonly DependencyProperty DisplayMemberPathProperty = DependencyProperty.Register("DisplayMemberPath", typeof(String), typeof(TouchComboBox), new PropertyMetadata(null)); public TouchComboBox() { this.RegisterForPreviewMouseOrTouchDown(OnMouseDown); this.RegisterForPreviewMouseOrTouchUp(OnMouseUp); } private void OnMouseUp(object sender, MouseOrTouchEventArgs e) { ShowSelectionOnTouchPanel(); } private void OnMouseDown(object sender, MouseOrTouchEventArgs e) { System.Windows.Input.Keyboard.Focus(this); } private void ShowSelectionOnTouchPanel() { TouchPanel touchPanel = this.FindAncestor<TouchPanel>(); if (touchPanel != null) { touchPanel.CurrentComboBox = this; } } internal void SetResultFromTouchPanel(Object selectedObject) { SelectedItem = selectedObject; } } }