Esempio n. 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on postbacks
            if (this.IsPostBack)
            {
                return;
            }

            // create page links
            // board index first
            this.PageLinks.AddRoot();

            // administration index second
            this.PageLinks.AddLink(
                this.GetText("ADMIN_ADMIN", "Administration"), YafBuildLink.GetLink(ForumPages.admin_admin));

            this.PageLinks.AddLink(this.GetText("ADMIN_SPAMLOG", "TITLE"), string.Empty);

            this.Page.Header.Title = this.GetText("ADMIN_SPAMLOG", "TITLE");

            this.PagerTop.PageSize = 25;

            var ci = this.Get <ILocalization>().Culture;

            if (this.Get <YafBoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.Get <YafBoardSettings>().EventLogMaxDays).ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
                this.ToDate.Text = DateTime.UtcNow.Date.ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
            }

            this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            // bind data to controls
            this.BindData();
        }
Esempio n. 2
0
        /// <summary>
        /// Formats a datatime value into 07.03.2003 00:00:00 except if
        ///   the date is yesterday or today -- in which case it says that.
        /// </summary>
        /// <param name="dateTime">
        /// The date Time.
        /// </param>
        /// <returns>
        /// Formatted string of DateTime object
        /// </returns>
        public string FormatDateTimeTopic([NotNull] DateTime dateTime)
        {
            dateTime = this.AccountForDST(dateTime + this.TimeOffset);
            DateTime nowDateTime = this.AccountForDST(DateTime.UtcNow + this.TimeOffset);

            string strDateFormat;

            try
            {
                if (dateTime.Date == nowDateTime.Date)
                {
                    // today
                    strDateFormat =
                        YafContext.Current.Get <ILocalization>().FormatString(
                            YafContext.Current.Get <ILocalization>().GetText("TodayAt"), dateTime);
                }
                else if (dateTime.Date == nowDateTime.AddDays(-1).Date)
                {
                    // yesterday
                    strDateFormat =
                        YafContext.Current.Get <ILocalization>().FormatString(
                            YafContext.Current.Get <ILocalization>().GetText("YesterdayAt"), dateTime);
                }
                else
                {
                    strDateFormat =
                        YafContext.Current.Get <ILocalization>().FormatDateTime(
                            YafContext.Current.Get <ILocalization>().GetText("FORMAT_DATE_TIME_SHORT"), dateTime);
                }
            }
            catch (Exception)
            {
                strDateFormat = dateTime.ToString("G");
            }

            return(YafContext.Current.Get <YafBoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("G")
                       : YafContext.Current.IsGuest
                             ? "{0}{1}".FormatWith(strDateFormat, this.timeZoneName)
                             : strDateFormat);
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on post-backs
            if (this.IsPostBack)
            {
                return;
            }

            this.Types.Items.Add(new ListItem(this.GetText("ALL"), "-1"));

            foreach (int eventTypeId in Enum.GetValues(typeof(EventLogTypes)))
            {
                var eventTypeName = this.Get <ILocalization>().GetText(
                    "ADMIN_EVENTLOGROUPACCESS",
                    $"LT_{Enum.GetName(typeof(EventLogTypes), eventTypeId)?.ToUpperInvariant()}");

                this.Types.Items.Add(
                    new ListItem(eventTypeName, eventTypeId.ToString()));
            }

            var ci = this.Get <ILocalization>().Culture;

            if (this.Get <BoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.Get <BoardSettings>().EventLogMaxDays).ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
                this.ToDate.Text = DateTime.UtcNow.Date.ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
            }

            this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            // bind data to controls
            this.BindData();
        }
Esempio n. 4
0
        /// <summary>
        /// Formats a DateTime value into 07.03.2003
        /// </summary>
        /// <param name="dateTime">
        /// The date Time.
        /// </param>
        /// <returns>
        /// Short formatted date.
        /// </returns>
        public string FormatDateShort([NotNull] DateTime dateTime)
        {
            string dateFormat;

            dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, YafContext.Current.TimeZoneInfoUser);

            try
            {
                dateFormat =
                    YafContext.Current.Get <ILocalization>()
                    .FormatDateTime(YafContext.Current.Get <ILocalization>().GetText("FORMAT_DATE_SHORT"), dateTime);
            }
            catch (Exception)
            {
                dateFormat = dateTime.ToString("d");
            }

            return(YafContext.Current.Get <YafBoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("d")
                       : YafContext.Current.IsGuest
                             ? "{0}{1}".FormatWith(dateFormat, this.timeZoneName)
                             : dateFormat);
        }
Esempio n. 5
0
        public ActionResult SaveComments(string sdate, string edate)
        {
            //string sdate = "1397/03/06";
            //string edate = "1397/04/06";
            PersianDate ssdate = PersianDate.Parse(Convert.ToDateTime(sdate).ToString("yyyy/MM/dd HH:mm:ss"));
            DateTime    Sdate  = PersianDateConverter.ToGregorianDateTime(ssdate);
            PersianDate eedate = PersianDate.Parse(Convert.ToDateTime(edate).ToString("yyyy/MM/dd HH:mm:ss"));
            DateTime    Edate  = PersianDateConverter.ToGregorianDateTime(eedate);



            //PersianDate pd= PersianDateConverter.ToPersianDate(dt);

            var select = db.users.Where(q => q.birth >= Sdate && q.birth <= Edate).ToList();

            //foreach(var item in select)
            //{

            //    //dt.Add(Convert.ToDateTime(item));
            //}

            return(Content(""));
        }
Esempio n. 6
0
        /// <summary>
        /// Formats a DateTime value into 7. february 2003
        /// </summary>
        /// <param name="dateTime">
        /// The date to be formatted
        /// </param>
        /// <returns>
        /// The format date long.
        /// </returns>
        public string FormatDateLong(DateTime dateTime)
        {
            string dateFormat;

            dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, YafContext.Current.TimeZoneInfoUser);

            try
            {
                dateFormat =
                    YafContext.Current.Get <ILocalization>()
                    .FormatDateTime(YafContext.Current.Get <ILocalization>().GetText("FORMAT_DATE_LONG"), dateTime);
            }
            catch (Exception)
            {
                dateFormat = dateTime.ToString("D");
            }

            return(YafContext.Current.Get <YafBoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("D")
                       : YafContext.Current.IsGuest
                             ? $"{dateFormat}{this.timeZoneName}"
                             : dateFormat);
        }
Esempio n. 7
0
        /// <summary>
        /// Formats a DateTime value into 7. february 2003
        /// </summary>
        /// <param name="dateTime">
        /// The date to be formatted
        /// </param>
        /// <returns>
        /// The format date long.
        /// </returns>
        public string FormatDateLong(DateTime dateTime)
        {
            string dateFormat;

            dateTime = this.AccountForDST(dateTime + this.TimeOffset, YafContext.Current.DSTUser);

            try
            {
                dateFormat =
                    YafContext.Current.Get <ILocalization>()
                    .FormatDateTime(YafContext.Current.Get <ILocalization>().GetText("FORMAT_DATE_LONG"), dateTime);
            }
            catch (Exception)
            {
                dateFormat = dateTime.ToString("D");
            }

            return(YafContext.Current.Get <YafBoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("D")
                       : YafContext.Current.IsGuest
                             ? "{0}{1}".FormatWith(dateFormat, this.timeZoneName)
                             : dateFormat);
        }
Esempio n. 8
0
        /// <summary>
        /// This formats a DateTime into a short string
        /// </summary>
        /// <param name="dateTime">
        /// The date Time.
        /// </param>
        /// <returns>
        /// The formatted string created from the DateTime object.
        /// </returns>
        public string FormatDateTimeShort([NotNull] DateTime dateTime)
        {
            string strDateFormat;

            dateTime = this.AccountForDST(dateTime + this.TimeOffset);

            try
            {
                strDateFormat =
                    YafContext.Current.Get <ILocalization>().FormatDateTime(
                        YafContext.Current.Get <ILocalization>().GetText("FORMAT_DATE_TIME_SHORT"), dateTime);
            }
            catch (Exception)
            {
                strDateFormat = dateTime.ToString("G");
            }

            return(YafContext.Current.Get <YafBoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("G")
                       : YafContext.Current.IsGuest
                             ? "{0}{1}".FormatWith(strDateFormat, this.timeZoneName)
                             : strDateFormat);
        }
Esempio n. 9
0
        /// <summary>
        /// Formats a DateTime value into 22:32:34
        /// </summary>
        /// <param name="dateTime">
        /// The date to be formatted
        /// </param>
        /// <returns>
        /// The format time.
        /// </returns>
        public string FormatTime(System.DateTime dateTime)
        {
            string dateFormat;

            dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, BoardContext.Current.TimeZoneInfoUser);

            try
            {
                dateFormat =
                    BoardContext.Current.Get <ILocalization>()
                    .FormatDateTime(BoardContext.Current.Get <ILocalization>().GetText("FORMAT_TIME"), dateTime);
            }
            catch (Exception)
            {
                dateFormat = dateTime.ToString("T");
            }

            return(BoardContext.Current.Get <BoardSettings>().UseFarsiCalender
                       ? PersianDateConverter.ToPersianDate(dateTime).ToString("T")
                       : BoardContext.Current.IsGuest
                             ? $"{dateFormat}{this.timeZoneName}"
                             : dateFormat);
        }
Esempio n. 10
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on post-backs
            if (this.IsPostBack)
            {
                return;
            }

            var allItem = new ListItem(this.GetText("ALL"), "-1");

            allItem.Attributes.Add(
                "data-content",
                $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-filter fa-fw text-secondary\"></i>&nbsp;{this.GetText("ALL")}</span>");

            this.Types.Items.Add(allItem);

            EnumExtensions.GetAllItems <EventLogTypes>().ForEach(
                type =>
            {
                var icon = type switch
                {
                    EventLogTypes.Error => "radiation",
                    EventLogTypes.Warning => "exclamation-triangle",
                    EventLogTypes.Information => "exclamation",
                    EventLogTypes.Debug => "exclamation-triangle",
                    EventLogTypes.Trace => "exclamation-triangle",
                    EventLogTypes.SqlError => "exclamation-triangle",
                    EventLogTypes.UserSuspended => "user-clock",
                    EventLogTypes.UserUnsuspended => "user-check",
                    EventLogTypes.UserDeleted => "user-alt-slash",
                    EventLogTypes.IpBanSet => "hand-paper",
                    EventLogTypes.IpBanLifted => "slash",
                    EventLogTypes.IpBanDetected => "hand-paper",
                    EventLogTypes.SpamBotReported => "user-ninja",
                    EventLogTypes.SpamBotDetected => "user-lock",
                    EventLogTypes.SpamMessageReported => "flag",
                    EventLogTypes.SpamMessageDetected => "shield-alt",
                    _ => "exclamation-circle"
                };

                var item = new ListItem {
                    Value = type.ToInt().ToString(), Text = type.ToString()
                };

                item.Attributes.Add(
                    "data-content",
                    $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-{icon} fa-fw text-secondary\"></i>&nbsp;{type}</span>");

                this.Types.Items.Add(item);
            });

            var ci = this.Get <ILocalization>().Culture;

            if (this.Get <BoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.Get <BoardSettings>().EventLogMaxDays).ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
                this.ToDate.Text = DateTime.UtcNow.Date.ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
            }

            this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            // bind data to controls
            this.BindData();
        }
Esempio n. 11
0
        /// <summary>
        /// Update user Profile Info.
        /// </summary>
        private void UpdateUserProfile()
        {
            var userProfile = new ProfileInfo
            {
                Country = this.Country.SelectedItem != null?this.Country.SelectedItem.Value.Trim() : string.Empty,
                              Region =
                                  this.Region.SelectedItem != null && this.Country.SelectedItem != null &&
                                  this.Country.SelectedItem.Value.Trim().IsSet()
                        ? this.Region.SelectedItem.Value.Trim()
                        : string.Empty,
                              City       = this.City.Text.Trim(),
                              Location   = this.Location.Text.Trim(),
                              Homepage   = this.HomePage.Text.Trim(),
                              ICQ        = this.ICQ.Text.Trim(),
                              Facebook   = this.Facebook.Text.Trim(),
                              Twitter    = this.Twitter.Text.Trim(),
                              XMPP       = this.Xmpp.Text.Trim(),
                              Skype      = this.Skype.Text.Trim(),
                              RealName   = this.Realname.Text.Trim(),
                              Occupation = this.Occupation.Text.Trim(),
                              Interests  = this.Interests.Text.Trim(),
                              Gender     = this.Gender.SelectedIndex,
                              Blog       = this.Weblog.Text.Trim()
            };

            DateTime userBirthdate;

            if (this.Get <BoardSettings>().UseFarsiCalender&& this.CurrentCultureInfo.IsFarsiCulture())
            {
                try
                {
                    var persianDate = new PersianDate(this.Birthday.Text);

                    userBirthdate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                catch (Exception)
                {
                    userBirthdate = DateTimeHelper.SqlDbMinTime().Date;
                }

                if (userBirthdate >= DateTimeHelper.SqlDbMinTime().Date)
                {
                    userProfile.Birthday = userBirthdate.Date;
                }
            }
            else
            {
                DateTime.TryParse(this.Birthday.Text, this.CurrentCultureInfo, DateTimeStyles.None, out userBirthdate);

                if (userBirthdate >= DateTimeHelper.SqlDbMinTime().Date)
                {
                    // Attention! This is stored in profile in the user timezone date
                    userProfile.Birthday = userBirthdate.Date;
                }
            }

            this.User.Item2.Profile_Birthday          = userProfile.Birthday;
            this.User.Item2.Profile_Blog              = userProfile.Blog;
            this.User.Item2.Profile_Gender            = userProfile.Gender;
            this.User.Item2.Profile_GoogleId          = userProfile.GoogleId;
            this.User.Item2.Profile_GitHubId          = userProfile.GitHubId;
            this.User.Item2.Profile_Homepage          = userProfile.Homepage;
            this.User.Item2.Profile_ICQ               = userProfile.ICQ;
            this.User.Item2.Profile_Facebook          = userProfile.Facebook;
            this.User.Item2.Profile_FacebookId        = userProfile.FacebookId;
            this.User.Item2.Profile_Twitter           = userProfile.Twitter;
            this.User.Item2.Profile_TwitterId         = userProfile.TwitterId;
            this.User.Item2.Profile_Interests         = userProfile.Interests;
            this.User.Item2.Profile_Location          = userProfile.Location;
            this.User.Item2.Profile_Country           = userProfile.Country;
            this.User.Item2.Profile_Region            = userProfile.Region;
            this.User.Item2.Profile_City              = userProfile.City;
            this.User.Item2.Profile_Occupation        = userProfile.Occupation;
            this.User.Item2.Profile_RealName          = userProfile.RealName;
            this.User.Item2.Profile_Skype             = userProfile.Skype;
            this.User.Item2.Profile_XMPP              = userProfile.XMPP;
            this.User.Item2.Profile_LastSyncedWithDNN = userProfile.LastSyncedWithDNN;

            this.Get <IAspNetUsersHelper>().Update(this.User.Item2);
        }
Esempio n. 12
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.Country.DataSource     = StaticDataHelper.Country();
            this.Country.DataValueField = "Value";
            this.Country.DataTextField  = "Name";

            if (this.User.Item2.Profile_Country.IsSet())
            {
                this.LookForNewRegionsBind(this.User.Item2.Profile_Country);
            }

            this.DataBind();

            if (this.Get <BoardSettings>().UseFarsiCalender&& this.CurrentCultureInfo.IsFarsiCulture())
            {
                this.Birthday.Text =
                    this.User.Item2.Profile_Birthday > DateTimeHelper.SqlDbMinTime() ||
                    this.User.Item2.Profile_Birthday.IsNullOrEmptyDBField()
                        ? PersianDateConverter.ToPersianDate(this.User.Item2.Profile_Birthday).ToString("d")
                        : PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
            }
            else
            {
                this.Birthday.Text =
                    this.User.Item2.Profile_Birthday > DateTimeHelper.SqlDbMinTime() ||
                    this.User.Item2.Profile_Birthday.IsNullOrEmptyDBField()
                        ? this.User.Item2.Profile_Birthday.Date.ToString(
                        this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern,
                        CultureInfo.InvariantCulture)
                        : DateTimeHelper.SqlDbMinTime().Date.ToString(
                        this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern,
                        CultureInfo.InvariantCulture);
            }

            this.Birthday.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            this.DisplayName.Text = this.User.Item1.DisplayName;
            this.City.Text        = this.User.Item2.Profile_City;
            this.Location.Text    = this.User.Item2.Profile_Location;
            this.HomePage.Text    = this.User.Item2.Profile_Homepage;
            this.Realname.Text    = this.User.Item2.Profile_RealName;
            this.Occupation.Text  = this.User.Item2.Profile_Occupation;
            this.Interests.Text   = this.User.Item2.Profile_Interests;
            this.Weblog.Text      = this.User.Item2.Profile_Blog;
            this.ICQ.Text         = this.User.Item2.Profile_ICQ;

            this.Facebook.Text = ValidationHelper.IsNumeric(this.User.Item2.Profile_Facebook)
                ? $"https://www.facebook.com/profile.php?id={this.User.Item2.Profile_Facebook}"
                : this.User.Item2.Profile_Facebook;

            this.Twitter.Text         = this.User.Item2.Profile_Twitter;
            this.Xmpp.Text            = this.User.Item2.Profile_XMPP;
            this.Skype.Text           = this.User.Item2.Profile_Skype;
            this.Gender.SelectedIndex = this.User.Item2.Profile_Gender;

            if (this.User.Item2.Profile_Country.IsSet())
            {
                var countryItem = this.Country.Items.FindByValue(this.User.Item2.Profile_Country.Trim());
                if (countryItem != null)
                {
                    countryItem.Selected = true;
                }
            }

            if (this.User.Item2.Profile_Region.IsSet())
            {
                var regionItem = this.Region.Items.FindByValue(this.User.Item2.Profile_Region.Trim());
                if (regionItem != null)
                {
                    regionItem.Selected = true;
                }
            }

            if (!this.ProfileDefinitions.Any())
            {
                return;
            }

            this.CustomProfile.DataSource = this.ProfileDefinitions;
            this.CustomProfile.DataBind();
            this.CustomProfile.Visible = true;
        }
Esempio n. 13
0
        /// <summary>
        /// The update user profile.
        /// </summary>
        /// <param name="userName">
        /// The user name.
        /// </param>
        private void UpdateUserProfile([NotNull] string userName)
        {
            YafUserProfile userProfile = YafUserProfile.GetProfile(userName);

            userProfile.Country = this.Country.SelectedItem != null
                                      ? this.Country.SelectedItem.Value.Trim()
                                      : string.Empty;

            userProfile.Region = this.Region.SelectedItem != null && this.Country.SelectedItem != null &&
                                 this.Country.SelectedItem.Value.Trim().IsSet()
                                     ? this.Region.SelectedItem.Value.Trim()
                                     : string.Empty;
            userProfile.City       = this.City.Text.Trim();
            userProfile.Location   = this.Location.Text.Trim();
            userProfile.Homepage   = this.HomePage.Text.Trim();
            userProfile.MSN        = this.MSN.Text.Trim();
            userProfile.YIM        = this.YIM.Text.Trim();
            userProfile.AIM        = this.AIM.Text.Trim();
            userProfile.ICQ        = this.ICQ.Text.Trim();
            userProfile.Facebook   = this.Facebook.Text.Trim();
            userProfile.Twitter    = this.Twitter.Text.Trim();
            userProfile.Google     = this.Google.Text.Trim();
            userProfile.XMPP       = this.Xmpp.Text.Trim();
            userProfile.Skype      = this.Skype.Text.Trim();
            userProfile.RealName   = this.Realname.Text.Trim();
            userProfile.Occupation = this.Occupation.Text.Trim();
            userProfile.Interests  = this.Interests.Text.Trim();
            userProfile.Gender     = this.Gender.SelectedIndex;
            userProfile.Blog       = this.Weblog.Text.Trim();

            DateTime userBirthdate;

            if (this.Get <YafBoardSettings>().UseFarsiCalender&& this.CurrentCultureInfo.IsFarsiCulture())
            {
                var persianDate = new PersianDate(this.Birthday.Text);
                userBirthdate = PersianDateConverter.ToGregorianDateTime(persianDate);

                if (userBirthdate > DateTime.MinValue.Date)
                {
                    userProfile.Birthday = userBirthdate.Date;
                }
            }
            else
            {
                DateTime.TryParse(this.Birthday.Text, this.CurrentCultureInfo, DateTimeStyles.None, out userBirthdate);

                if (userBirthdate > DateTime.MinValue.Date)
                {
                    // Attention! This is stored in profile in the user timezone date
                    userProfile.Birthday = userBirthdate.Date;
                }
            }

            userProfile.BlogServiceUrl      = this.WeblogUrl.Text.Trim();
            userProfile.BlogServiceUsername = this.WeblogUsername.Text.Trim();
            userProfile.BlogServicePassword = this.WeblogID.Text.Trim();

            try
            {
                // Sync to User Profile Mirror table while it's dirty
                SettingsPropertyValueCollection settingsPropertyValueCollection = userProfile.PropertyValues;

                LegacyDb.SetPropertyValues(
                    PageContext.PageBoardID,
                    UserMembershipHelper.ApplicationName(),
                    this.currentUserID,
                    settingsPropertyValueCollection);
            }
            catch (Exception ex)
            {
                this.Logger.Log(
                    "Error while syncinng the User Profile",
                    EventLogTypes.Error,
                    this.PageContext.PageUserName,
                    "Edit User Profile page",
                    ex);
            }

            userProfile.Save();
        }
Esempio n. 14
0
        /// <summary>
        /// The bind data.
        /// </summary>
        private void BindData()
        {
            this.TimeZones.DataSource = StaticDataHelper.TimeZones();
            if (this.Get <YafBoardSettings>().AllowUserTheme)
            {
                this.Theme.DataSource     = StaticDataHelper.Themes();
                this.Theme.DataTextField  = "Theme";
                this.Theme.DataValueField = "FileName";
            }

            if (this.Get <YafBoardSettings>().AllowUserLanguage)
            {
                this.Culture.DataSource     = StaticDataHelper.Cultures();
                this.Culture.DataValueField = "CultureTag";
                this.Culture.DataTextField  = "CultureNativeName";
            }

            this.Country.DataSource     = StaticDataHelper.Country();
            this.Country.DataValueField = "Value";
            this.Country.DataTextField  = "Name";

            if (this.UserData.Profile.Country.IsSet())
            {
                this.LookForNewRegionsBind(this.UserData.Profile.Country);
            }

            if (this.Get <YafBoardSettings>().AllowUsersTextEditor)
            {
                this.ForumEditor.DataSource     = this.Get <IModuleManager <ForumEditor> >().ActiveAsDataTable("Editors");
                this.ForumEditor.DataValueField = "Value";
                this.ForumEditor.DataTextField  = "Name";
            }

            this.DataBind();

            if (this.Get <YafBoardSettings>().UseFarsiCalender&& this.CurrentCultureInfo.IsFarsiCulture())
            {
                this.Birthday.Text = this.UserData.Profile.Birthday > DateTimeHelper.SqlDbMinTime() ||
                                     this.UserData.Profile.Birthday.IsNullOrEmptyDBField()
                                         ? PersianDateConverter.ToPersianDate(this.UserData.Profile.Birthday)
                                     .ToString("d")
                                         : PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
            }
            else
            {
                this.Birthday.Text = this.UserData.Profile.Birthday > DateTimeHelper.SqlDbMinTime() ||
                                     this.UserData.Profile.Birthday.IsNullOrEmptyDBField()
                                         ? this.UserData.Profile.Birthday.Date.ToString(
                    this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern,
                    CultureInfo.InvariantCulture)
                                         : DateTimeHelper.SqlDbMinTime()
                                     .Date.ToString(
                    this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern,
                    CultureInfo.InvariantCulture);
            }

            this.Birthday.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            this.DisplayName.Text    = this.UserData.DisplayName;
            this.City.Text           = this.UserData.Profile.City;
            this.Location.Text       = this.UserData.Profile.Location;
            this.HomePage.Text       = this.UserData.Profile.Homepage;
            this.Email.Text          = this.UserData.Email;
            this.Realname.Text       = this.UserData.Profile.RealName;
            this.Occupation.Text     = this.UserData.Profile.Occupation;
            this.Interests.Text      = this.UserData.Profile.Interests;
            this.Weblog.Text         = this.UserData.Profile.Blog;
            this.WeblogUrl.Text      = this.UserData.Profile.BlogServiceUrl;
            this.WeblogID.Text       = this.UserData.Profile.BlogServicePassword;
            this.WeblogUsername.Text = this.UserData.Profile.BlogServiceUsername;
            this.MSN.Text            = this.UserData.Profile.MSN;
            this.YIM.Text            = this.UserData.Profile.YIM;
            this.AIM.Text            = this.UserData.Profile.AIM;
            this.ICQ.Text            = this.UserData.Profile.ICQ;

            this.Facebook.Text = ValidationHelper.IsNumeric(this.UserData.Profile.Facebook)
                                     ? "https://www.facebook.com/profile.php?id={0}".FormatWith(
                this.UserData.Profile.Facebook)
                                     : this.UserData.Profile.Facebook;

            this.Twitter.Text         = this.UserData.Profile.Twitter;
            this.Google.Text          = this.UserData.Profile.Google;
            this.Xmpp.Text            = this.UserData.Profile.XMPP;
            this.Skype.Text           = this.UserData.Profile.Skype;
            this.Gender.SelectedIndex = this.UserData.Profile.Gender;

            if (this.UserData.Profile.Country.IsSet())
            {
                ListItem countryItem = this.Country.Items.FindByValue(this.UserData.Profile.Country.Trim());
                if (countryItem != null)
                {
                    countryItem.Selected = true;
                }
            }

            if (this.UserData.Profile.Region.IsSet())
            {
                ListItem regionItem = this.Region.Items.FindByValue(this.UserData.Profile.Region.Trim());
                if (regionItem != null)
                {
                    regionItem.Selected = true;
                }
            }

            ListItem timeZoneItem = this.TimeZones.Items.FindByValue(this.UserData.TimeZone.ToString());

            if (timeZoneItem != null)
            {
                timeZoneItem.Selected = true;
            }

            this.DSTUser.Checked = this.UserData.DSTUser;
            this.HideMe.Checked  = this.UserData.IsActiveExcluded &&
                                   (this.Get <YafBoardSettings>().AllowUserHideHimself || this.PageContext.IsAdmin);

            if (this.Get <YafBoardSettings>().MobileTheme.IsSet() &&
                UserAgentHelper.IsMobileDevice(HttpContext.Current.Request.UserAgent) ||
                HttpContext.Current.Request.Browser.IsMobileDevice)
            {
                this.UseMobileThemeRow.Visible = true;
                this.UseMobileTheme.Checked    = this.UserData.UseMobileTheme;
            }

            if (this.Get <YafBoardSettings>().AllowUserTheme&& this.Theme.Items.Count > 0)
            {
                // Allows to use different per-forum themes,
                // While "Allow User Change Theme" option in hostsettings is true
                string themeFile = this.Get <YafBoardSettings>().Theme;

                if (this.UserData.ThemeFile.IsSet())
                {
                    themeFile = this.UserData.ThemeFile;
                }

                ListItem themeItem = this.Theme.Items.FindByValue(themeFile);
                if (themeItem != null)
                {
                    themeItem.Selected = true;
                }
            }

            if (this.Get <YafBoardSettings>().AllowUsersTextEditor&& this.ForumEditor.Items.Count > 0)
            {
                // Text editor
                string textEditor = this.UserData.TextEditor.IsSet()
                                        ? this.UserData.TextEditor
                                        : this.Get <YafBoardSettings>().ForumEditor;

                ListItem editorItem = this.ForumEditor.Items.FindByValue(textEditor);
                if (editorItem != null)
                {
                    editorItem.Selected = true;
                }
            }

            if (!this.Get <YafBoardSettings>().AllowUserLanguage || this.Culture.Items.Count <= 0)
            {
                return;
            }

            // If 2-letter language code is the same we return Culture, else we return a default full culture from language file
            ListItem foundCultItem = this.Culture.Items.FindByValue(this.GetCulture(true));

            if (foundCultItem != null)
            {
                foundCultItem.Selected = true;
            }

            if (!Page.IsPostBack)
            {
                this.Realname.Focus();
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Populates data source and binds data to controls.
        /// </summary>
        private void BindData()
        {
            var baseSize         = this.PageSize.SelectedValue.ToType <int>();
            var currentPageIndex = this.PagerTop.CurrentPageIndex;

            this.PagerTop.PageSize = baseSize;

            var sinceDate = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays);
            var toDate    = DateTime.UtcNow;

            var ci = this.Get <ILocalization>().Culture;

            if (this.SinceDate.Text.IsSet())
            {
                if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.SinceDate.Text.PersianNumberToEnglish());

                    sinceDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.SinceDate.Text, ci, DateTimeStyles.None, out sinceDate);
                }
            }

            if (this.ToDate.Text.IsSet())
            {
                if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.ToDate.Text.PersianNumberToEnglish());

                    toDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.ToDate.Text, ci, DateTimeStyles.None, out toDate);
                }
            }

            // list event for this board
            var list = this.GetRepository <Types.Models.EventLog>()
                       .ListPaged(
                this.PageContext.PageBoardID,
                this.PageContext.BoardSettings.EventLogMaxMessages,
                this.PageContext.BoardSettings.EventLogMaxDays,
                currentPageIndex,
                baseSize,
                sinceDate,
                toDate.AddDays(1).AddMinutes(-1),
                null,
                true);

            this.List.DataSource = list;

            this.PagerTop.Count = list != null && list.Any()
                                      ? list.FirstOrDefault().TotalRows
                                      : 0;

            // bind data to controls
            this.DataBind();

            if (this.List.Items.Count == 0)
            {
                this.NoInfo.Visible = true;
            }
        }
Esempio n. 16
0
 public static DateTime ToGeorgianDate(this PersianDate value)
 {
     return(PersianDateConverter.ToGregorianDateTime(value));
 }
Esempio n. 17
0
 public static PersianDate ToPersianDate(this DateTime value)
 {
     return(PersianDateConverter.ToPersianDate(value));
 }
Esempio n. 18
0
 public static string ToPersianDateString(this DateTime value, bool toWritten = true)
 {
     return(toWritten ? PersianDateConverter.ToPersianDate(value).ToWritten() : PersianDateConverter.ToPersianDate(value).ToString());
 }
Esempio n. 19
0
        private static void getDateRangeCompositeFilterConditionForGreaterThanOrEqual(FilterDescriptor fItem, string filterVal)
        {
            var dateTimeValue = PersianDateConverter.ToGregorianDateTime(filterVal.Split(Convert.ToChar(_filterSeperator))[0] + " 00:00 Þ.Ù");

            fItem.Value = dateTimeValue;
        }
Esempio n. 20
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.UnverifiedUsersHolder.Visible = !Config.IsDotNetNuke;

            if (this.UnverifiedUsersHolder.Visible)
            {
                var unverifiedUsers = this.GetRepository <User>().UnApprovedUsers(this.PageContext.PageBoardID);

                if (unverifiedUsers.Any())
                {
                    this.PageContext.PageElements.RegisterJsBlock(
                        "UnverifiedUserstablesorterLoadJs",
                        JavaScriptBlocks.LoadTableSorter(
                            "#UnverifiedUsers",
                            "headers: { 4: { sorter: false }},sortList: [[3,1],[0,0]]",
                            "#UnverifiedUsersPager"));
                }

                // bind list
                this.UserList.DataSource = unverifiedUsers;
                this.UserList.DataBind();
            }

            // get stats for current board, selected board or all boards (see function)
            var row = this.GetRepository <Board>().Stats(this.GetSelectedBoardId());

            this.NumPosts.Text  = $"{row["NumPosts"]:N0}";
            this.NumTopics.Text = $"{row["NumTopics"]:N0}";
            this.NumUsers.Text  = $"{row["NumUsers"]:N0}";

            var    span = System.DateTime.UtcNow - (System.DateTime)row["BoardStart"];
            double days = span.Days;

            this.BoardStart.Text = this.Get <IDateTime>().FormatDateTimeTopic(
                this.Get <BoardSettings>().UseFarsiCalender
                    ? PersianDateConverter.ToPersianDate((System.DateTime)row["BoardStart"])
                    : row["BoardStart"]);

            this.BoardStartAgo.Text = new DisplayDateTime
            {
                DateTime = (System.DateTime)row["BoardStart"], Format = DateTimeFormat.BothTopic
            }.RenderToString();

            if (days < 1)
            {
                days = 1;
            }

            this.DayPosts.Text  = $"{row["NumPosts"].ToType<int>() / days:N2}";
            this.DayTopics.Text = $"{row["NumTopics"].ToType<int>() / days:N2}";
            this.DayUsers.Text  = $"{row["NumUsers"].ToType<int>() / days:N2}";

            try
            {
                this.DBSize.Text = $"{this.Get<IDbFunction>().GetDBSize()} MB";
            }
            catch (SqlException)
            {
                this.DBSize.Text = this.GetText("ADMIN_ADMIN", "ERROR_DATABASESIZE");
            }

            this.BindActiveUserData();

            this.DataBind();
        }
Esempio n. 21
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.UnverifiedUsersHolder.Visible = !Config.IsDotNetNuke;

            if (this.UnverifiedUsersHolder.Visible)
            {
                var unverifiedUsers = this.GetRepository <User>().ListAsDataTable(this.PageContext.PageBoardID, null, false);

                if (unverifiedUsers.HasRows())
                {
                    YafContext.Current.PageElements.RegisterJsBlock(
                        "UnverifiedUserstablesorterLoadJs",
                        JavaScriptBlocks.LoadTableSorter(
                            "#UnverifiedUsers",
                            "headers: { 4: { sorter: false }},sortList: [[3,1],[0,0]]",
                            "#UnverifiedUsersPager"));
                }

                // bind list
                this.UserList.DataSource = unverifiedUsers;
                this.UserList.DataBind();
            }

            // get stats for current board, selected board or all boards (see function)
            var row = this.GetRepository <Board>().Stats(this.GetSelectedBoardId());

            this.NumPosts.Text  = "{0:N0}".FormatWith(row["NumPosts"]);
            this.NumTopics.Text = "{0:N0}".FormatWith(row["NumTopics"]);
            this.NumUsers.Text  = "{0:N0}".FormatWith(row["NumUsers"]);

            var    span = DateTime.UtcNow - (DateTime)row["BoardStart"];
            double days = span.Days;

            this.BoardStart.Text =
                this.GetText("ADMIN_ADMIN", "DAYS_AGO").FormatWith(
                    this.Get <YafBoardSettings>().UseFarsiCalender
                        ? PersianDateConverter.ToPersianDate((DateTime)row["BoardStart"])
                        : row["BoardStart"],
                    days);

            if (days < 1)
            {
                days = 1;
            }

            this.DayPosts.Text  = "{0:N2}".FormatWith(row["NumPosts"].ToType <int>() / days);
            this.DayTopics.Text = "{0:N2}".FormatWith(row["NumTopics"].ToType <int>() / days);
            this.DayUsers.Text  = "{0:N2}".FormatWith(row["NumUsers"].ToType <int>() / days);

            try
            {
                this.DBSize.Text = "{0} MB".FormatWith(this.Get <IDbFunction>().GetDBSize());
            }
            catch (SqlException)
            {
                this.DBSize.Text = this.GetText("ADMIN_ADMIN", "ERROR_DATABASESIZE");
            }

            this.BindActiveUserData();

            this.DataBind();
        }
Esempio n. 22
0
        /// <summary>
        /// Populates data source and binds data to controls.
        /// </summary>
        private void BindData()
        {
            int baseSize          = this.Get <YafBoardSettings>().MemberListPageSize;
            int nCurrentPageIndex = this.PagerTop.CurrentPageIndex;

            this.PagerTop.PageSize = baseSize;

            var sinceDate = DateTime.UtcNow.AddDays(-this.Get <YafBoardSettings>().EventLogMaxDays);
            var toDate    = DateTime.UtcNow;

            var ci = this.Get <ILocalization>().Culture;

            if (this.SinceDate.Text.IsSet())
            {
                if (this.Get <YafBoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.SinceDate.Text);

                    sinceDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.SinceDate.Text, ci, DateTimeStyles.None, out sinceDate);
                }
            }

            if (this.ToDate.Text.IsSet())
            {
                if (this.Get <YafBoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.ToDate.Text);

                    toDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.ToDate.Text, ci, DateTimeStyles.None, out toDate);
                }
            }

            // list event for this board
            DataTable dt = this.GetRepository <EventLog>()
                           .List(
                this.PageContext.PageUserID,
                this.Get <YafBoardSettings>().EventLogMaxMessages,
                this.Get <YafBoardSettings>().EventLogMaxDays,
                nCurrentPageIndex,
                baseSize,
                sinceDate,
                toDate.AddDays(1).AddMinutes(-1),
                this.Types.SelectedValue.Equals("-1") ? null : this.Types.SelectedValue);

            this.List.DataSource = dt;

            this.PagerTop.Count = dt != null && dt.HasRows()
                                      ? dt.AsEnumerable().First().Field <int>("TotalRows")
                                      : 0;

            // bind data to controls
            this.DataBind();
        }
Esempio n. 23
0
File: Bank.cs Progetto: iranEdu/irQm
      public void search()
      {
          if (toDate != null)
          {
              toDate.Value.AddHours(-1 * toDate.Value.Hour).AddHours(24);
          }
          System.Diagnostics.Debug.WriteLine(PersianDateConverter.ToMiladi(fdpTo.SelectedDateTime).Year);

          using (var db = new irQmDbContext())
          {
              IQuestion[]     questions = null;
              FlowLayoutPanel target    = null;

              switch (tabControl1.SelectedIndex)
              {
              case 0:


                  questions = db.MultiChoicesQuestions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                             tags.All(tg => db.TagInMultichoices.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Options).Include(q => q.Tags).ToArray();
                  target = flpMultiOptionsQuestions;
                  break;

              case 1:

                  questions = db.TFQuestions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                   tags.All(tg => db.TagInTfQuestion.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Tags).ToArray();
                  target = flpTFQuestions;
                  break;

              case 2:

                  questions = db.PuzzleQuestions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                       tags.All(tg => db.TagInPuzzle.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Pairs).Include(q => q.Tags).ToArray();
                  target = flpPuzzleQuestions;
                  break;

              case 3:

                  questions = db.ShortAnswerQustions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                           tags.All(tg => db.TagInShortAnswer.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Answer).Include(q => q.Tags).ToArray();
                  target = flpShortQuestions;
                  break;

              case 4:

                  questions = db.LongAnswerQuestions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                           tags.All(tg => db.TagInLongAnswer.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Tags).ToArray();
                  target = flpLongQuestions;
                  break;

              case 5:

                  questions = db.PracticalQuestions.Where(q => (string.IsNullOrWhiteSpace(lessonName) ? true : q.LessonName == lessonName) && (fromDate != null ? q.RegisterTime >= fromDate : true) && (toDate != null ? q.RegisterTime <= toDate : true) &&
                                                          tags.All(tg => db.TagInPractical.Any(t => t.QuestionId == q.Id && t.Tag.Value == tg)) && richContains(q.Face, searchExpr)).Include(q => q.Tags).Include(q => q.CheckList).ToArray();
                  target = flpPracticalQuestions;
                  break;

              case 6:
                  return;
              }


              int i = 1;
              target.Controls.Clear();
              foreach (var q in questions.OrderBy(q => q.Face))
              {
                  var qitem = new UCQuestionListItem(q, q.RegisterTime.ToLocalTime().ToPrettyTime(), i);
                  qitem.Width          = multiTabPage.Width - 50;
                  qitem.RightToLeft    = RightToLeft.Yes;
                  qitem.Anchor         = AnchorStyles.Right | AnchorStyles.Left;
                  qitem.Resize        += (s, ev) => { qitem.MaximumSize = new Size(Width - 50, 0); };
                  qitem.Removed       += Qitem_Removed;
                  qitem.CheckedChange += Qitem_CheckedChange;
                  qitem.Name           = q.Id;
                  if (selectedQuestions.Contains(q))
                  {
                      qitem.Checked = true;
                  }
                  target.Controls.Add(qitem);
                  qitem.QuestionEdited += Qitem_QuestionEdited;
                  list.Add(qitem);
                  i++;
              }
          }
      }
Esempio n. 24
0
        /// <summary>
        /// Populates data source and binds data to controls.
        /// </summary>
        private void BindData()
        {
            var baseSize         = this.Get <BoardSettings>().MemberListPageSize;
            var currentPageIndex = this.PagerTop.CurrentPageIndex;

            this.PagerTop.PageSize = baseSize;

            var sinceDate = DateTime.UtcNow.AddDays(-this.Get <BoardSettings>().EventLogMaxDays);
            var toDate    = DateTime.UtcNow;

            var ci = this.Get <ILocalization>().Culture;

            if (this.SinceDate.Text.IsSet())
            {
                if (this.Get <BoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.SinceDate.Text);

                    sinceDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.SinceDate.Text, ci, DateTimeStyles.None, out sinceDate);
                }
            }

            if (this.ToDate.Text.IsSet())
            {
                if (this.Get <BoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
                {
                    var persianDate = new PersianDate(this.ToDate.Text);

                    toDate = PersianDateConverter.ToGregorianDateTime(persianDate);
                }
                else
                {
                    DateTime.TryParse(this.ToDate.Text, ci, DateTimeStyles.None, out toDate);
                }
            }

            // list event for this board
            var dt = this.GetRepository <Types.Models.EventLog>()
                     .List(
                this.PageContext.PageUserID,
                this.Get <BoardSettings>().EventLogMaxMessages,
                this.Get <BoardSettings>().EventLogMaxDays,
                currentPageIndex,
                baseSize,
                sinceDate,
                toDate.AddDays(1).AddMinutes(-1),
                "1003,1004,1005,2000,2001,2002,2003");

            this.List.DataSource = dt;

            this.PagerTop.Count = dt != null && dt.HasRows()
                                      ? dt.AsEnumerable().First().Field <int>("TotalRows")
                                      : 0;

            // bind data to controls
            this.DataBind();

            if (this.List.Items.Count == 0)
            {
                this.NoInfo.Visible = true;
            }
        }
Esempio n. 25
0
 /// <summary>
 /// Converts the PersianDate to a DateTime equivalant.
 /// </summary>
 /// <param name="persianDate"></param>
 /// <returns></returns>
 public static DateTime ToDateTime(this PersianDate persianDate)
 {
     return(PersianDateConverter.ToGregorianDateTime(persianDate));
 }