Ejemplo n.º 1
0
        /// <summary>
        /// Applies the rule
        /// </summary>
        public override void ApplyRule(DataRow row)
        {
            if (!row.Table.Columns.Contains(this.DestinationColumnName) || !row.Table.Columns.Contains(this.SourceColumnName))
            {
                return;
            }

            string value = string.Empty;

            if (this.FormatType != FormatTypes.EpiWeek)
            {
                value = string.Format(System.Globalization.CultureInfo.CurrentCulture, this.GetFormatString(), row[this.SourceColumnName]) + this.Suffix;
                value = value.Trim();
            }
            else
            {
                StatisticsRepository.EpiWeek epiWeek = new StatisticsRepository.EpiWeek();
                if (row[this.SourceColumnName] != null && !string.IsNullOrEmpty(row[this.SourceColumnName].ToString()))
                {
                    string   datestring = row[this.SourceColumnName].ToString();
                    DateTime?dt         = Convert.ToDateTime(datestring);
                    value = epiWeek.GetEpiWeek(dt).ToString();
                    value = value.Trim();
                }
            }

            if (string.IsNullOrEmpty(value))
            {
                row[this.DestinationColumnName] = DBNull.Value;
            }
            else
            {
                row[this.DestinationColumnName] = value;
            }
        }
Ejemplo n.º 2
0
        private void cbxFormatOptions_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxFormatOptions.SelectedIndex >= 0)
            {
                FormatTypes type = GetFormatType();

                if (type != FormatTypes.EpiWeek)
                {
                    Rule_Format tempFormatRule = new Rule_Format(dashboardHelper, "temp", "temp", "temp", "temp", type);
                    string      formatString   = tempFormatRule.GetFormatString();
                    txtPreview.Text = string.Format(System.Globalization.CultureInfo.CurrentCulture, formatString, DateTime.Now);
                }
                else
                {
                    StatisticsRepository.EpiWeek epiWeek = new StatisticsRepository.EpiWeek();
                    txtPreview.Text = epiWeek.GetEpiWeek(DateTime.Now).ToString().Trim();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Applies the rule
        /// </summary>
        public override void ApplyRule(DataRow row)
        {
            if (!row.Table.Columns.Contains(this.DestinationColumnName) || !row.Table.Columns.Contains(this.SourceColumnName))
            {
                return;
            }

            string value = string.Empty;

            if (this.FormatType != FormatTypes.EpiWeek)
            {
                value = string.Format(System.Globalization.CultureInfo.CurrentCulture, this.GetFormatString(), row[this.SourceColumnName]) + this.Suffix;
                value = value.Trim();
            }
            else
            {
                StatisticsRepository.EpiWeek epiWeek = new StatisticsRepository.EpiWeek();
                if(row[this.SourceColumnName] != null && !string.IsNullOrEmpty(row[this.SourceColumnName].ToString()))
                {
                    string datestring = row[this.SourceColumnName].ToString();
                    DateTime? dt = Convert.ToDateTime(datestring);
                    value = epiWeek.GetEpiWeek(dt).ToString();
                    value = value.Trim();
                }

            }

            if (string.IsNullOrEmpty(value))
            {
                row[this.DestinationColumnName] = DBNull.Value;
            }
            else
            {
                row[this.DestinationColumnName] = value;
            }
        }