/// <summary> /// 获取月份的最后一天 /// </summary> /// <param name="DayOfMonth">月份中的一天</param> /// <returns>该月的最后一天</returns> public static DateTime GetLastDateForMonth(DateTime DayOfMonth) { DateTime DtEnd; int Dtyear, DtMonth; Dtyear = DayOfMonth.Year; DtMonth = DayOfMonth.Month; int MonthCount = DateTime.DaysInMonth(Dtyear, DtMonth);//计算该月有多少天 DtEnd = Convert.ToDateTime(Dtyear.ToString() + "-" + DtMonth.ToString() + "-" + MonthCount); DtEnd.AddDays(1).AddMilliseconds(-1); return(DtEnd); }
public override int GetHashCode() { unchecked { var hashCode = DtStart?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (DtEnd?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Status.GetHashCode(); hashCode = (hashCode * 397) ^ IsActive().GetHashCode(); hashCode = (hashCode * 397) ^ Transparency.GetHashCode(); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Resources); return(hashCode); } }
private void ExtrapolateTimes() { if (DtEnd == null && DtStart != null && Duration != default(TimeSpan)) { DtEnd = DtStart.Add(Duration); } else if (Duration == default(TimeSpan) && DtStart != null && DtEnd != null) { Duration = DtEnd.Subtract(DtStart); } else if (DtStart == null && Duration != default(TimeSpan) && DtEnd != null) { DtStart = DtEnd.Subtract(Duration); } }
public bool CreateReport() { StreamWriter sr = null; try { string pt = Config.GetConfigValue("ReportOutput"); ReportFile = "PayPeriod" + DtEnd.ToString("yyyyMMddHHmmss") + ".rep"; pt += ("\\" + ReportFile); if (File.Exists(pt)) { File.Delete(pt); } Common.Db.Base db = new Common.Db.Base(); int cto = Common.Utils.GetInt(Config.GetConfigValue("SQLCommandTimeout")); if (cto >= 0) { db.CommandTimeOut = cto; } rpTable = db.GetDataTable(cnstGetReport, new object[] { "@bPeriod", DtBegin, "@ePeriod", DtEnd, "@PlayPeriod", TypeReport == cpReportType.Weekly ?0:-1 }); if (rpTable == null) { return(false); } sr = File.CreateText(pt); sr.WriteLine(GetHeaderForReport()); foreach (DataRow dr in rpTable.Rows) { string sdr = GetRowForReport(dr); sr.WriteLine(sdr); } sr.WriteLine(GetFooterForReport(rpTable.Rows.Count)); } catch {} finally { if (sr != null) { sr.Close(); } } return(true); }
public override int GetHashCode() { unchecked { var hashCode = DtStart?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (DtEnd?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Status.GetHashCode(); hashCode = (hashCode * 397) ^ IsActive().GetHashCode(); hashCode = (hashCode * 397) ^ Transparency.GetHashCode(); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Attachments); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Resources); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCodeForNestedCollection(ExceptionDates); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(ExceptionRules); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCodeForNestedCollection(RecurrenceDates); hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(RecurrenceRules); return(hashCode); } }
public override string ToString() { return($"{DeveloperId} {DtBegin.ToShortDateString()} - {DtEnd.ToShortDateString()}"); }
public Wlst.client.FaultTypes.FaultSettingRuleOne BackTo() { var d1 = 0; var d2 = 0; if (OpTimeSet == 2) { if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) { return(null); } d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart); d2 = Convert.ToInt32(DtEnd.Trim()); //d1 = DtS2; //StrTip = "开灯后设置为分钟数值"; } else if (OpTimeSet == 3) { if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) { return(null); } d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart); d2 = Convert.ToInt32(DtEnd.Trim()); //d1 = DtS2; //StrTip = "关灯后设置为分钟数值"; } else if (OpTimeSet == 1) { d1 = getStrInt(DtStart); d2 = getStrInt(DtEnd); //StrTip = "全天时间 为几点几分"; } else if (OpTimeSet == 4) { //lvf 负数 判断 if (DtStart.StartsWith("-")) //先判断是否以-开头 { string subdtStartStr = DtStart.Substring(1); //取-剩下的字符串 if (!IsNumberic(subdtStartStr)) { return(null); } } if (DtEnd.StartsWith("-")) //先判断是否以-开头 { string subdtEndStr = DtEnd.Substring(1); //取-剩下的字符串 if (!IsNumberic(subdtEndStr)) { return(null); } } //if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) return null; d1 = Convert.ToInt32(DtStart.Trim()); //gettostr(DtStart); d2 = Convert.ToInt32(DtEnd.Trim()); //StrTip = "日出-日落偏移量 为分钟数值"; } else if (OpTimeSet == 5) { if (DtStart.StartsWith("-")) //先判断是否以-开头 { string subdtStartStr = DtStart.Substring(1); //取-剩下的字符串 if (!IsNumberic(subdtStartStr)) { return(null); } } if (DtEnd.StartsWith("-")) //先判断是否以-开头 { string subdtEndStr = DtEnd.Substring(1); //取-剩下的字符串 if (!IsNumberic(subdtEndStr)) { return(null); } } //if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) return null; d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart); d2 = Convert.ToInt32(DtEnd.Trim()); //StrTip = "日落-日出偏移量 为分钟数值"; } //int optimeset = OpTimeSet; //if (OpTimeSet < 4) optimeset = OpTimeSet - 1; var rtn = new Wlst.client.FaultTypes.FaultSettingRuleOne() { FaultsAddTo = new List <int>(), AlarmTimeEnd = d2, AlarmTimeSet = OpTimeSet - 1, AlarmTimeStart = d1, FaultsRemoveOff = (from t in ItemsRemoveto where t.IsSelected select t.Value).ToList(), ProperyContainKey = (from t in ProperyContainKey where string.IsNullOrEmpty(t.Name) == false select t.Name) .ToList(), Op = Op, OpExtend = Op_extend, RuleId = RuleId, RuleName = Rule_name, TargetEquipment = 1 }; return(rtn); }