public string ToDateTimeString() { return(string.Format("{0}-{1}-{2}-{3}{4}{5}", Year, Month.ToString("00"), Day.ToString("00"), Hour.ToString("00"), Minute.ToString("00"), Second.ToString("00"))); }
public double ToDouble(IFormatProvider provider) { return(Convert.ToDouble($"{Year.ToString("00")}{Month.ToString("00")}{Day.ToString("00")}{Hour.ToString("00")}{Minute.ToString("00")}{Second.ToString("00")}")); }
private void btnQuestion_Click(object sender, EventArgs e) { txtWord.Visible = true; label19.Visible = true; btnQuestion.Enabled = false; if (num < 10) { try { if (int.Parse(txtWord.Text) == random) { score++; } } catch { } if (question == true) { foreach (Label lbl in panel1.Controls) { if (lbl.Name.IndexOf("label") >= 0) { lbl.Tag = lbl.Text; lbl.Text = ""; timer1.Stop(); label17.Visible = false; lblMinute.Visible = false; lblSecond.Visible = false; } } Random rnd = new Random(); random = rnd.Next(1, 10); foreach (Label lbl2_2 in panel1.Controls) { if (lbl2_2.Name.IndexOf("label" + random) >= 0) { num++; label11.Text = num.ToString(); lblword.Text = lbl2_2.Tag.ToString(); question = false; break; } } } else { txtWord.Text = ""; lblword.Text = ""; label17.Visible = true; lblMinute.Visible = true; lblSecond.Visible = true; Second = 60; Minute = 1; timer1.Start(); lblMinute.Text = Minute.ToString(); word(); question = true; } btnQuestion.Enabled = true; } else { try { if (int.Parse(txtWord.Text) == random) { score++; } } catch { } MessageBox.Show("تعداد جواب های درست شما : " + score); this.Close(); } }
public string ToString(string format, IFormatProvider provider) { if (provider == null) { // This try will always fail with our current language file naming scheme, as it doesn't match up with the standard. // This is in place so that should it be changed, we will automatically be using the chosen language rather than the system standard. try { provider = CultureInfo.GetCultureInfo(LocalizationTable.currentLanguage); } catch (ArgumentException) { provider = CultureInfo.CurrentCulture; } } DateTimeFormatInfo dateTimeFormatInfo = (DateTimeFormatInfo)provider.GetFormat(typeof(DateTimeFormatInfo)); switch (format) { case "HH": return(Hour.ToString("00")); case "H": return(Hour.ToString()); case "hh": int longhour = Hour; if (longhour >= 12) { longhour -= 12; } if (longhour == 0) { longhour = 12; } return(longhour.ToString("00")); case "h": int shorthour = Hour; if (shorthour >= 12) { shorthour -= 12; } if (shorthour == 0) { shorthour = 12; } return(shorthour.ToString()); case "mm": return(Minute.ToString("00")); case "m": return(Minute.ToString()); case "ss": return(Second.ToString("00")); case "s": return(Second.ToString()); case "tt": return(Hour >= 12 ? dateTimeFormatInfo.PMDesignator : dateTimeFormatInfo.AMDesignator); case "q": return(Quarter.ToString()); case "d": return(Day.ToString()); case "dd": return(Day.ToString("00")); case "y": return(Year.ToString()); case "G": return(this.ToString()); default: return(string.Empty); } }
public string ToString(string format) { var formattedText = ""; if (format != null) { for (int i = 0, len = format.Length; i < len; i++) { var wildcard = format[i]; var part = wildcard.ToString(); i++; while (i < len && format[i] == wildcard) { part += format[i]; i++; } i--; switch (part) { case "y": case "yy": case "yyy": case "yyyy": formattedText += Year.ToString().PadLeft(part.Length, '0'); break; case "MMMM": formattedText += GetMonthName(Month); break; case "MMM": formattedText += GetShortMonthName(Month); break; case "MM": case "M": formattedText += Month.ToString().PadLeft(part.Length, '0'); break; case "dddd": formattedText += DayName; break; case "ddd": formattedText += ShortDayName; break; case "dd": case "d": formattedText += Day.ToString().PadLeft(part.Length, '0'); break; case "HH": case "H": formattedText += Hour.ToString().PadLeft(part.Length, '0'); break; case "hh": case "h": formattedText += (Hour % 12 == 0 ? 12 : Hour % 12).ToString().PadLeft(part.Length, '0'); break; case "mm": case "m": formattedText += Minute.ToString().PadLeft(part.Length, '0'); break; case "ss": case "s": formattedText += Second.ToString().PadLeft(part.Length, '0'); break; case "fffffff": case "ffffff": case "fffff": case "ffff": case "fff": case "ff": case "f": formattedText += Millisecond.ToString().PadLeft(part.Length, '0'); break; case "tt": case "t": formattedText += (Hour < 12 ? "صبح" : "عصر").Substring(0, part.Length == 1 ? 1 : 3); break; default: formattedText += part; break; } } } return(formattedText); }
public string ToLongTimeString() { return(Hour.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0') + ":" + Second.ToString().PadLeft(2, '0')); }
} // Useful to know if "0" means UTC or just undefined public override string ToString() { if (Status == DateStatus.Unused) { return(string.Empty); } if (Status == DateStatus.Open) { return(SpecialValues.Open); } if (Status == DateStatus.Unknown) { return(string.Empty); } if (!Year.HasValue) { return(string.Empty); } // FLAG GROUPINGS. var isSingleUncertain = Year.IsUncertain && !Month.IsUncertain; var isSingleApprox = Year.IsApproximate && !Month.IsApproximate; string result = string.Empty; AddFlagsToString(ref result, isSingleApprox, isSingleUncertain); result += Year.ToString(4); if (Month.HasValue) { result += "-"; var isLeftUncertain = !Year.IsUncertain && Month.IsUncertain; var isLeftApprox = !Year.IsApproximate && Month.IsApproximate; AddFlagsToString(ref result, isLeftApprox, isLeftUncertain); result += Month.ToString(2).PadLeft(2, '0'); var isRightUncertain = Year.IsUncertain && Month.IsUncertain && !Day.IsUncertain; var isRightApprox = Year.IsApproximate && Month.IsApproximate && !Day.IsApproximate; AddFlagsToString(ref result, isRightApprox, isRightUncertain); if (Day.HasValue) { result += "-"; isLeftUncertain = !(Year.IsUncertain && Month.IsUncertain) && Day.IsUncertain; isLeftApprox = !(Year.IsApproximate && Month.IsApproximate) && Day.IsApproximate; AddFlagsToString(ref result, isLeftApprox, isLeftUncertain); result += Day.ToString(2).PadLeft(2, '0'); isRightUncertain = Year.IsUncertain && Month.IsUncertain && Day.IsUncertain; isRightApprox = Year.IsApproximate && Month.IsApproximate && Day.IsApproximate; AddFlagsToString(ref result, isRightApprox, isRightUncertain); if ((Hour > 0) || (Minute > 0) || (Second > 0)) { result += "T" + Hour.ToString("00") + ":" + Minute.ToString("00") + ":" + Second.ToString("00"); if (TimeZoneOffset == 0) { // The standard is somewhat unclear, but suggests that if there is no "Z" and no TZ offset, // the date does not define a time zone and should not be serialized to use UTC. if (!HasTimeZoneOffset) { return(result); } return(result + "Z"); } else { var tzHour = TimeZoneOffset / 60; var tzMinute = TimeZoneOffset % 60; result += (TimeZoneOffset < 0 ? "-" : "+") + tzHour.ToString("00") + ":" + tzMinute.ToString("00"); } } } } return(result); }
private void button1_Click(object sender, EventArgs e) { Second = 0; Minute = 0; lblMinute.Text = "0" + Minute.ToString(); timer1.Start(); if (num == 10) { this.Close(); } label10.Visible = true; label9.Visible = true; button1.Enabled = true; txtMinute.Text = ""; txtHour.Text = ""; num++; label2.Visible = true; label3.Visible = true; label4.Visible = true; label5.Visible = true; label6.Visible = true; label7.Visible = true; txtHour.Visible = true; txtMinute.Visible = true; btnStart.Enabled = false; label7.Text = num.ToString(); Random rnd = new Random(); a1 : confirm2 = rnd.Next(1, 12); if (confirm2 != confirm) { confirm = confirm2; } else { goto a1; } switch (confirm) { case 1: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\1.png"); break; case 2: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\2.png"); break; case 3: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\3.png"); break; case 4: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\4.png"); break; case 5: pic_Time.Image = (Image.FromFile(Application.StartupPath + @"\picture\time2\5.png")); break; case 6: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\6.png"); break; case 7: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\7.png"); break; case 8: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\8.png"); break; case 9: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\9.png"); break; case 10: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\10.png"); break; case 11: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\11.png"); break; case 12: pic_Time.Image = Image.FromFile(Application.StartupPath + @"\picture\time2\12.png"); break; } }
public override string ToString() { return(Hour.ToString("00") + ":" + Minute.ToString("00")); }
/// <summary> /// Возврашает строку в формате "HH.mm" /// </summary> /// <returns></returns> public override string ToString() { string result = Hour.ToString("00") + "." + Minute.ToString("00"); return(result); }
public override string ToString() { return(String.Format("{0,2}:{1,2}:{2,2}:{3,2}", Day.ToString("D2"), Hour.ToString("D2"), Minute.ToString("D2"), Second.ToString("D2"))); //return $"{Day}:{Hour}:{Minute}:{Second}"; }
public override string ToString() { return(Hour.ToString("00") + Minute.ToString("00") + Second.ToString("00") + (Utc ? "Z" : string.Empty)); }
public string ToString(IFormatProvider provider) { return($"{Year}/{Month.ToString("00")}/{Day.ToString("00")} {Hour.ToString("00")}:{Minute.ToString("00")}:{Second.ToString("00")}"); }
public override string ToString() { var hour = Hour; string ampm; if (hour > 12) { hour -= 12; ampm = "p.m."; } else { ampm = "a.m."; } return ($"{AgeName} {Year}, {Moon.DisplayWithOrdinal()} moon, {Sun.DisplayWithOrdinal()} sun, {hour}:{Minute.ToString("d2")} {ampm}"); }
protected void Page_Load(object sender, EventArgs e) { if (EventType_CD != null) { iEvent.ToolTip = Minute.ToString() + "'"; Dictionary <int, string> eventFlagMap = UIHelper.EventCodeEventFlagsMap[EventType_CD]; foreach (int flag in eventFlagMap.Keys) { if ((flag & EventFlags) > 0) { iEvent.ToolTip += ", " + eventFlagMap[flag]; } } switch (EventType_CD) { case Constants.DB.EventTypeCodes.Goal: { if (AppliesToSecondPlayer) { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/assist2.png"); iEvent.ToolTip = "Гол: " + UIHelper.FormatName(Player1) + " - " + iEvent.ToolTip; } else { if (Player2 != null) { iEvent.ToolTip = "Пас: " + UIHelper.FormatName(Player2) + " - " + iEvent.ToolTip; } if ((EventFlags & Constants.DB.EventFlags.OwnGoal) > 0) { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/own_goal.png"); } else { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/ball.gif"); } } break; } case Constants.DB.EventTypeCodes.Penalty: { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/penalty.png"); if (EventFlags.HasValue && ((EventFlags.Value & Constants.DB.EventFlags.PostMatchPenalty) > 0)) { iEvent.Style.Add("opacity", "0.3"); } break; } case Constants.DB.EventTypeCodes.YellowCard: { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/yells.gif"); break; } case Constants.DB.EventTypeCodes.RedCard: { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/reds.gif"); break; } case Constants.DB.EventTypeCodes.SecondYellowCard: { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/yellow2.gif"); break; } case Constants.DB.EventTypeCodes.MissedPenalty: { iEvent.ImageUrl = ResolveClientUrl("~/WebApplication/images/nogoal.png"); if (EventFlags.HasValue && ((EventFlags.Value & Constants.DB.EventFlags.PostMatchPenalty) > 0)) { iEvent.Style.Add("opacity", "0.3"); } break; } default: { iEvent.Visible = false; break; } } } if (HasVideo) { iEvent.Attributes.Add("onclick", string.Format("open_colorbox_video(event, '{0}')", PathHelper.GetWebPath(this.Page, Constants.Paths.RootWebPath, "Public", "Video.aspx?EventId=" + EventId.ToString()))); iEvent.Attributes.Add("onclick", string.Format("open_colorbox_video(event, '{0}')", PathHelper.GetWebPath(this.Page, Constants.Paths.RootWebPath, "Public", "Video.aspx?EventId=" + EventId.ToString()))); iEvent.Style.Add("background-color", "#E5F5DF"); } }
/// <summary>Returns the string representation of the value of this instance.</summary> /// <param name="format">Format string using the usual characters to interpret custom datetime - as per standard DateTime custom formats</param> /// <returns>A string that represents the value of this instance.</returns> public String ToString(String format, IFormatProvider provider) { //parse and replace the format stuff MatchCollection matches = Regex.Matches(format, "([a-zA-z])\\1{0,}"); for (int i = matches.Count - 1; i >= 0; i--) { Match m = matches[i]; Int32 mIndex = m.Index, mLength = m.Length; if (mIndex > 0 && format[m.Index - 1] == '\\') { if (m.Length == 1) { continue; } else { mIndex++; mLength--; } } switch (m.Value[0]) { case 'y': format = format.Substring(0, mIndex) + Year.ToString("D" + mLength) + format.Substring(mIndex + mLength); break; case 'M': if (mLength < 3) { String input2 = Month.ToString("D" + mLength); format = format.Substring(0, mIndex) + input2 + format.Substring(mIndex + mLength); } else if (mLength == 3) { if (KSPDateStructure.CalendarType == CalendarTypeEnum.Earth) { format = format.Substring(0, mIndex) + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(Month) + format.Substring(mIndex + mLength); } else if (KSPDateStructure.MonthCount < 1) { String input2 = Month.ToString("D" + mLength); format = format.Substring(0, mIndex) + input2 + format.Substring(mIndex + mLength); } else { format = format.Substring(0, mIndex) + KSPDateStructure.Months[Month].ToString().Substring(0, 3) + format.Substring(mIndex + mLength); } } else { if (KSPDateStructure.CalendarType == CalendarTypeEnum.Earth) { format = format.Substring(0, mIndex) + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Month) + format.Substring(mIndex + mLength); } else if (KSPDateStructure.MonthCount < 1) { String input2 = Month.ToString("D" + mLength); format = format.Substring(0, mIndex) + input2 + format.Substring(mIndex + mLength); } else { format = format.Substring(0, mIndex) + KSPDateStructure.Months[Month] + format.Substring(mIndex + mLength); } } break; case 'd': format = format.Substring(0, mIndex) + Day.ToString("D" + mLength) + format.Substring(mIndex + mLength); break; case 'h': //how to do this one AM/PM Hours String HalfDayTime = ""; switch (AMPM) { case AMPMEnum.AM: HalfDayTime = Hour.ToString("D" + mLength.Clamp(1, (KSPDateStructure.HoursPerDay / 2).ToString().Length)); break; case AMPMEnum.PM: HalfDayTime = (Hour - (KSPDateStructure.HoursPerDay / 2)).ToString("D" + mLength.Clamp(1, (KSPDateStructure.HoursPerDay / 2).ToString().Length)); break; case AMPMEnum.OddHoursPerDay: default: HalfDayTime = Hour.ToString("D" + mLength.Clamp(1, KSPDateStructure.HoursPerDay.ToString().Length)); break; } format = format.Substring(0, mIndex) + HalfDayTime + format.Substring(mIndex + mLength); break; case 't': if (AMPM != AMPMEnum.OddHoursPerDay) { format = format.Substring(0, mIndex) + AMPM.ToString().ToLower() + format.Substring(mIndex + mLength); } break; case 'T': if (AMPM != AMPMEnum.OddHoursPerDay) { format = format.Substring(0, mIndex) + AMPM.ToString().ToUpper() + format.Substring(mIndex + mLength); } break; case 'H': format = format.Substring(0, mIndex) + Hour.ToString("D" + mLength.Clamp(1, KSPDateStructure.HoursPerDay.ToString().Length)) + format.Substring(mIndex + mLength); break; case 'm': format = format.Substring(0, mIndex) + Minute.ToString("D" + mLength.Clamp(1, KSPDateStructure.MinutesPerHour.ToString().Length)) + format.Substring(mIndex + mLength); break; case 's': format = format.Substring(0, mIndex) + Second.ToString("D" + mLength.Clamp(1, KSPDateStructure.SecondsPerMinute.ToString().Length)) + format.Substring(mIndex + mLength); break; default: break; } } //Now strip out the \ , but not multiple \\ format = Regex.Replace(format, "\\\\(?=[a-z])", ""); return(format); //if (KSPDateStructure.CalendarType == CalendarTypeEnum.Earth) // return String.Format(format, _EarthDateTime); //else // return String.Format(format, this); //"TEST"; }
public string DateStr(TimelineUnits unit) { switch (unit) { case TimelineUnits.Minute: return(Year.ToString() + "." + Month.ToString() + "." + Day.ToString() + " " + Hour.ToString() + ":" + Minute.ToString()); case TimelineUnits.Hour: return(Year.ToString() + "." + Month.ToString() + "." + Day.ToString() + " " + Hour.ToString() + ":00"); case TimelineUnits.Day: return(Year.ToString() + "." + Month.ToString() + "." + Day.ToString()); case TimelineUnits.Month: return(Year.ToString() + "." + Month.ToString()); case TimelineUnits.Year: return(Year.ToString()); case TimelineUnits.Decade: return(Decade.ToString()); default: return(""); } }
/// <summary> /// 변경된 데이터 추출 /// </summary> /// <param name="dataTable">변경하는 데이터 테이블</param> private void ModifyDataTable(DataTable dataTable) { //전달받은 데이터테이블중 변경된 행을 새로운 데이터 테이블에 입력 DataTable dtChanges = dataTable.GetChanges(DataRowState.Modified); //테이블의 값이 있는지 확인 if (dtChanges != null) { foreach (DataRow data in dtChanges.Rows) { //변경된 데이터테이블의 값이 조건에 맞는지 확인 for (int i = 0; i < dateWeekList.Count; i++) { //변경된 데이터테이블의 값이 조건에 맞는지 확인 if ((!data[dateWeekList[i].date + "OnTime"].ToString().Contains(":") && data[dateWeekList[i].date + "OnTime"].ToString().Length != 4) || (!data[dateWeekList[i].date + "OffTime"].ToString().Contains(":") && data[dateWeekList[i].date + "OffTime"].ToString().Length != 4) || (data[dateWeekList[i].date + "OnTime"].ToString().Contains(":") && data[dateWeekList[i].date + "OnTime"].ToString().Length > 5) || (data[dateWeekList[i].date + "OffTime"].ToString().Contains(":") && data[dateWeekList[i].date + "OffTime"].ToString().Length > 5)) { continue; } else { string[] swap = SplitString(data[dateWeekList[i].date + "OnTime"].ToString(), ':'); int Time, Minute; Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); data[dateWeekList[i].date + "OnTime"] = Time.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0'); if (Time < 0 || Time > 29 || Minute > 60 || Minute < 0) { continue; } swap = SplitString(data[dateWeekList[i].date + "OffTime"].ToString(), ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); data[dateWeekList[i].date + "OffTime"] = Time.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0'); if (Time < 0 || Time > 29 || Minute > 60 || Minute < 0) { continue; } } ScheduleData scheduleData = new ScheduleData(); scheduleData.Phone = data["Phone"].ToString(); scheduleData.Date = data[dateWeekList[i].date + "Date"].ToString(); scheduleData.OnTime = data[dateWeekList[i].date + "OnTime"].ToString(); scheduleData.OffTime = data[dateWeekList[i].date + "OffTime"].ToString(); Update(SQLiteData.TableSchedule, scheduleData); } } } }
/// <summary> /// 短时间。 15:20:30 /// </summary> /// <returns></returns> public string ToShortTimeString() { return(Hour.ToString("00") + ":" + Minute.ToString("00") + ":" + Seconds.ToString("00")); }
public override string ToString() { return(Year + "/" + Month.ToString().PadLeft(2, '0') + "/" + Day.ToString().PadLeft(2, '0') + " " + Hour.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0') + ":" + Second.ToString().PadLeft(2, '0') + "." + Millisecond.ToString().PadLeft(3, '0')); }
public string ToDateAndHourMinitePathString() { return(ToDateString() + "_" + Hour.ToString("00") + "_" + Minute.ToString("00")); }
public string ToShortTimeString() { return(Hour.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0')); }
public void WageCalculation(string phone, string date) { WageData scheduleData = Select(phone, date); int Wage = SelectWage(phone); //출근,퇴근 시간, 분 분리 int OnTime, OnMinute, OffTime, OffMinute; string[] swap = SplitString(scheduleData.OnTime, ':'); OnTime = Convert.ToInt32(swap[0]); OnMinute = Convert.ToInt32(swap[1]); swap = SplitString(scheduleData.OffTime, ':'); OffTime = Convert.ToInt32(swap[0]); OffMinute = Convert.ToInt32(swap[1]); //시간들 계산 int Time, Minute; //24시 이후 퇴근은 24를 더해서 계산 if (OffTime < 5) { OffTime += 24; } //오전 6시 이후 출근 if (OnTime >= 6) { //일반시간 if (OffTime < 22) { Time = OffTime - OnTime; if (OnMinute <= OffMinute) { Minute = OffMinute - OnMinute; } else { Time -= 1; Minute = (OffMinute + 60) - OnMinute; } scheduleData.Time = Time + ":" + Minute.ToString().PadLeft(2, '0'); } //야간시간 else { if (OnTime >= 22) { Time = 0; Minute = 0; OffMinute -= OnMinute; } else { Time = 22 - OnTime; Time -= 1; Minute = 60 - OnMinute; if (Minute >= 60) { Time += 1; Minute -= 60; } } scheduleData.Time = Time + ":" + Minute.ToString().PadLeft(2, '0'); if (OnTime <= 22) { Time = OffTime - 22; } else { Time = OffTime - OnTime; } Minute = OffMinute; scheduleData.NightTime = Time + ":" + Minute.ToString().PadLeft(2, '0'); } } //오전 6시 이전 출근 else { //일반시간 if (OffTime < 22) { Time = OffTime - 6; Minute = OffMinute; scheduleData.Time = Time + ":" + Minute.ToString().PadLeft(2, '0'); } //야간시간 else { Time = (6 - OnTime) + (OffTime - 22); if (OnMinute <= OffMinute) { Minute = OffMinute - OnMinute; } else { Time -= 1; Minute = (OffMinute + 60) - OnMinute; } scheduleData.NightTime = Time + ":" + Minute.ToString().PadLeft(2, '0'); } } //총 시간 if (!scheduleData.Time.Equals("")) { swap = SplitString(scheduleData.Time, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); } if (!scheduleData.NightTime.Equals("")) { swap = SplitString(scheduleData.NightTime, ':'); Time += Convert.ToInt32(swap[0]); Minute += Convert.ToInt32(swap[1]); } if (Minute >= 60) { Time += 1; Minute -= 60; } scheduleData.TotalTime = Time + ":" + Minute.ToString().PadLeft(2, '0'); //휴계시간 if ((Time / 4) > 0) { Minute = (Time / 4) * 30; Time = 0; if (Minute >= 60) { Time += 1; Minute -= 60; } scheduleData.RestTime = Time + ":" + Minute.ToString().PadLeft(2, '0'); } //연장시간 swap = SplitString(scheduleData.TotalTime, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); if (Time > 8) { Time -= 8; scheduleData.ExtensionTime = Time + ":" + Minute.ToString().PadLeft(2, '0'); //일반시간에서 연장시간 빼기 int Time1, Minute1; swap = SplitString(scheduleData.Time, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); swap = SplitString(scheduleData.ExtensionTime, ':'); Time1 = Convert.ToInt32(swap[0]); Minute1 = Convert.ToInt32(swap[1]); Time -= Time1; if (Minute < Minute1) { Time -= 1; Minute += 60; } Minute -= Minute1; scheduleData.Time = Time + ":" + Minute; } //일반시급 if (!scheduleData.Time.Equals("")) { swap = SplitString(scheduleData.Time, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); scheduleData.Wage = ((Wage * Time) + (Wage * Minute) / 60).ToString(); } else { scheduleData.Wage = "0"; } //휴계시급 if (!scheduleData.RestTime.Equals("")) { swap = SplitString(scheduleData.RestTime, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); scheduleData.RestWage = ((Wage * Time) + (Wage * Minute) / 60).ToString(); } else { scheduleData.RestWage = "0"; } //연장시급 if (!scheduleData.ExtensionTime.Equals("")) { swap = SplitString(scheduleData.ExtensionTime, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); scheduleData.ExtensionWage = string.Format("{0:F0}", ((Wage * Time) + (Wage * Minute) / 60) * 1.5); } else { scheduleData.ExtensionWage = "0"; } //야간시급 if (!scheduleData.NightTime.Equals("")) { swap = SplitString(scheduleData.NightTime, ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); scheduleData.NightWage = string.Format("{0:F0}", ((Wage * Time) + (Wage * Minute) / 60) * 1.5); } else { scheduleData.NightWage = "0"; } //총 시급 scheduleData.TotalWage = (Convert.ToInt32(scheduleData.Wage) + Convert.ToInt32(scheduleData.ExtensionWage) + Convert.ToInt32(scheduleData.NightWage) - Convert.ToInt32(scheduleData.RestWage)).ToString(); Update(phone, scheduleData); }
private void OnTimedEvent(Object source, ElapsedEventArgs e) { if (countChoice == CountDirection.COUNTUP) { MilliSecond += elapsedMilliSec; if (MilliSecond >= 1000) { MilliSecond = 0; Second += 1; } if (Second >= 60) { Second = 0; Minute += 1; } // Build string and set it to object if (Second <= 9) { secondString = String.Concat('0', Second); } else { secondString = Second.ToString(); } if (Minute <= 9) { minuteString = String.Concat('0', Minute); } else { minuteString = Minute.ToString(); } if (mainObjectLabel != null) { Device.BeginInvokeOnMainThread(() => { SetText(String.Concat(minuteString, ':', secondString)); }); } } else { MilliSecond += elapsedMilliSec; if (MilliSecond >= 1000) { MilliSecond = 0; Second -= 1; } else { return; } if (Second < 0) { Second = 59; Minute -= 1; } if (Minute < 0) { if (mainObjectLabel != null) { Device.BeginInvokeOnMainThread(() => { SetText("00:00"); }); } this.Stop(); return; } // Build string and set it to object if (Second <= 9) { secondString = String.Concat('0', Second); } else { secondString = Second.ToString(); } if (Minute <= 9) { minuteString = String.Concat('0', Minute); } else { minuteString = Minute.ToString(); } if (mainObjectLabel != null) { Device.BeginInvokeOnMainThread(() => { SetText(String.Concat(minuteString, ':', secondString)); }); } } }
/// <summary> /// 데이터베이스에서 데이터 삭제 /// </summary> /// <param name="dataTable">변경된 데이터테이블</param> public void DeleteDataTable(DataTable dataTable) { //전달받은 데이터테이블중 삭제된 행을 새로운 데이터 테이블에 입력 DataTable dtChanges = dataTable.GetChanges(DataRowState.Deleted); string OnTime, OffTime; //테이블의 값이 있는지 확인 if (dtChanges != null) { foreach (DataRow data in dtChanges.Rows) { //변경된 데이터테이블의 값이 조건에 맞는지 확인 if ((!data["OnTime", DataRowVersion.Original].ToString().Contains(":") && data["OnTime", DataRowVersion.Original].ToString().Length != 4) || (!data["OffTime", DataRowVersion.Original].ToString().Contains(":") && data["OffTime", DataRowVersion.Original].ToString().Length != 4) || (data["OnTime", DataRowVersion.Original].ToString().Contains(":") && data["OnTime", DataRowVersion.Original].ToString().Length > 5) || (data["OffTime", DataRowVersion.Original].ToString().Contains(":") && data["OffTime", DataRowVersion.Original].ToString().Length > 5)) { return; } else { string[] swap = SplitString(data["OnTime", DataRowVersion.Original].ToString(), ':'); int Time, Minute; Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); OnTime = Time.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0'); if (Time < 0 || Time > 29 || Minute > 60 || Minute < 0) { return; } swap = SplitString(data["OffTime", DataRowVersion.Original].ToString(), ':'); Time = Convert.ToInt32(swap[0]); Minute = Convert.ToInt32(swap[1]); OffTime = Time.ToString().PadLeft(2, '0') + ":" + Minute.ToString().PadLeft(2, '0'); if (Time < 0 || Time > 29 || Minute > 60 || Minute < 0) { return; } } string phone = ""; //권한이 일반직원인지 확인 if (MemberData.GetMemberData.AuthorityData.Authority == 3) { phone = MemberData.GetMemberData.Phone; } else { int index = TransitionPage.wageManagement.cbName.SelectedIndex; phone = CommData.GetCommData().getLoginDataList()[index].Phone; } WageData scheduleData = new WageData(); scheduleData.OnTime = OnTime; scheduleData.OffTime = OffTime; scheduleData.Date = data["Date", DataRowVersion.Original].ToString(); Delete(phone, scheduleData); WageCalculation(phone, data["Date", DataRowVersion.Original].ToString()); } } }
public override string ToString() { return(Hour.ToString() + "," + Minute.ToString() + "," + Second.ToString()); }
public PacificDateTime(TimeSpan timeOfDay) { var pacificNow = DateTime.UtcNow.ToPacific(); Year = pacificNow.Year; Month = pacificNow.Month; Day = pacificNow.Day; Hour = timeOfDay.Hours; Minute = timeOfDay.Minutes; Second = timeOfDay.Seconds; Millisecond = timeOfDay.Milliseconds; var dateTimeParse = DateTime.Parse(string.Concat(Year, "-", Month.ToString("00"), "-", Day.ToString("00"), "T", Hour.ToString("00"), ":", Minute.ToString("00"), ":", Second.ToString("00"), ".", Millisecond.ToString("00"), "Z")) .ToUniversalTime(); Offset = dateTimeParse.IsInDaylightSavingsTime() ? DaylightOffset : StandardOffset; Date = new PacificDateTime(Year, Month, Day); DayOfYear = Date.DayOfYear; DayOfWeek = Date.DayOfWeek; }
} // Equals // ---------------------------------------------------------------------- public override string ToString() { return(((int)TotalHours).ToString("00") + ":" + Minute.ToString("00") + ":" + Second.ToString("00") + "." + Millisecond.ToString("000")); } // ToString
public decimal ToDecimal(IFormatProvider provider) { return(Convert.ToDecimal($"{Year}{Month.ToString("00")}{Day.ToString("00")}{Hour.ToString("00")}{Minute.ToString("00")}{Second.ToString("00")}")); }