示例#1
0
        /// <summary>
        /// Loads existing record and shows view form, with cancel button
        /// GET: /Admin/Competition/View/5
        /// </summary>
        public ActionResult Export(int id)
        {
            Breadcrumbs.Current.AddBreadcrumb(3, "Export Competition");
            var record  = Models.Competition.LoadID(id);
            var entries = record.CompetitionEntries;

            Beweb.Export.ExportToExcel(entries, "Competition " + id + " entries " + Fmt.Date(DateTime.Today) + ".xls");
            return(null);
        }
示例#2
0
            public string FormatNewsDate(Object date, bool isShort)
            {
                string result = "";

                string[] longdate;
                if (isShort)
                {
                    longdate = Fmt.Date(date.ToString()).Split('-');
                }
                else
                {
                    longdate = Fmt.LongDate(date).Split('-');
                }
                string day   = longdate[0];
                string month = longdate[1];
                string year  = longdate[2];

                if (day.StartsWith("0"))
                {
                    day = day.Remove(0, 1);
                }
                int intDay = day.ToInt();

                if (intDay < 11 || intDay > 13)
                {
                    if (day.EndsWith("1"))
                    {
                        day += "st";
                    }
                    else if (day.EndsWith("2"))
                    {
                        day += "nd";
                    }
                    else if (day.EndsWith("3"))
                    {
                        day += "rd";
                    }
                    else
                    {
                        day += "th";
                    }
                }
                else
                {
                    day += "th";
                }
                result = month + " " + day + ", " + year;
                return(result);
            }
示例#3
0
文件: Dates.cs 项目: cmcd74/SavvyCMS
        public void GetNextTest()
        {
            DateTime date     = new DateTime(2014, 08, 2);             // 2 aug 2014
            string   actual   = Fmt.Date(date.Next(DayOfWeek.Monday)); //get the next monday
            string   expected = Fmt.Date(new DateTime(2014, 08, 4));   //4th is a monday

            Web.WriteLine("");
            Assert.AreEqual(expected, actual);
            Web.WriteLine("Value is: " + actual);

            //rollover date
            date   = new DateTime(2014, 08, 30);               // 2 aug 2014
            actual = Fmt.Date(date.Next(DayOfWeek.Wednesday)); //get the next monday should rollover into next month

            expected = Fmt.Date(new DateTime(2014, 09, 3));    //3rd is a wednesday in sept
            Web.WriteLine("");
            Assert.AreEqual(expected, actual);
            Web.WriteLine("Value is: " + actual);
        }