protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (localContext == null)
            {
                throw new ArgumentNullException(nameof(localContext));
            }

            DateTime startingDate = StartingDate.Get(context);
            DateTime endingDate   = EndingDate.Get(context);
            bool     showSeconds  = ShowSeconds.Get(context);

            TimeSpan diff = startingDate - endingDate;

            StringBuilder sb = new StringBuilder();

            sb.Append($"{diff.Days}d.");

            sb.Append($"{diff.Hours:00}h:");

            sb.Append($"{diff.Minutes:00}m");

            if (showSeconds)
            {
                sb.Append($":{diff.Seconds:00}s");
            }

            Difference.Set(context, sb.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// handles the loading of the module setting for this
        /// control
        /// </summary>
        public override void LoadSettings()
        {
            try
            {
                if (!IsPostBack)
                {
                    //     DateTimeCalcSettings settingsData = new DateTimeCalcSettings(this.TabModuleId);

                    if (Template != null)
                    {
                        txtTemplate.Text = Template;
                    }

                    if (StartDate != null)
                    {
                        txtStartDate.Text = StartDate;
                    }

                    if (EndDate != null)
                    {
                        txtEndDate.Text = EndDate;
                    }

                    if (ShowYears != null)
                    {
                        if (ShowYears.ToString().Length > 0)
                        {
                            cbxShowYears.Checked = Convert.ToBoolean(ShowYears.ToString());
                        }
                    }

                    if (ShowWeeks != null)
                    {
                        if (ShowWeeks.ToString().Length > 0)
                        {
                            cbxShowWeeks.Checked = Convert.ToBoolean(ShowWeeks.ToString());
                        }
                    }

                    if (ShowMonths != null)
                    {
                        if (ShowMonths.ToString().Length > 0)
                        {
                            cbxShowMonths.Checked = Convert.ToBoolean(ShowMonths.ToString());
                        }
                    }

                    if (ShowDays != null)
                    {
                        if (ShowDays.ToString().Length > 0)
                        {
                            cbxShowDays.Checked = Convert.ToBoolean(ShowDays.ToString());
                        }
                    }

                    if (ShowHours != null)
                    {
                        if (ShowHours.ToString().Length > 0)
                        {
                            cbxShowHours.Checked = Convert.ToBoolean(ShowHours.ToString());
                        }
                    }


                    if (ShowMinutes != null)
                    {
                        if (ShowMinutes.ToString().Length > 0)
                        {
                            cbxShowMinutes.Checked = Convert.ToBoolean(ShowMinutes.ToString());
                        }
                    }

                    if (ShowSeconds != null)
                    {
                        if (ShowSeconds.ToString().Length > 0)
                        {
                            cbxShowSeconds.Checked = Convert.ToBoolean(ShowSeconds.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }