public string showToday() { date = DateTime.Now; loadCurrentMonth(); return(DateAndTime.MonthName(date.Month) + " " + date.Year); }
public void MonthName() { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; try { System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Assert.Throws <ArgumentException>(() => DateAndTime.MonthName(0, Abbreviate: false)); Assert.Throws <ArgumentException>(() => DateAndTime.MonthName(0, Abbreviate: true)); Assert.Equal("January", DateAndTime.MonthName(1, Abbreviate: false)); Assert.Equal("Jan", DateAndTime.MonthName(1, Abbreviate: true)); Assert.Equal("December", DateAndTime.MonthName(12, Abbreviate: false)); Assert.Equal("Dec", DateAndTime.MonthName(12, Abbreviate: true)); Assert.Throws <ArgumentException>(() => DateAndTime.MonthName(int.MaxValue, Abbreviate: false)); Assert.Throws <ArgumentException>(() => DateAndTime.MonthName(int.MaxValue, Abbreviate: true)); } finally { System.Threading.Thread.CurrentThread.CurrentCulture = culture; } }
public string changeDate(DateTime _date) { date = _date; loadCurrentMonth(); return(DateAndTime.MonthName(date.Month) + " " + date.Year); }
public static object MonthName(object month, object abbreviate) { #if !NETSTANDARD return(DateAndTime.MonthName(Convert.ToInt32(month), Convert.ToBoolean(abbreviate))); #else if (Convert.ToBoolean(abbreviate)) { return(DateTimeFormatInfo.GetInstance(null).GetAbbreviatedMonthName(Convert.ToInt32(month))); } else { return(DateTimeFormatInfo.GetInstance(null).GetMonthName(Convert.ToInt32(month))); } #endif }
public void GetThisParksCampgrounds(string parkName) //and write them to the screen { List <Campground> campgroundList = new List <Campground>(); Console.Clear(); Console.WriteLine("Park Campgrounds"); Console.WriteLine(allParks[parkIndex].Name + " National Park Campgrounds\n"); Console.WriteLine("".PadRight(5) + "Name".PadRight(35) + "Open".PadRight(12) + "Close".PadRight(12) + "Daily Fee"); CampgroundDAL campDAL = new CampgroundDAL(connectionString); campgroundList = campDAL.GetThisParksCampgrounds(parkName); for (int i = 0; i < campgroundList.Count; i++) { Console.WriteLine("#" + (i + 1) + ")".PadRight(5) + campgroundList[i].Name.PadRight(35) + DateAndTime.MonthName(campgroundList[i].OpenFrom).PadRight(12) + DateAndTime.MonthName(campgroundList[i].OpenTo).PadRight(12) + (campgroundList[i].DailyFee / 100).ToString("C2")); } }
private List <string> LoadMonths() { List <string> months = new List <string>(); int currentSelectedYear = (int)comboStatementYears.SelectedItem; if (currentSelectedYear == currentAccount.OpenDate.Year && currentSelectedYear == DateTime.Now.Year) { months.Clear(); // select months only from month of opeing and today's(or closing date) month for (int i = currentAccount.OpenDate.Month; i <= finishDate.Month; i++) { months.Add(DateAndTime.MonthName(i)); } } else if (currentSelectedYear == finishDate.Year) { months.Clear(); // need to select from january to current month (or to month of closing account) for (int i = 1; i <= finishDate.Month; i++) { months.Add(DateAndTime.MonthName(i)); } } else if (currentSelectedYear == currentAccount.OpenDate.Year) { months.Clear(); // only from date when person open acct to december for (int i = currentAccount.OpenDate.Month; i <= 12; i++) { months.Add(DateAndTime.MonthName(i)); } } else { months.Clear(); for (int i = 1; i <= 12; i++) { // select all months months.Add(DateAndTime.MonthName(i)); } } return(months); }
public string showNextMonth() { int year = date.Year; int month = date.Month; if (date.Month == 12) { year++; month = 1; } else { month++; } date = new DateTime(year, month, 1); loadCurrentMonth(); return(DateAndTime.MonthName(date.Month) + " " + date.Year); }
public string showPreviousMonth() { int year = date.Year; int month = date.Month; if (date.Month == 1) { year--; month = 12; } else { month--; } date = new DateTime(year, month, 1); loadCurrentMonth(); return(DateAndTime.MonthName(date.Month) + " " + date.Year); }
/// <summary> /// Writes this Polyline to the specified DUCT picture file. /// The file is always written in MM, as that is the unit of measure of the Polyline. /// </summary> /// <param name="file">DUCT file to be written.</param> public void WriteToDUCTPictureFile(File file) { try { // Delete the file if it already exists file.Delete(); StringBuilder pictureData = new StringBuilder(); // Write header string dateTimeString = null; var _with1 = DateAndTime.Now; dateTimeString = _with1.Day + " " + DateAndTime.MonthName(_with1.Month, true).ToUpper() + " " + _with1.Year + " " + _with1.Hour + "." + _with1.Minute + "." + _with1.Second; pictureData.Append(" DuctPicture PICTURE FILE " + file.Name + " " + dateTimeString + Constants.vbNewLine); // Write part line string unitsString = ""; unitsString = "MM"; pictureData.Append(" PART: PowerMILL MADE IN " + unitsString + Constants.vbNewLine); // Write special marker pictureData.Append(" *" + Constants.vbNewLine); // Write integer data string integerLine = ""; if (Count > 1000000) { integerLine += " " + GetField(4, 3) + GetField(3, 3) + GetField(-1, 11) + GetField(1, 11) + GetField(Count, 11) + GetField(-2, 6) + GetField(2, 6) + GetField(0, 6) + GetField(0, 6) + GetField(0, 6); } else { integerLine += " " + GetField(4, 6) + GetField(3, 6) + GetField(-1, 6) + GetField(1, 6) + GetField(Count, 6) + GetField(-2, 6) + GetField(2, 6) + GetField(0, 6) + GetField(0, 6) + GetField(0, 6); } pictureData.Append(integerLine + Constants.vbNewLine); // Write size data string sizeLine = ""; sizeLine += " " + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10); pictureData.Append(sizeLine + Constants.vbNewLine); // Write instruction codes int instructionCode = GetInstructionCode(1, 0, 0, 0, 0, 0); string instructionCodeString = ""; if (Count > 1000000) { instructionCodeString = " " + GetField(instructionCode, 11) + " " + GetField(Count, 11) + Constants.vbNewLine; pictureData.Append(instructionCodeString); } else { instructionCodeString = " " + GetField(instructionCode, 11) + " " + GetField(Count, 6) + Constants.vbNewLine; pictureData.Append(instructionCodeString); } // Write polyline data string pointCode = null; for (int p = 0; p <= Count - 1; p++) { //Use System.Globalization.CultureInfo.InvariantCulture pointCode = string.Format(CultureInfo.InvariantCulture, " {0,14:E} {1,14:E} {2,14:E}", this[p].X, this[p].Y, this[p].Z); pictureData.Append(pointCode + Constants.vbNewLine); } // If it is closed the write the first point again if (_isClosed & (Count > 0)) { pointCode = string.Format(CultureInfo.InvariantCulture, " {0,14:E} {1,14:E} {2,14:E}", this[0].X, this[0].Y, this[0].Z); pictureData.Append(pointCode + Constants.vbNewLine); } // Write the file file.WriteText(pictureData.ToString(), false, Encoding.ASCII); } catch (Exception ex) { file.Delete(); throw; } }
private void printBirthdayDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Font reportFont = new System.Drawing.Font("Times New Roman", 24, FontStyle.Bold); Font reportFontSmall = new System.Drawing.Font("Times New Roman", 14); Font reportFontSmallBold = new System.Drawing.Font("Times New Roman", 14, FontStyle.Bold); Font reportFontSmallBoldTitles = new System.Drawing.Font("Times New Roman", 16, FontStyle.Bold); Graphics g = e.Graphics; int pageHeight = e.MarginBounds.Height; g.DrawString("Upcoming Birthdays", reportFont, Brushes.Black, 280, 80, StringFormat.GenericTypographic); string nowDate = null; string weekDate = null; // Also duplicated in the service layer!!!! if ((System.DateTime.Now.Month == 12 & System.DateTime.Now.Day >= 8 & System.DateTime.Now.Day <= 14)) { nowDate = System.DateTime.Now.AddDays(9).ToString(ModuleGeneric.DATE_FORMAT); weekDate = DateTime.Now.AddDays(29).ToString(ModuleGeneric.DATE_FORMAT); } else if ((System.DateTime.Now.Month == 12 & System.DateTime.Now.Day >= 15 & System.DateTime.Now.Day <= 25)) { nowDate = System.DateTime.Now.AddDays(23).ToString(ModuleGeneric.DATE_FORMAT); weekDate = DateTime.Now.AddDays(29).ToString(ModuleGeneric.DATE_FORMAT); } else { nowDate = System.DateTime.Now.AddDays(9).ToString(ModuleGeneric.DATE_FORMAT); weekDate = DateTime.Now.AddDays(15).ToString(ModuleGeneric.DATE_FORMAT); } g.DrawString("Producers list of birthdays from " + nowDate + " to " + weekDate + ".", reportFontSmall, Brushes.Black, 100, 140); g.DrawString("NAME", reportFontSmallBoldTitles, Brushes.Black, 100, 200); g.DrawString("BIRTHDAY", reportFontSmallBoldTitles, Brushes.Black, 440, 200); g.DrawString("DAY", reportFontSmallBoldTitles, Brushes.Black, 650, 200); if (theListeners.Count > 10) { e.HasMorePages = true; } currentPageNumber = currentPageNumber + 1; int min = Math.Min(theListeners.Count, 10); min = min - 1; for (int value = 0; value <= min; value++) { Listener theListener = theListeners[0]; g.DrawString(theListener.Title + " " + theListener.Forename + " " + theListener.Surname, reportFontSmallBold, Brushes.Black, 100, 240 + (70 * value)); string niceFormatBirthday = "N/a"; string niceFormatDays = "N/a"; if (theListener.Birthday.HasValue) { // Format nicely. int monthInt = theListener.Birthday.Value.Month; int dayInt = theListener.Birthday.Value.Day; niceFormatBirthday = dayInt + " " + DateAndTime.MonthName(monthInt); // Get the day of the week the birthday has this year not the year of birth. DateTime time = new DateTime(DateTime.Now.Year, monthInt, dayInt); niceFormatDays = time.ToString("dddd"); } g.DrawString(niceFormatBirthday, reportFontSmallBold, Brushes.Black, 460, 240 + (70 * value)); g.DrawString(niceFormatDays, reportFontSmallBold, Brushes.Black, 650, 240 + (70 * value)); string commaString = ", "; if (string.IsNullOrEmpty(theListener.Town)) { commaString = ""; } g.DrawString(" of " + theListener.Town + commaString + theListener.County, reportFontSmall, Brushes.Black, 100, 240 + (70 * value) + 25); theListeners.RemoveAt(0); } g.DrawString("Number of Birthdays: " + totalCount, reportFontSmallBold, Brushes.Black, 100, 950); g.DrawString("Printed on " + System.DateTime.Now.ToString(ModuleGeneric.DATE_FORMAT), reportFontSmallBold, Brushes.Black, 550, 950); g.DrawString("Page " + currentPageNumber + "/" + totalPages, reportFontSmallBold, Brushes.Black, 380, 970); // VB is stupid.... have to reset this so its back when you actually print it! if (!(e.HasMorePages)) { SetInitial(); } }
private void initControls() { currentDateTextBox.Text = DateAndTime.MonthName(now.Month) + " " + now.Year; }
public static string MonthName(int Month, bool Abbreviate) { return(DateAndTime.MonthName(Month, Abbreviate)); }
/// <summary> /// Returns a String value containing the name of the specified month. /// </summary> /// <param name="dateTime"></param> /// <returns></returns> public static string MonthName(DateTime dateTime, bool abbriviate) { return(DateAndTime.MonthName(dateTime.Month, abbriviate)); }
/// <summary> /// Creates a DUCTPicture file at the specified path and using the specified units. /// </summary> /// <param name="file">Path to file.</param> /// <param name="enmUnits">Units to use.</param> public void WriteDUCTPictureFile(FileSystem.File file, LengthUnits enmUnits) { try { //Delete the file if it already exists file.Delete(); StringBuilder strPictureData = new StringBuilder(); //Write header string strShortFileName = file.Name; string strDateTime = null; var _with1 = DateAndTime.Now; strDateTime = _with1.Day + " " + DateAndTime.MonthName(_with1.Month, true).ToUpper() + " " + _with1.Year + " " + _with1.Hour + "." + _with1.Minute + "." + _with1.Second; strPictureData.Append(" DuctPicture PICTURE FILE " + strShortFileName + " " + strDateTime + Constants.vbNewLine); //Write part line string strUnits = ""; switch (enmUnits) { case LengthUnits.MM: strUnits = "MM"; break; case LengthUnits.Inches: strUnits = "INCHES"; break; } strPictureData.Append(" PART: PowerMILL MADE IN " + strUnits + Constants.vbNewLine); //Write special marker strPictureData.Append(" *" + Constants.vbNewLine); //Write integer data string strIntLine = ""; if (Count > 1000000) { strIntLine += " " + GetField(4, 3) + GetField(3, 3) + GetField(-1, 11) + GetField(1, 11) + GetField(Count, 11) + GetField(-2, 6) + GetField(2, 6) + GetField(0, 6) + GetField(0, 6) + GetField(0, 6); } else { strIntLine += " " + GetField(4, 6) + GetField(3, 6) + GetField(-1, 6) + GetField(1, 6) + GetField(Count, 6) + GetField(-2, 6) + GetField(2, 6) + GetField(0, 6) + GetField(0, 6) + GetField(0, 6); } strPictureData.Append(strIntLine + Constants.vbNewLine); //Write size data string strSizeLine = ""; strSizeLine += " " + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10) + GetField(0, "0.0000", 10); strPictureData.Append(strSizeLine + Constants.vbNewLine); //Write instruction codes int intInstructionCode = GetInstructionCode(1, 0, 0, 0, 0, 0); string strInstructionCode = ""; if (Count > 1000000) { strInstructionCode = " " + GetField(intInstructionCode, 11) + " " + GetField(Count, 11) + Constants.vbNewLine; strPictureData.Append(strInstructionCode); } else { strInstructionCode = " " + GetField(intInstructionCode, 11) + " " + GetField(Count, 6) + Constants.vbNewLine; strPictureData.Append(strInstructionCode); } //Write polyline data string strPointCode = null; for (int p = 0; p <= Count - 1; p++) { //Use System.Globalization.CultureInfo.InvariantCulture strPointCode = string.Format(System.Globalization.CultureInfo.InvariantCulture, " {0,14:E} {1,14:E} {2,14:E}", this[p].X, this[p].Y, this[p].Z); strPictureData.Append(strPointCode + Constants.vbNewLine); } //Write the file file.WriteText(strPictureData.ToString(), false, Encoding.ASCII); } catch (Exception ex) { file.Delete(); throw; } }
public static string GetMonthName(int number) { return(number > 0 ? DateAndTime.MonthName(number) : ""); }
static bool insertIntoAttendance(String currId, String currName) { SqlConnection con2 = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Pbs\\source\\repos\\CorporateCoders\\CorporateCoders\\Database1.mdf;Integrated Security=True"); //SqlConnection con2 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Pbs\source\repos\TaskSchedulerDemo\TaskSchedulerDemo\Database1.mdf;Integrated Security=True"); con2.Open(); String query = "select Id from [Attendance] where DayOfMonth=@date and Month = @month and Year = @year"; SqlCommand cmd = new SqlCommand(query, con2); cmd.Parameters.AddWithValue("@date", DateTime.Now.Day); cmd.Parameters.AddWithValue("@month", DateAndTime.MonthName(DateTime.Now.Month)); cmd.Parameters.AddWithValue("@year", DateTime.Now.Year); SqlDataReader dr = cmd.ExecuteReader(); bool found = false; if (dr.HasRows) { while (dr.Read()) { if (dr["Id"].ToString().Trim().Equals(currId) == true) { found = true; break; } } } if (found == true) { con2.Close(); dr.Close(); return(false); } con2.Close(); dr.Close(); SqlConnection con3 = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\Pbs\\source\\repos\\CorporateCoders\\CorporateCoders\\Database1.mdf;Integrated Security=True"); // SqlConnection con3 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Pbs\source\repos\TaskSchedulerDemo\TaskSchedulerDemo\Database1.mdf;Integrated Security=True"); con3.Open(); String query2 = "insert into [Attendance] (Id, Name, DayOfMonth, Month, Year, VerTime, Status) values(@id, @name, @date, @month, @year, @time, @status)"; SqlCommand cmd2 = new SqlCommand(query2, con3); cmd2.Parameters.AddWithValue("@id", currId); cmd2.Parameters.AddWithValue("@name", currName); cmd2.Parameters.AddWithValue("@date", DateTime.Now.Day); cmd2.Parameters.AddWithValue("@month", DateAndTime.MonthName(DateTime.Now.Month)); cmd2.Parameters.AddWithValue("@year", DateTime.Now.Year); cmd2.Parameters.AddWithValue("@time", "NA"); cmd2.Parameters.AddWithValue("@status", "Absent"); if (cmd2.ExecuteNonQuery() > 0) { con2.Close(); return(true); } con2.Close(); return(false); }
public static string GetMonthName(this int MonthNumber) { return(DateAndTime.MonthName(MonthNumber, false)); } // end GetMonthName
public string BuildHTML(bool bGenCmts = true) { string sOutput = ""; int cDay; int cMonth; int cYear; sOutput = "<div class=\"sauce\">"; if (Strings.Trim(this.Title) != "") { sOutput += "<div class=\"saucetitle\"><span class=\"saucelabel\">Title:</span><span class=\"saucedata\">" + Strings.Trim(this.Title) + "</span></div>"; } if (Strings.Trim(this.Author) != "") { sOutput += "<div class=\"sauceauthor\"><span class=\"saucelabel\">Author:</span><span class=\"saucedata\">" + Strings.Trim(this.Author) + "</span></div>"; } if (Strings.Trim(this.Group) != "") { sOutput += "<div class=\"saucegroup\"><span class=\"saucelabel\">Group:</span><span class=\"saucedata\">" + Strings.Trim(this.Group) + "</span></div>"; } if (this.DataType != 0) { sOutput += "<div class=\"saucedatatype\"><span class=\"saucelabel\">Data Type:</span><span class=\"saucedata\">" + Strings.Trim(this.DataTypeName) + " (" + this.DataType + ")</span></div>"; } if (this.FileType != 0) { sOutput += "<div class=\"saucefiletype\"><span class=\"saucelabel\">File Type:</span><span class=\"saucedata\">" + Strings.Trim(this.FileTypeName) + " (" + this.FileType + ")</span></div>"; //me.FileTypeName } if (Strings.Trim(this.CreatedDate) != "" & IsNumeric(this.CreatedDate)) { cYear = System.Convert.ToInt32(Left(CreatedDate, 4)); cMonth = System.Convert.ToInt32(Mid(CreatedDate, 5, 2)); cDay = System.Convert.ToInt32(Right(CreatedDate, 2)); sOutput += "<div class=\"saucecreatedate\"><span class=\"saucelabel\">Creation Date:</span><span class=\"saucedata\">" + cDay.ToString() + "." + DateAndTime.MonthName(cMonth) + " " + cYear.ToString() + "</span></div>"; } if ((this.DataType == 1 & this.FileType >= 0 & this.FileType <= 5) | this.DataType == 2 | this.DataType == 6) { //width if (this.TInfo1 != 0) { sOutput += "<div class=\"saucetinfo1\"><span class=\"saucelabel\">Width:</span><span class=\"saucedata\">" + this.TInfo1.ToString() + "</span></div>"; } //height if (this.TInfo2 != 0) { sOutput += "<div class=\"saucetinfo2\"><span class=\"saucelabel\">Height:</span><span class=\"saucedata\">" + this.TInfo2.ToString() + "</span></div>"; } } if (this.DataType == 1 & this.FileType == 3 & this.TInfo3 != 0) { //# RIP colors sOutput += "<div class=\"saucetinfo3\"><span class=\"saucelabel\"># Colors:</span><span class=\"saucedata\">" + this.TInfo3.ToString() + "</span></div>"; } // Ice Colors if (this.DataType == 1 & this.ExamineBit(this.Flags, 0) == true) { sOutput += "<div class=\"sauceice\">ICE Colors Enabled</div>"; } if (this.DataType == 2 & this.TInfo3 != 0) { //Bits per Pixel sOutput += "<div class=\"saucetinfo3\"><span class=\"saucelabel\">Bits per Pixel:</span><span class=\"saucedata\">" + this.TInfo3.ToString() + "</span></div>"; } sOutput += "</div>"; if (this.Comments > 0 & bGenCmts == true) { sOutput += "<div class=\"saucecomments\"><ol>"; for (int x = 0; x <= UBound(this.aComments); x++) { sOutput += "<li>" + Strings.Trim(this.aComments[x]) + "</li>"; } sOutput += "</ol></div>"; } System.Windows.Forms.Application.DoEvents(); return(sOutput); }
public static object MonthName(object month, object abbreviate) { return(DateAndTime.MonthName(Convert.ToInt32(month), Convert.ToBoolean(abbreviate))); }