コード例 #1
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     return(TimeSpan1.GetHashCode() ^
            TimeSpan2.GetHashCode() ^
            Operation.GetHashCode() ^
            Mode.GetHashCode());
 }
コード例 #2
0
        public ActionResult FichaCadastral(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "O Id deve ser informado"));
            }
            Funcionario funcionario = db.Funcionarios.Find(id);

            funcionario.Contrato = db.Contratos.SingleOrDefault(u => u.IdFuncionario == funcionario.Id);

            funcionario.Contrato.Cargo = db.Cargos.SingleOrDefault(u => u.Id == funcionario.Contrato.IdCargo);

            DataContrato dt = new DataContrato(funcionario.Contrato);

            TPA.Services.TimeSpan2 TempoDeCasa = new TimeSpan2(dt.DataInicio, dt.DataFim);

            funcionario.Contrato.TempoDeCasa = TempoDeCasa.ToString();
            if (funcionario.DataNascimento != null)
            {
                funcionario.Idade = new TimeSpan2(DateTime.Parse(funcionario.DataNascimento), DateTime.Today).TempoDecorrido("y");
            }

            if (funcionario == null)
            {
                return(HttpNotFound());
            }
            return(View(Mapper.Map <Funcionario, FichaCadastralViewModel>(funcionario)));
        }
コード例 #3
0
        /// <summary>Initializes a new instance of the <see cref="TriggerEditDialog"/> class.</summary>
        /// <param name="trigger">The <see cref="Trigger"/> to edit.</param>
        /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param>
        /// <param name="allowedTriggers">Sets the types of triggers that can be edited. Default is all.</param>
        public TriggerEditDialog(Trigger trigger, bool supportV1Only = false, AvailableTriggers allowedTriggers = AvailableTriggers.AllTriggers)
        {
            InitializeComponent();

            showCustom = trigger != null && trigger.TriggerType == TaskTriggerType.Custom;
            isV2       = !supportV1Only;

            // Populate combo boxes
            delaySpan.Items.AddRange(new[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) });
            repeatSpan.Items.AddRange(new[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) });
            durationSpan.Items.AddRange(new[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) });
            durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely;
            stopIfRunsSpan.Items.AddRange(new[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) });
            AvailableTriggers = allowedTriggers;

            if (trigger != null)
            {
                Trigger = trigger;
            }
            else
            {
                Trigger = (AvailableTriggers & CalendarTriggerUI.calendarTriggers) != 0 ? GetFirstAvailableTrigger(CalendarTriggerUI.calendarTriggers) : GetFirstAvailableTrigger();
                initialStartBoundary = DateTime.MinValue;
            }
        }
コード例 #4
0
        /// <summary>
        /// Stretches the current time span by multiplying its length by the specified multiplier.
        /// </summary>
        /// <param name="multiplier">Multiplier to stretch the time span by.</param>
        /// <returns>Time span that is the current time span stretched by the <paramref name="multiplier"/>.</returns>
        public ITimeSpan Multiply(double multiplier)
        {
            ThrowIfArgument.IsNegative(nameof(multiplier), multiplier, "Multiplier is negative.");

            return(new MathTimeSpan(TimeSpan1.Multiply(multiplier),
                                    TimeSpan2.Multiply(multiplier),
                                    Operation,
                                    Mode));
        }
コード例 #5
0
        /// <summary>
        /// Shrinks the current time span by dividing its length by the specified divisor.
        /// </summary>
        /// <param name="divisor">Divisor to shrink the time span by.</param>
        /// <returns>Time span that is the current time span shrinked by the <paramref name="divisor"/>.</returns>
        public ITimeSpan Divide(double divisor)
        {
            ThrowIfArgument.IsNegative(nameof(divisor), divisor, "Divisor is negative.");

            return(new MathTimeSpan(TimeSpan1.Divide(divisor),
                                    TimeSpan2.Divide(divisor),
                                    Operation,
                                    Mode));
        }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskSchedulerWizard"/> class.
 /// </summary>
 public TaskSchedulerWizard()
 {
     InitializeComponent();
     wizardControl1.TitleIcon = Icon;
     AllowEditorOnFinish      = true;
     RegisterTaskOnFinish     = false;
     repeatSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) });
     durationSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) });
     durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely;
 }
コード例 #7
0
        public RuntimeOptionPanel()
        {
            InitializeComponent();
            long allVal;

            ComboBoxExtension.InitializeFromEnum(taskPriorityCombo.Items, typeof(System.Diagnostics.ProcessPriorityClass), EditorProperties.Resources.ResourceManager, "ProcessPriority", out allVal);
            taskRestartIntervalCombo.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2) });
            taskExecutionTimeLimitCombo.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) });
            taskDeleteAfterCombo.FormattedZero = EditorProperties.Resources.TimeSpanImmediately;
            taskDeleteAfterCombo.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromDays(30), TimeSpan2.FromDays(90), TimeSpan2.FromDays(180), TimeSpan2.FromDays(365) });
        }
コード例 #8
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var result = 17;
         result = result * 23 + TimeSpan1.GetHashCode();
         result = result * 23 + TimeSpan2.GetHashCode();
         result = result * 23 + Operation.GetHashCode();
         result = result * 23 + Mode.GetHashCode();
         return(result);
     }
 }
コード例 #9
0
 private void Initialize()
 {
     listView1.Items.Clear();
     foreach (var t in ts.GetRunningTasks())
     {
         TimeSpan2 dur = DateTime.Now - t.LastRunTime;
         listView1.Items.Add(new ListViewItem(new string[] { t.Name, t.LastRunTime.ToString("G"), dur.ToString("[%d_@d],[%h_@h],[%m_@m],[%s_@s]"), t.CurrentAction, t.Path })
         {
             Tag = t
         });
     }
 }
コード例 #10
0
        public StartupOptionPanel()
        {
            InitializeComponent();

            taskIdleDurationCombo.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromMinutes(60) });
            taskIdleWaitTimeoutCombo.FormattedZero = EditorProperties.Resources.TimeSpanDoNotWait;
            taskIdleWaitTimeoutCombo.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2) });

            // Load network connections
            availableConnectionsCombo.BeginUpdate();
            availableConnectionsCombo.Items.Clear();
            availableConnectionsCombo.Items.Add(EditorProperties.Resources.AnyConnection);
            availableConnectionsCombo.Items.AddRange(Microsoft.Win32.NativeMethods.NetworkProfile.GetAllLocalProfiles());
            availableConnectionsCombo.EndUpdate();
        }
コード例 #11
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (TimeSpan2.TryParse(parseText.Text, out var ts))
         {
             parseLabel.Text      = ts.ToString(formatTextBox.Text, formatInfo);
             timeSpanPicker.Value = ts;
         }
     }
     catch (Exception ex)
     {
         parseLabel.Text = ex.Message;
     }
 }
コード例 #12
0
        private void dayUpDn_ValueChanged(object sender, EventArgs e)
        {
            var ts = new TimeSpan2((int)dayUpDn.Value, (int)hrUpDn.Value, (int)minUpDn.Value,
                                   (int)secUpDn.Value, (int)msUpDn.Value);

            try
            {
                outputLabel.Text = ts.ToString(formatTextBox.Text, formatInfo);
            }
            catch (Exception ex)
            {
                outputLabel.Text = ex.Message;
            }
            button1_Click(sender, e);
        }
コード例 #13
0
 private void durationSpan_ValueChanged(object sender, EventArgs e)
 {
     if (!onAssignment)
     {
         if (durationSpan.Value < TimeSpan2.FromMinutes(1) && durationSpan.Value != TimeSpan2.Zero)
         {
             MessageBox.Show(this, EditorProperties.Resources.Error_RepetitionDurationOutOfRange, EditorProperties.Resources.TaskSchedulerName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             durationSpan.Value = TimeSpan.FromMinutes(1);
             return;
         }
         trigger.Repetition.Duration = durationSpan.Value;
         if (trigger.Repetition.Duration < trigger.Repetition.Interval && trigger.Repetition.Duration != TimeSpan.Zero)
         {
             onAssignment                = true;
             repeatSpan.Value            = trigger.Repetition.Duration - TimeSpan.FromMinutes(1);
             trigger.Repetition.Interval = repeatSpan.Value;
             onAssignment                = false;
         }
     }
 }
コード例 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TriggerEditDialog"/> class.
        /// </summary>
        /// <param name="trigger">The <see cref="Trigger"/> to edit.</param>
        /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param>
        public TriggerEditDialog(Trigger trigger, bool supportV1Only)
        {
            InitializeComponent();

            this.SupportV1Only = supportV1Only;

            // Populate combo boxes
            delaySpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) });
            repeatSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) });
            durationSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) });
            durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely;
            stopIfRunsSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) });

            if (trigger != null)
            {
                this.Trigger = trigger;
            }
            else
            {
                this.Trigger = new TimeTrigger();
            }
        }
コード例 #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TriggerEditDialog"/> class.
        /// </summary>
        /// <param name="trigger">The <see cref="Trigger"/> to edit.</param>
        /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param>
        public TriggerEditDialog(Trigger trigger, bool supportV1Only)
        {
            InitializeComponent();

            showCustom    = trigger != null && (trigger.TriggerType == TaskTriggerType.Custom);
            SupportV1Only = supportV1Only;

            // Populate combo boxes
            delaySpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) });
            repeatSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) });
            durationSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) });
            durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely;
            stopIfRunsSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) });

            if (trigger != null)
            {
                Trigger = trigger;
            }
            else
            {
                Trigger = new TimeTrigger();
                initialStartBoundary = DateTime.MinValue;
            }
        }
コード例 #16
0
 internal void ResetValue()
 {
     Value = TimeSpan2.Zero;
 }
コード例 #17
0
 public static TimeSpan Parse(string value, string formattedZero)
 {
     System.Globalization.TimeSpan2FormatInfo fi = System.Globalization.TimeSpan2FormatInfo.CurrentInfo;
     fi.TimeSpanZeroDisplay = formattedZero;
     return(TimeSpan2.Parse(value, fi));
 }
コード例 #18
0
 /// <summary>
 /// Clones the current time span.
 /// </summary>
 /// <returns>Copy of the current time span.</returns>
 public ITimeSpan Clone()
 {
     return(new MathTimeSpan(TimeSpan1.Clone(), TimeSpan2.Clone(), Operation, Mode));
 }