コード例 #1
0
 /// <summary>
 /// Load change log from a data row.
 /// </summary>
 /// <param name="dr">Data row containing the data to load.</param>
 /// <remarks></remarks>
 public ChangeLog(DataRow dr)
 {
     this.OwnerID   = HString.SafeTrim(dr["owner_id"]);
     this.OwnerName = HString.SafeTrim(dr["owner_name"]);
     this.Type      = HString.SafeTrim(dr["log_type"]);
     this.Timestamp = HDateTime.GetDateTime(dr["timestamp"]);
 }
コード例 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            // Get the month the page should display.
            DateTime displayMonth = HDateTime.GetDateTime(HNumeric.GetSafeInteger(this.ddlYear.SelectedValue), HNumeric.GetSafeInteger(this.ddlMonth.SelectedValue), 1);

            // Set UI to indicate what month is being displayed.
            this.SetControls(displayMonth);

            // Output html to page.
            this.LoadCalendar(displayMonth);
        }
コード例 #3
0
        /// <summary>
        /// Determine what month to create xml data for based on prev/next postback.
        /// </summary>
        /// <returns>The month to be displayed on the page.</returns>
        private DateTime SetCurrentMonth()
        {
            DateTime dt = DateTime.Now;

            if (Request.Form["__EVENTTARGET"] == "prev" || Request.Form["__EVENTTARGET"] == "next")
            {
                // Set postback value.
                dt = HDateTime.GetDateTime(Request.Form["__EVENTARGUMENT"]);

                // Set UI to indicate what month is being displayed.
                this.SetControls(dt);
            }

            return(dt);
        }
コード例 #4
0
        /// <summary>
        /// Get any differences between the old and new property values.
        /// </summary>
        /// <param name="prevValue">Prevous property value.</param>
        /// <param name="newValue">New property value.</param>
        /// <param name="ObjectState">The state of the object.</param>
        /// <param name="ObjectType">The type of the object.</param>
        /// <param name="propertyInfo">The property being evaluated.</param>
        /// <returns></returns>
        private ChangeLogItem GetChangeLogItem(Object prevValue, Object newValue, ObjectState ObjectState, Type ObjectType, PropertyInfo propertyInfo)
        {
            ChangeLogItem lItem = new ChangeLogItem();

            lItem.OwnerID      = this.OwnerID;
            lItem.OwnerName    = ObjectType.Name;
            lItem.PropertyName = propertyInfo.Name;
            lItem.Type         = ObjectState.ToString().Replace("ToBe", String.Empty); // Get rid of future tense from state name.

            if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(String)))
            {
                // COMPARE STRINGS

                String logPrevious = HString.SafeTrim(prevValue);
                String logNew      = HString.SafeTrim(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious;
                    lItem.NewValue      = logNew;
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(Int32)))
            {
                // COMPARE INTEGERS

                Int32 logPrevious = HNumeric.GetSafeInteger(prevValue);
                Int32 logNew      = HNumeric.GetSafeInteger(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(Decimal)))
            {
                // COMPARE DECIMALS

                Decimal logPrevious = HNumeric.GetSafeDecimal(prevValue);
                Decimal logNew      = HNumeric.GetSafeDecimal(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (Object.ReferenceEquals(propertyInfo.PropertyType, typeof(DateTime)))
            {
                // COMPARE DATETIMES

                DateTime logPrevious = HDateTime.GetDateTime(prevValue);
                DateTime logNew      = HDateTime.GetDateTime(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }
            else if (propertyInfo.PropertyType.IsEnum)
            {
                // COMPARE ENUMS

                Int32 logPrevious = Convert.ToInt32(prevValue);
                Int32 logNew      = Convert.ToInt32(newValue);

                if (!logNew.Equals(logPrevious))
                {
                    lItem.PreviousValue = logPrevious.ToString();
                    lItem.NewValue      = logNew.ToString();
                    return(lItem);
                }
            }

            return(null);
        }