public static void FullText(this CompletionTime self, List <string> fullText) { var value = self?.Value.ToLocal().AddDays(-1); if (value?.InRange() == true) { fullText.Add(value.ToString()); } }
public virtual bool sameEventAs(HandlingEvent other) { var equal = other != null && Cargo.Equals(other.Cargo) && CompletionTime.Equals(other.CompletionTime) && Activity.Equals(other.Activity); return(equal); }
public int Compare(CompletionTime <T> x, CompletionTime <T> y) { // Want to show more recent schools first, so reverse the default order. if (x == null) { return(y == null ? 0 : 1); } return(y == null ? -1 : -1 * x.CompareTo(y)); }
private void AssertCompletionDate(CompletionTime <PartialDate> expectedCompletionDate, Guid resumeId) { var school = _resumesQuery.GetResume(resumeId).Schools[0]; if (expectedCompletionDate != null) { Assert.IsNotNull(school.CompletionDate); Assert.AreEqual(expectedCompletionDate.End, school.CompletionDate.End); } else { Assert.IsNull(school.CompletionDate); } // This is really a test for PartialCompletionDate.Equals. Assert.AreEqual(expectedCompletionDate, school.CompletionDate); }
/// <summary> /// Returns true if Route instances are equal /// </summary> /// <param name="input">Instance of Route to be compared</param> /// <returns>Boolean</returns> public bool Equals(Route input) { if (input == null) { return(false); } return (( VehicleId == input.VehicleId || (VehicleId != null && VehicleId.Equals(input.VehicleId)) ) && ( Distance == input.Distance || (Distance != null && Distance.Equals(input.Distance)) ) && ( TransportTime == input.TransportTime || (TransportTime != null && TransportTime.Equals(input.TransportTime)) ) && ( CompletionTime == input.CompletionTime || (CompletionTime != null && CompletionTime.Equals(input.CompletionTime)) ) && ( WaitingTime == input.WaitingTime || (WaitingTime != null && WaitingTime.Equals(input.WaitingTime)) ) && ( Activities == input.Activities || Activities != null && Activities.SequenceEqual(input.Activities) ) && ( Points == input.Points || Points != null && Points.SequenceEqual(input.Points) )); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("[" + ID.ToString() + "] : "); switch (State) { case -1: sb.Append("<Locked>"); break; case 0: sb.Append("<Empty>"); break; case 1: sb.Append(KCDatabase.Instance.MasterShips[ShipID].Name + ", at " + CompletionTime.ToString()); break; } return(sb.ToString()); }
public static void FullText( this CompletionTime self, Context context, Column column, StringBuilder fullText) { var value = self?.Value.ToLocal(context: context).AddDays(-1); if (value?.InRange() == true) { switch (column?.FullTextType) { case Column.FullTextTypes.DisplayName: case Column.FullTextTypes.Value: case Column.FullTextTypes.ValueAndDisplayName: fullText .Append(" ") .Append(value.ToString()); break; } } }
private T CalculateValue() { double elapsedMilliseconds = DateTime.Now.Subtract(StartTime).TotalMilliseconds; double totalMilliseconds = CompletionTime.Subtract(StartTime).TotalMilliseconds; if (totalMilliseconds == 0) { return(FinalValue); } double completedPercent = elapsedMilliseconds / totalMilliseconds; if (completedPercent < 0) { return(InitialValue); } if (completedPercent > 1) { return(FinalValue); } return((T)(completedPercent * (dynamic)FinalValue + (1 - completedPercent) * (dynamic)InitialValue)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (VehicleId != null) { hashCode = hashCode * 59 + VehicleId.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (TransportTime != null) { hashCode = hashCode * 59 + TransportTime.GetHashCode(); } if (CompletionTime != null) { hashCode = hashCode * 59 + CompletionTime.GetHashCode(); } if (WaitingTime != null) { hashCode = hashCode * 59 + WaitingTime.GetHashCode(); } if (Activities != null) { hashCode = hashCode * 59 + Activities.GetHashCode(); } if (Points != null) { hashCode = hashCode * 59 + Points.GetHashCode(); } return(hashCode); } }
private void Set( Context context, SiteSettings ss, DataRow dataRow, string tableAlias) { foreach (DataColumn dataColumn in dataRow.Table.Columns) { var column = new ColumnNameInfo(dataColumn.ColumnName); if (column.TableAlias == tableAlias) { switch (column.Name) { case "SiteId": SiteId = dataRow[column.ColumnName].ToLong(); break; case "IssueId": IssueId = dataRow[column.ColumnName].ToLong(); break; case "Ver": Ver = dataRow[column.ColumnName].ToInt(); break; case "Title": Title = new Title(context: context, ss: ss, dataRow: dataRow, column: column); break; case "Body": Body = dataRow[column.ColumnName].ToString(); break; case "StartTime": StartTime = dataRow[column.ColumnName].ToDateTime(); break; case "CompletionTime": CompletionTime = new CompletionTime(context: context, ss: ss, dataRow: dataRow, column: column); break; case "WorkValue": WorkValue = new WorkValue(dataRow, column); break; case "ProgressRate": ProgressRate = new ProgressRate(dataRow, column); break; case "RemainingWorkValue": RemainingWorkValue = new Num(dataRow, "RemainingWorkValue"); break; case "Status": Status = new Status(dataRow, column); break; case "Manager": Manager = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "Owner": Owner = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "Locked": Locked = dataRow[column.ColumnName].ToBool(); break; case "Comments": Comments = dataRow[column.ColumnName].ToString().Deserialize <Comments>() ?? new Comments(); break; case "Creator": Creator = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "Updator": Updator = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "CreatedTime": CreatedTime = new Time(context, dataRow, column.ColumnName); break; default: switch (Def.ExtendedColumnTypes.Get(column.Name)) { case "Class": Class( columnName: column.Name, value: dataRow[column.ColumnName].ToString()); break; case "Num": Num( columnName: column.Name, value: dataRow[column.ColumnName].ToDecimal()); break; case "Date": Date( columnName: column.Name, value: dataRow[column.ColumnName].ToDateTime()); break; case "Description": Description( columnName: column.Name, value: dataRow[column.ColumnName].ToString()); break; case "Check": Check( columnName: column.Name, value: dataRow[column.ColumnName].ToBool()); break; } break; } } } }
/// <summary> /// Serializes this instance of <see cref="Task" /> into a <see cref="Carbon.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Carbon.Json.JsonObject"/> container to serialize this object into. If the caller /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Rest.ClientRuntime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="Task" /> as a <see cref="Carbon.Json.JsonNode" />. /// </returns> public Carbon.Json.JsonNode ToJson(Carbon.Json.JsonObject container, Microsoft.Rest.ClientRuntime.SerializationMode serializationMode) { container = container ?? new Carbon.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return(container); } AddIf(null != ApiVersion ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ApiVersion) : null, "api_version", container.Add); AddIf(null != ClusterReference ? (Carbon.Json.JsonNode)ClusterReference.ToJson(null) : null, "cluster_reference", container.Add); AddIf(null != CompletionTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(CompletionTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "completion_time", container.Add); AddIf(null != CreationTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(CreationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "creation_time", container.Add); if (null != EntityReferenceList) { var __w = new Carbon.Json.XNodeArray(); foreach (var __x in EntityReferenceList) { AddIf(__x?.ToJson(null), __w.Add); } container.Add("entity_reference_list", __w); } AddIf(null != ErrorCode ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ErrorCode) : null, "error_code", container.Add); AddIf(null != ErrorDetail ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ErrorDetail) : null, "error_detail", container.Add); AddIf(null != LastUpdateTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(LastUpdateTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "last_update_time", container.Add); AddIf(null != LogicalTimestamp ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((long)LogicalTimestamp) : null, "logical_timestamp", container.Add); AddIf(null != OperationType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(OperationType) : null, "operation_type", container.Add); AddIf(null != ParentTaskReference ? (Carbon.Json.JsonNode)ParentTaskReference.ToJson(null) : null, "parent_task_reference", container.Add); AddIf(null != PercentageComplete ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)PercentageComplete) : null, "percentage_complete", container.Add); AddIf(null != ProgressMessage ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ProgressMessage) : null, "progress_message", container.Add); AddIf(null != StartTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(StartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "start_time", container.Add); AddIf(null != Status ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Status) : null, "status", container.Add); if (null != SubtaskReferenceList) { var __r = new Carbon.Json.XNodeArray(); foreach (var __s in SubtaskReferenceList) { AddIf(__s?.ToJson(null), __r.Add); } container.Add("subtask_reference_list", __r); } AddIf(null != Uuid ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Uuid) : null, "uuid", container.Add); AfterToJson(ref container); return(container); }
private void Set( Context context, SiteSettings ss, DataRow dataRow, string tableAlias) { foreach (DataColumn dataColumn in dataRow.Table.Columns) { var column = new ColumnNameInfo(dataColumn.ColumnName); if (column.TableAlias == tableAlias) { switch (column.Name) { case "SiteId": SiteId = dataRow[column.ColumnName].ToLong(); break; case "IssueId": IssueId = dataRow[column.ColumnName].ToLong(); break; case "Ver": Ver = dataRow[column.ColumnName].ToInt(); break; case "Title": Title = new Title(context: context, ss: ss, dataRow: dataRow, column: column); break; case "Body": Body = dataRow[column.ColumnName].ToString(); break; case "StartTime": StartTime = dataRow[column.ColumnName].ToDateTime(); break; case "CompletionTime": CompletionTime = new CompletionTime(context: context, ss: ss, dataRow: dataRow, column: column); break; case "WorkValue": WorkValue = new WorkValue(dataRow, column); break; case "ProgressRate": ProgressRate = new ProgressRate(dataRow, column); break; case "RemainingWorkValue": RemainingWorkValue = dataRow[column.ColumnName].ToDecimal(); break; case "Status": Status = new Status(dataRow, column); break; case "Manager": Manager = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "Owner": Owner = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "ClassA": ClassA = dataRow[column.ColumnName].ToString(); break; case "ClassB": ClassB = dataRow[column.ColumnName].ToString(); break; case "ClassC": ClassC = dataRow[column.ColumnName].ToString(); break; case "ClassD": ClassD = dataRow[column.ColumnName].ToString(); break; case "ClassE": ClassE = dataRow[column.ColumnName].ToString(); break; case "ClassF": ClassF = dataRow[column.ColumnName].ToString(); break; case "ClassG": ClassG = dataRow[column.ColumnName].ToString(); break; case "ClassH": ClassH = dataRow[column.ColumnName].ToString(); break; case "ClassI": ClassI = dataRow[column.ColumnName].ToString(); break; case "ClassJ": ClassJ = dataRow[column.ColumnName].ToString(); break; case "ClassK": ClassK = dataRow[column.ColumnName].ToString(); break; case "ClassL": ClassL = dataRow[column.ColumnName].ToString(); break; case "ClassM": ClassM = dataRow[column.ColumnName].ToString(); break; case "ClassN": ClassN = dataRow[column.ColumnName].ToString(); break; case "ClassO": ClassO = dataRow[column.ColumnName].ToString(); break; case "ClassP": ClassP = dataRow[column.ColumnName].ToString(); break; case "ClassQ": ClassQ = dataRow[column.ColumnName].ToString(); break; case "ClassR": ClassR = dataRow[column.ColumnName].ToString(); break; case "ClassS": ClassS = dataRow[column.ColumnName].ToString(); break; case "ClassT": ClassT = dataRow[column.ColumnName].ToString(); break; case "ClassU": ClassU = dataRow[column.ColumnName].ToString(); break; case "ClassV": ClassV = dataRow[column.ColumnName].ToString(); break; case "ClassW": ClassW = dataRow[column.ColumnName].ToString(); break; case "ClassX": ClassX = dataRow[column.ColumnName].ToString(); break; case "ClassY": ClassY = dataRow[column.ColumnName].ToString(); break; case "ClassZ": ClassZ = dataRow[column.ColumnName].ToString(); break; case "NumA": NumA = dataRow[column.ColumnName].ToDecimal(); break; case "NumB": NumB = dataRow[column.ColumnName].ToDecimal(); break; case "NumC": NumC = dataRow[column.ColumnName].ToDecimal(); break; case "NumD": NumD = dataRow[column.ColumnName].ToDecimal(); break; case "NumE": NumE = dataRow[column.ColumnName].ToDecimal(); break; case "NumF": NumF = dataRow[column.ColumnName].ToDecimal(); break; case "NumG": NumG = dataRow[column.ColumnName].ToDecimal(); break; case "NumH": NumH = dataRow[column.ColumnName].ToDecimal(); break; case "NumI": NumI = dataRow[column.ColumnName].ToDecimal(); break; case "NumJ": NumJ = dataRow[column.ColumnName].ToDecimal(); break; case "NumK": NumK = dataRow[column.ColumnName].ToDecimal(); break; case "NumL": NumL = dataRow[column.ColumnName].ToDecimal(); break; case "NumM": NumM = dataRow[column.ColumnName].ToDecimal(); break; case "NumN": NumN = dataRow[column.ColumnName].ToDecimal(); break; case "NumO": NumO = dataRow[column.ColumnName].ToDecimal(); break; case "NumP": NumP = dataRow[column.ColumnName].ToDecimal(); break; case "NumQ": NumQ = dataRow[column.ColumnName].ToDecimal(); break; case "NumR": NumR = dataRow[column.ColumnName].ToDecimal(); break; case "NumS": NumS = dataRow[column.ColumnName].ToDecimal(); break; case "NumT": NumT = dataRow[column.ColumnName].ToDecimal(); break; case "NumU": NumU = dataRow[column.ColumnName].ToDecimal(); break; case "NumV": NumV = dataRow[column.ColumnName].ToDecimal(); break; case "NumW": NumW = dataRow[column.ColumnName].ToDecimal(); break; case "NumX": NumX = dataRow[column.ColumnName].ToDecimal(); break; case "NumY": NumY = dataRow[column.ColumnName].ToDecimal(); break; case "NumZ": NumZ = dataRow[column.ColumnName].ToDecimal(); break; case "DateA": DateA = dataRow[column.ColumnName].ToDateTime(); break; case "DateB": DateB = dataRow[column.ColumnName].ToDateTime(); break; case "DateC": DateC = dataRow[column.ColumnName].ToDateTime(); break; case "DateD": DateD = dataRow[column.ColumnName].ToDateTime(); break; case "DateE": DateE = dataRow[column.ColumnName].ToDateTime(); break; case "DateF": DateF = dataRow[column.ColumnName].ToDateTime(); break; case "DateG": DateG = dataRow[column.ColumnName].ToDateTime(); break; case "DateH": DateH = dataRow[column.ColumnName].ToDateTime(); break; case "DateI": DateI = dataRow[column.ColumnName].ToDateTime(); break; case "DateJ": DateJ = dataRow[column.ColumnName].ToDateTime(); break; case "DateK": DateK = dataRow[column.ColumnName].ToDateTime(); break; case "DateL": DateL = dataRow[column.ColumnName].ToDateTime(); break; case "DateM": DateM = dataRow[column.ColumnName].ToDateTime(); break; case "DateN": DateN = dataRow[column.ColumnName].ToDateTime(); break; case "DateO": DateO = dataRow[column.ColumnName].ToDateTime(); break; case "DateP": DateP = dataRow[column.ColumnName].ToDateTime(); break; case "DateQ": DateQ = dataRow[column.ColumnName].ToDateTime(); break; case "DateR": DateR = dataRow[column.ColumnName].ToDateTime(); break; case "DateS": DateS = dataRow[column.ColumnName].ToDateTime(); break; case "DateT": DateT = dataRow[column.ColumnName].ToDateTime(); break; case "DateU": DateU = dataRow[column.ColumnName].ToDateTime(); break; case "DateV": DateV = dataRow[column.ColumnName].ToDateTime(); break; case "DateW": DateW = dataRow[column.ColumnName].ToDateTime(); break; case "DateX": DateX = dataRow[column.ColumnName].ToDateTime(); break; case "DateY": DateY = dataRow[column.ColumnName].ToDateTime(); break; case "DateZ": DateZ = dataRow[column.ColumnName].ToDateTime(); break; case "DescriptionA": DescriptionA = dataRow[column.ColumnName].ToString(); break; case "DescriptionB": DescriptionB = dataRow[column.ColumnName].ToString(); break; case "DescriptionC": DescriptionC = dataRow[column.ColumnName].ToString(); break; case "DescriptionD": DescriptionD = dataRow[column.ColumnName].ToString(); break; case "DescriptionE": DescriptionE = dataRow[column.ColumnName].ToString(); break; case "DescriptionF": DescriptionF = dataRow[column.ColumnName].ToString(); break; case "DescriptionG": DescriptionG = dataRow[column.ColumnName].ToString(); break; case "DescriptionH": DescriptionH = dataRow[column.ColumnName].ToString(); break; case "DescriptionI": DescriptionI = dataRow[column.ColumnName].ToString(); break; case "DescriptionJ": DescriptionJ = dataRow[column.ColumnName].ToString(); break; case "DescriptionK": DescriptionK = dataRow[column.ColumnName].ToString(); break; case "DescriptionL": DescriptionL = dataRow[column.ColumnName].ToString(); break; case "DescriptionM": DescriptionM = dataRow[column.ColumnName].ToString(); break; case "DescriptionN": DescriptionN = dataRow[column.ColumnName].ToString(); break; case "DescriptionO": DescriptionO = dataRow[column.ColumnName].ToString(); break; case "DescriptionP": DescriptionP = dataRow[column.ColumnName].ToString(); break; case "DescriptionQ": DescriptionQ = dataRow[column.ColumnName].ToString(); break; case "DescriptionR": DescriptionR = dataRow[column.ColumnName].ToString(); break; case "DescriptionS": DescriptionS = dataRow[column.ColumnName].ToString(); break; case "DescriptionT": DescriptionT = dataRow[column.ColumnName].ToString(); break; case "DescriptionU": DescriptionU = dataRow[column.ColumnName].ToString(); break; case "DescriptionV": DescriptionV = dataRow[column.ColumnName].ToString(); break; case "DescriptionW": DescriptionW = dataRow[column.ColumnName].ToString(); break; case "DescriptionX": DescriptionX = dataRow[column.ColumnName].ToString(); break; case "DescriptionY": DescriptionY = dataRow[column.ColumnName].ToString(); break; case "DescriptionZ": DescriptionZ = dataRow[column.ColumnName].ToString(); break; case "CheckA": CheckA = dataRow[column.ColumnName].ToBool(); break; case "CheckB": CheckB = dataRow[column.ColumnName].ToBool(); break; case "CheckC": CheckC = dataRow[column.ColumnName].ToBool(); break; case "CheckD": CheckD = dataRow[column.ColumnName].ToBool(); break; case "CheckE": CheckE = dataRow[column.ColumnName].ToBool(); break; case "CheckF": CheckF = dataRow[column.ColumnName].ToBool(); break; case "CheckG": CheckG = dataRow[column.ColumnName].ToBool(); break; case "CheckH": CheckH = dataRow[column.ColumnName].ToBool(); break; case "CheckI": CheckI = dataRow[column.ColumnName].ToBool(); break; case "CheckJ": CheckJ = dataRow[column.ColumnName].ToBool(); break; case "CheckK": CheckK = dataRow[column.ColumnName].ToBool(); break; case "CheckL": CheckL = dataRow[column.ColumnName].ToBool(); break; case "CheckM": CheckM = dataRow[column.ColumnName].ToBool(); break; case "CheckN": CheckN = dataRow[column.ColumnName].ToBool(); break; case "CheckO": CheckO = dataRow[column.ColumnName].ToBool(); break; case "CheckP": CheckP = dataRow[column.ColumnName].ToBool(); break; case "CheckQ": CheckQ = dataRow[column.ColumnName].ToBool(); break; case "CheckR": CheckR = dataRow[column.ColumnName].ToBool(); break; case "CheckS": CheckS = dataRow[column.ColumnName].ToBool(); break; case "CheckT": CheckT = dataRow[column.ColumnName].ToBool(); break; case "CheckU": CheckU = dataRow[column.ColumnName].ToBool(); break; case "CheckV": CheckV = dataRow[column.ColumnName].ToBool(); break; case "CheckW": CheckW = dataRow[column.ColumnName].ToBool(); break; case "CheckX": CheckX = dataRow[column.ColumnName].ToBool(); break; case "CheckY": CheckY = dataRow[column.ColumnName].ToBool(); break; case "CheckZ": CheckZ = dataRow[column.ColumnName].ToBool(); break; case "Comments": Comments = dataRow[column.ColumnName].ToString().Deserialize <Comments>() ?? new Comments(); break; case "Creator": Creator = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "Updator": Updator = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName)); break; case "CreatedTime": CreatedTime = new Time(context, dataRow, column.ColumnName); break; } } } }