public override string ToString() { return(Rescuer.Imie + " " + Rescuer.Nazwisko + " Od: " + StartTime.ToShortTimeString() + " Do: " + EndTime.ToShortTimeString()); }
/// <summary> /// Adds the XML representation of the result as a child of the /// supplied parent node.. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="recursive">If true, descendant results are included</param> /// <returns></returns> public virtual TNode AddToXml(TNode parentNode, bool recursive) { // A result node looks like a test node with extra info added TNode thisNode = this.Test.AddToXml(parentNode, false); thisNode.AddAttribute("result", ResultState.Status.ToString()); if (ResultState.Label != string.Empty) // && ResultState.Label != ResultState.Status.ToString()) { thisNode.AddAttribute("label", ResultState.Label); } if (ResultState.Site != FailureSite.Test) { thisNode.AddAttribute("site", ResultState.Site.ToString()); } thisNode.AddAttribute("start-time", StartTime.ToString("u")); thisNode.AddAttribute("end-time", EndTime.ToString("u")); thisNode.AddAttribute("duration", Duration.ToString("0.000000", NumberFormatInfo.InvariantInfo)); if (this.Test is TestSuite) { thisNode.AddAttribute("total", (PassCount + FailCount + SkipCount + InconclusiveCount).ToString()); thisNode.AddAttribute("passed", PassCount.ToString()); thisNode.AddAttribute("failed", FailCount.ToString()); thisNode.AddAttribute("inconclusive", InconclusiveCount.ToString()); thisNode.AddAttribute("skipped", SkipCount.ToString()); } thisNode.AddAttribute("asserts", this.AssertCount.ToString()); switch (ResultState.Status) { case TestStatus.Failed: AddFailureElement(thisNode); break; case TestStatus.Skipped: AddReasonElement(thisNode); break; case TestStatus.Passed: case TestStatus.Inconclusive: if (this.Message != null) { AddReasonElement(thisNode); } break; } if (Output.Length > 0) { AddOutputElement(thisNode); } if (recursive && HasChildren) { foreach (TestResult child in Children) { child.AddToXml(thisNode, recursive); } } return(thisNode); }
public bool IsVisible(DateTime currentTime) { return(Tour.IsOpen && EndTime.CompareTo(currentTime) > 0); }
/// <summary> /// 将日期、各种编码,编码进frame /// </summary> /// <param name="frame"></param> /// <param name="isSequence"></param> internal override void Encode(Frame frame, bool isSequence = false) { //不编码地址,直接编码内容 frame.AppendBytes(BeginTime.GetEncodedValue()); frame.AppendBytes(EndTime.GetEncodedValue()); }
protected override void OnBarUpdate() { calcCumDelta(); if (BarsInProgress != 0) { return; } if (CurrentBars[0] < 0) { return; } calcVolumeSwings(); if (CurrentBar > 34) { double theLows = MIN(Low, 120)[0]; CumSma[0] = theLows - TickSize * 8; calcBressert(); } tradeStatsShorts(); tradeStatsLong(); // if eod, get daily sum DateTime endOfDay = DateTime.Parse("23:00", System.Globalization.CultureInfo.InvariantCulture); if (ToTime(Time[0]) > ToTime(endOfDay) && ToTime(Time[1]) < ToTime(endOfDay)) { Draw.VerticalLine(this, "MyVerticalLine" + CurrentBar, 0, Brushes.White); dailySumArr.Add(dailySum); dailySum = 0; systemOff = false; } if (CurrentBar < Count - 2) { return; } if (dailySumArr.Count > 0) { Print("---------------"); foreach (int i in dailySumArr) { Print(i); } dailyAvg = Convert.ToInt16(dailySumArr.Average()); Print("daily avg: " + dailyAvg); Print("---------------"); } if (CalcStats) { string statsSring = "SYSTEM STATISTICS\n\n" + "gain " + MaxGain + " loss " + MaxLoss + "\ntarget " + TargetTicks + " stop " + StopTicks + "\n" + StartTime.ToShortTimeString() + " - " + EndTime.ToShortTimeString() + "\n\n" + messageL + "\n\n" + messageS + "\n" + "daily avg: " + dailyAvg; Draw.TextFixed(this, "myStatsFixed", statsSring, NoteLocation, FontColor, // text color NoteFont, OutlineColor, // outline color BackgroundColor, BackgroundOpacity); } }
/// <summary> /// Gets the width of a one day skill queue. /// </summary> /// <param name="width">The width.</param> /// <returns></returns> public double GetOneDaySkillQueueWidth(int width) { double totalSeconds = EndTime.Subtract(DateTime.UtcNow).TotalSeconds; return(Math.Floor(WarningThresholdTimeSpan.TotalSeconds / totalSeconds * width)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Class != null) { hashCode = hashCode * 59 + Class.GetHashCode(); } if (Artifacts != null) { hashCode = hashCode * 59 + Artifacts.GetHashCode(); } if (DurationInMillis != null) { hashCode = hashCode * 59 + DurationInMillis.GetHashCode(); } if (EstimatedDurationInMillis != null) { hashCode = hashCode * 59 + EstimatedDurationInMillis.GetHashCode(); } if (EnQueueTime != null) { hashCode = hashCode * 59 + EnQueueTime.GetHashCode(); } if (EndTime != null) { hashCode = hashCode * 59 + EndTime.GetHashCode(); } if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Organization != null) { hashCode = hashCode * 59 + Organization.GetHashCode(); } if (Pipeline != null) { hashCode = hashCode * 59 + Pipeline.GetHashCode(); } if (Result != null) { hashCode = hashCode * 59 + Result.GetHashCode(); } if (RunSummary != null) { hashCode = hashCode * 59 + RunSummary.GetHashCode(); } if (StartTime != null) { hashCode = hashCode * 59 + StartTime.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (CommitId != null) { hashCode = hashCode * 59 + CommitId.GetHashCode(); } return(hashCode); } }
/// <summary> /// 获取两个时间之间的天数 /// </summary> /// <returns></returns> public int GetDays() { return(Convert.ToInt(EndTime.Subtract(StartTime).TotalDays)); }
/// <summary> /// 获取两个时间之间的小时数 /// </summary> /// <returns></returns> public int GetHours() { return(Convert.ToInt(EndTime.Subtract(StartTime).TotalHours)); }
private IReadOnlyDictionary <string, string> GetProperties(DiscordClient client, WhConfig whConfig, string city) { var pkmnInfo = Database.Instance.Pokemon[PokemonId]; var form = PokemonId.GetPokemonForm(Form.ToString()); var gender = Gender.GetPokemonGenderIcon(); var level = Level; //var weather = raid.Weather?.ToString(); //var weatherEmoji = string.Empty; //if (raid.Weather.HasValue && Strings.WeatherEmojis.ContainsKey(raid.Weather.Value) && raid.Weather != WeatherType.None) //{ // var isWeatherBoosted = pkmnInfo.IsWeatherBoosted(raid.Weather.Value); // var isWeatherBoostedText = isWeatherBoosted ? " (Boosted)" : null; // weatherEmoji = Strings.WeatherEmojis[raid.Weather.Value] + isWeatherBoostedText; //} var move1 = string.Empty; var move2 = string.Empty; if (MasterFile.Instance.Movesets.ContainsKey(FastMove)) { move1 = MasterFile.Instance.Movesets[FastMove].Name; } if (MasterFile.Instance.Movesets.ContainsKey(ChargeMove)) { move2 = MasterFile.Instance.Movesets[ChargeMove].Name; } var type1 = pkmnInfo?.Types?[0]; var type2 = pkmnInfo?.Types?.Count > 1 ? pkmnInfo?.Types?[1] : PokemonType.None; var type1Emoji = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) ? pkmnInfo?.Types?[0].GetTypeEmojiIcons(client.Guilds[whConfig.Discord.EmojiGuildId]) : string.Empty; var type2Emoji = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) && pkmnInfo?.Types?.Count > 1 ? pkmnInfo?.Types?[1].GetTypeEmojiIcons(client.Guilds[whConfig.Discord.EmojiGuildId]) : string.Empty; var typeEmojis = $"{type1Emoji} {type2Emoji}"; var weaknesses = Weaknesses == null ? string.Empty : string.Join(", ", Weaknesses); var weaknessesEmoji = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) ? Weaknesses.GetWeaknessEmojiIcons(client.Guilds[whConfig.Discord.EmojiGuildId]) : string.Empty; var weaknessesEmojiFormatted = weaknessesEmoji; var perfectRange = PokemonId.MaxCpAtLevel(20); var boostedRange = PokemonId.MaxCpAtLevel(25); var worstRange = PokemonId.MinCpAtLevel(20); var worstBoosted = PokemonId.MinCpAtLevel(25); var exEmojiId = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) ? client.Guilds[whConfig.Discord.EmojiGuildId].GetEmojiId("ex") : 0; var exEmoji = exEmojiId > 0 ? $"<:ex:{exEmojiId}>" : "EX"; var teamEmojiId = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) ? client.Guilds[whConfig.Discord.EmojiGuildId].GetEmojiId(Team.ToString().ToLower()) : 0; var teamEmoji = teamEmojiId > 0 ? $"<:{Team.ToString().ToLower()}:{teamEmojiId}>" : Team.ToString(); var pkmnImage = IsEgg ? string.Format(whConfig.Urls.EggImage, Level) : PokemonId.GetPokemonImage(whConfig.Urls.PokemonImage, PokemonGender.Unset, Form); var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var staticMapLink = Utils.PrepareStaticMapUrl(whConfig.Urls.StaticMap, pkmnImage, Latitude, Longitude); var gmapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? gmapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? appleMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? wazeMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Raid boss properties { "pkmn_id", PokemonId.ToString() }, { "pkmn_name", pkmnInfo.Name }, { "pkmn_img_url", pkmnImage }, { "form", form }, { "form_id", Form.ToString() }, { "form_id_3", Form.ToString("D3") }, { "is_egg", Convert.ToString(IsEgg) }, { "is_ex", Convert.ToString(IsExEligible) }, { "ex_emoji", exEmoji }, { "team", Team.ToString() }, { "team_emoji", teamEmoji }, { "cp", CP ?? defaultMissingValue }, { "lvl", level ?? defaultMissingValue }, { "gender", gender ?? defaultMissingValue }, { "move_1", move1 ?? defaultMissingValue }, { "move_2", move2 ?? defaultMissingValue }, { "moveset", $"{move1}/{move2}" }, { "type_1", type1?.ToString() ?? defaultMissingValue }, { "type_2", type2?.ToString() ?? defaultMissingValue }, { "type_1_emoji", type1Emoji }, { "type_2_emoji", type2Emoji }, { "types", $"{type1}/{type2}" }, { "types_emoji", typeEmojis }, { "weaknesses", weaknesses }, { "weaknesses_emoji", weaknessesEmojiFormatted }, { "perfect_cp", perfectRange.ToString() }, { "perfect_cp_boosted", boostedRange.ToString() }, { "worst_cp", worstRange.ToString() }, { "worst_cp_boosted", worstBoosted.ToString() }, //Time properties { "start_time", StartTime.ToLongTimeString() }, { "start_time_left", DateTime.Now.GetTimeRemaining(StartTime).ToReadableStringNoSeconds() }, { "end_time", EndTime.ToLongTimeString() }, { "end_time_left", EndTime.GetTimeRemaining().ToReadableStringNoSeconds() }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Math.Round(Latitude, 5).ToString() }, { "lng_5", Math.Round(Longitude, 5).ToString() }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, //Gym properties { "gym_id", GymId }, { "gym_name", GymName }, { "gym_url", GymUrl }, //Misc properties { "br", "\r\n" } }; return(dict); }
//查询sync表 private void SelectSync(object parameter) { try { SyncInfos.Clear(); // 获取已选择的任务 List_AllChoose.Clear(); TaskInfos.ForEach((x) => { if (x.IsChecked) { List_AllChoose.Add(x.ServiceId); } }); if (List_AllChoose.Count == 0) { Notice.Show("请至少选择一项任务搜索", "错误", 3, MessageBoxIcon.Error); return; } // 已选择的任务和park_Base的表取交集 List_ParkBaseChoose = List_ParkBase.Intersect(List_AllChoose).ToList <string>(); // 总的已选择的和选择的park_Base取差集 List_SyncChoose = List_AllChoose.Except(List_ParkBaseChoose).ToList <string>(); string sql_xmpp = $"SELECT AddTime,protocoldata,status,remark,failmessage,updatetime from sync_xmpp_history "; string sql_base = $"SELECT AddTime,protocoldata,status,remark from sync_park_base_history "; //根据protocol数据筛选查询 不允许为空 if (!string.IsNullOrEmpty(SelectLike)) { if (SelectLike.Trim() == "") { Notice.Show("筛选数据条件不允许为空", "错误", 3, MessageBoxIcon.Error); return; } sql_xmpp += "where protocoldata like '%" + SelectLike + "%' "; sql_base += "where protocoldata like '%" + SelectLike + "%' "; } else { Notice.Show("筛选数据条件不允许为空", "错误", 3, MessageBoxIcon.Error); return; } //根据时间筛选查询 if (EndTime < StartTime) { Notice.Show("结束时间不能比开始时间早", "错误", 3, MessageBoxIcon.Error); return; } sql_xmpp += "and addtime between '" + StartTime.ToString() + "' and '" + EndTime.ToString() + "' "; sql_base += "and addtime between '" + StartTime.ToString() + "' and '" + EndTime.ToString() + "' "; //根据任务筛选in string xmpptask = ""; if (List_SyncChoose.Count >= 1) { List_SyncChoose.ForEach((x) => { xmpptask += "'" + x + "',"; }); xmpptask = xmpptask.Substring(0, xmpptask.Length - 1); } else { xmpptask = "''"; } sql_xmpp += "and serviceid in (" + xmpptask + ") "; string basetask = ""; if (List_ParkBaseChoose.Count >= 1) { List_ParkBaseChoose.ForEach((x) => { basetask += "'" + x + "',"; }); basetask = basetask.Substring(0, basetask.Length - 1); } else { basetask = "''"; } sql_base += "and serviceid in (" + basetask + ") "; //根据ID排序 sql_xmpp += "ORDER BY id desc "; sql_base += "ORDER BY id desc "; //根据limit限制 if (limit10) { sql_xmpp += "limit 10 "; sql_base += "limit 10 "; } else if (limit20) { sql_xmpp += "limit 20 "; sql_base += "limit 20 "; } else if (limit50) { sql_xmpp += "limit 50 "; sql_base += "limit 50"; } else if (limit100) { sql_xmpp += "limit 100 "; sql_base += "limit 100 "; } else { return; } //sync_xmpp_history表里查询 LogHelper.CommLogger.Info("查询上传执行的SQL语句(sync_xmpp_history):" + sql_xmpp.Replace(",failmessage,updatetime", "")); DataTable dt = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql_xmpp.Replace(",failmessage,updatetime", "")).Tables[0];//获取所有的表 foreach (DataRow dr in dt.Rows) { SyncInfo syncinfo = new SyncInfo { AddTime = dr["AddTime"].ToString(), ProtocolData = dr["protocoldata"].ToString(), status = dr["status"].ToString(), remark = dr["remark"].ToString(), failmessage = "", updatetime = "" }; SyncInfos.Add(syncinfo); } //sync_xmpp表里查询 string sql2 = sql_xmpp.Replace("sync_xmpp_history", "sync_xmpp"); LogHelper.CommLogger.Info("查询上传执行的SQL语句(sync_xmpp):" + sql2); DataTable dt2 = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql2).Tables[0];//获取所有的表 foreach (DataRow dr in dt2.Rows) { SyncInfo syncinfo = new SyncInfo { AddTime = dr["AddTime"].ToString(), ProtocolData = dr["protocoldata"].ToString(), status = dr["status"].ToString(), remark = dr["remark"].ToString(), failmessage = dr["failmessage"].ToString(), updatetime = dr["updatetime"].ToString() }; SyncInfos.Add(syncinfo); } // 在sync_park_base_history表里查询 // 怎么sync_park_base_history结构还和sync_xmpp不一样的 LogHelper.CommLogger.Info("查询上传执行的SQL语句(sync_park_base_history):" + sql_base); DataTable dt3 = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql_base).Tables[0];//获取所有的表 foreach (DataRow dr in dt3.Rows) { SyncInfo syncinfo = new SyncInfo { AddTime = dr["AddTime"].ToString(), ProtocolData = dr["protocoldata"].ToString(), status = dr["status"].ToString(), remark = dr["remark"].ToString(), failmessage = "", updatetime = "" }; SyncInfos.Add(syncinfo); } if (SyncInfos.Count == 0) { Notice.Show("搜索完成,未找到结果", "提示", 3, MessageBoxIcon.Info); } else { Notice.Show("搜索完成,共计找到" + SyncInfos.Count + "条结果", "提示", 3, MessageBoxIcon.Info); } GC.Collect(); } catch (Exception ex) { LogHelper.CommLogger.Error(ex.ToString()); throw; } }
private string GenerateDisplayTime() { return(StartTime.ToString("HH:mm") + " - " + EndTime.ToString("HH:mm")); }
protected void btnSave_Click(object sender, EventArgs e) { GetAdminConfirmDate(); if (!string.IsNullOrEmpty(DateReturn.ToString())) { Groomer objGroomer = new Groomer(); DataSet dsseq = new DataSet(); DataSet ds4 = new DataSet(); string ApptString = txtOthers.Text; if (ApptString.Contains('!')) { string[] getId = ApptString.Split('!'); string tempappid = getId[1]; UserAppId = (tempappid == "") ? 0 : Convert.ToInt32(tempappid); } dsseq = objGroomer.GetMaxSequencenoOfGroomer(Convert.ToInt32(ddlGroomerlist.SelectedValue), DateReturn.ToString()); #region 1 if (dsseq.Tables[0].Rows.Count > 0) { if (Convert.ToInt32(txtSequence.Text) > Convert.ToInt32(dsseq.Tables[0].Rows[0]["sequence"])) { //ErrorMessage("Please enter sequence no in proper order."); lblDoubleBook.Visible = true; txtSequence.Text = dsseq.Tables[0].Rows[0]["sequence"].ToString(); } else { //Get Next groomer sequence and update the sequence and then insert new appointment // ds4 = objGroomer.GetGroomerNextsequenceForupdate(Convert.ToInt32(dsseq.Tables[0].Rows[0]["GId"]), Session["SelectedDate"].ToString(), Convert.ToInt32(txtSequence.Text)); ds4 = objGroomer.GetGroomerNextsequenceForupdate(Convert.ToInt32(dsseq.Tables[0].Rows[0]["GId"]), Convert.ToDateTime(DateReturn.ToString()), Convert.ToInt32(txtSequence.Text)); if (ds4.Tables[0].Rows.Count > 0) { for (int m = 0; m < ds4.Tables[0].Rows.Count; m++) { int h = Convert.ToInt32(ds4.Tables[0].Rows[m]["SequenceNo"]) + 1; objGroomer.UpdateGroomerSequence(Convert.ToInt32(ds4.Tables[0].Rows[0]["GId"]), Convert.ToDateTime(Session["SelectedDate"]), h, Convert.ToInt32(ds4.Tables[0].Rows[m]["AppointmentId"])); } } int i = objGroomer.AddGroomerAppointmentByAdmin(Convert.ToInt32(ddlGroomerlist.SelectedValue), Convert.ToDateTime(DateReturn), "", "", txtTotalRevnueExpected.Text, txtOthers.Text, txtDate.Text, Convert.ToInt32(txtSequence.Text), Convert.ToDecimal(txtExpectedpettime.Text), txtCustomerName.Text, txtCustEmail.Text, StartTime.ToString(), EndTime.ToString());//, breakAppt, txtBreakPeriod.Text); if (i > 0) { // MakeRecConfirmAppointment(i, txtOthers.Text); Response.Redirect("ViewGroomerAppointment.aspx"); } } } #endregion 1 if #region 2 else else { if (Convert.ToInt32(txtSequence.Text) == 1) { txtSequence.Text = "1"; int i = objGroomer.AddGroomerAppointmentByAdmin(Convert.ToInt32(ddlGroomerlist.SelectedValue), Convert.ToDateTime(DateReturn.ToString()), "", "", txtTotalRevnueExpected.Text, txtOthers.Text, txtDate.Text, Convert.ToInt32(txtSequence.Text), Convert.ToDecimal(txtExpectedpettime.Text), txtCustomerName.Text, txtCustEmail.Text, StartTime.ToString(), EndTime.ToString());//, breakAppt, txtBreakPeriod.Text); if (i > 0) { // MakeRecConfirmAppointment(i, txtOthers.Text); Response.Redirect("ViewGroomerAppointment.aspx"); } } else { ErrorMessage("Please enter sequence no in proper order."); } } #endregion 2 else } else { ErrorMessage("Please Follow Military date format and enter time in proper order. "); txtDate.Focus(); } }
public void WriteXml(XmlWriter writer) { //------Always log these for reconstruction------------ writer.WriteAttributeString("DisplayName", DisplayName); writer.WriteAttributeString("ID", ID.ToString()); writer.WriteAttributeString("OriginalInstanceID", OriginalInstanceID.ToString()); writer.WriteAttributeString("ParentID", ParentID.ToString()); writer.WriteAttributeString("ServerID", ServerID.ToString()); writer.WriteAttributeString("StateType", StateType.ToString()); writer.WriteElementString("HasError", HasError.ToString()); writer.WriteAttributeString("SessionID", SessionID.ToString()); if (HasError) { writer.WriteElementString("ErrorMessage", ErrorMessage); } //----------------------------- var settings = WorkflowLoggger.LoggingSettings; //Version if (settings.IsVersionLogged && !string.IsNullOrWhiteSpace(Version)) { writer.WriteElementString("Version", Version); } //Type if (settings.IsTypeLogged) { writer.WriteElementString("Name", Name); writer.WriteElementString("ActivityType", ActivityType.ToString()); } //Duration if (settings.IsDurationLogged) { if (Duration != default(TimeSpan)) { writer.WriteElementString("Duration", DurationString); } } //DateTime if (settings.IsDataAndTimeLogged) { if (StartTime != DateTime.MinValue) { writer.WriteElementString("StartTime", StartTime.ToString("G")); } if (EndTime != DateTime.MinValue) { writer.WriteElementString("EndTime", EndTime.ToString("G")); } } //Input if (settings.IsInputLogged && Inputs.Count > 0) { writer.WriteStartElement("Inputs"); writer.WriteAttributeString("Count", Inputs.Count.ToString(CultureInfo.InvariantCulture)); var inputSer = new XmlSerializer(typeof(DebugItem)); foreach (var other in Inputs) { inputSer.Serialize(writer, other); } writer.WriteEndElement(); } //Output if (settings.IsOutputLogged && Outputs.Count > 0) { writer.WriteStartElement("Outputs"); writer.WriteAttributeString("Count", Outputs.Count.ToString(CultureInfo.InvariantCulture)); var outputSer = new XmlSerializer(typeof(DebugItem)); foreach (var other in Outputs) { outputSer.Serialize(writer, other); } writer.WriteEndElement(); } //StartBlock if (IsFirstStep()) { if (ExecutionOrigin != ExecutionOrigin.Unknown) { writer.WriteElementString("ExecutionOrigin", ExecutionOrigin.ToString()); } if (!string.IsNullOrWhiteSpace(ExecutingUser)) { writer.WriteElementString("ExecutingUser", ExecutingUser); } } //EndBlock if (IsFinalStep()) { writer.WriteElementString("NumberOfSteps", NumberOfSteps.ToString(CultureInfo.InvariantCulture)); } }
/// <summary> /// Serializes this instance. /// </summary> public virtual void Serialize() { TimeSpan elapsed = EndTime.Subtract(StartTime); // log only if available if (!string.IsNullOrEmpty(ClientProfile.SessionId)) { Logger.Info(string.Format("{0,-18} : {1}", "Id", ClientProfile.SessionId)); } if (!string.IsNullOrEmpty(ClientProfile.UserId.ToString())) { Logger.Info(string.Format("{0,-18} : {1}", "UserId", ClientProfile.UserId)); } if (!string.IsNullOrEmpty(ClientProfile.UserName)) { Logger.Info(string.Format("{0,-18} : {1}", "UserName", ClientProfile.UserName)); } if (!string.IsNullOrEmpty(ClientProfile.ClientApplication)) { Logger.Info(string.Format("{0,-18} : {1}", "ClientApplication", ClientProfile.ClientApplication)); } if (!string.IsNullOrEmpty(ClientProfile.ClientMachineName)) { Logger.Info(string.Format("{0,-18} : {1}", "ClientMachineName", ClientProfile.ClientMachineName)); } if (!LogTask.ShowOnlyElapsedTime) { Logger.Info(string.Format("{0,-18} : {1}", "Start Time", StartTime.ToLongTimeString())); Logger.Info(string.Format("{0,-18} : {1}", "End Time", EndTime.ToLongTimeString())); } Logger.Info(string.Format("{0,-18} : {1} ms", "Elapsed Time", elapsed.TotalMilliseconds)); Fields.ForEach(item => { if (null != item) { Logger.Info(string.Format("{0,-18} : {1}", item.Name, item.Value)); } } ); if (EnableReportLog) { // Serialize the logs for Test Reports LogField nameField = Fields.Find(item => String.Compare(item.Name, "UserName", StringComparison.OrdinalIgnoreCase) == 0); string userName = (null != nameField) ? nameField.Value : ClientProfile.SessionId; string reportLog = string.Format("{0,-40} | {1,-12} | {2,-12} | {3,-12}", userName, StartTime.ToLongTimeString(), EndTime.ToLongTimeString(), elapsed.TotalMilliseconds); ReportLog.Dump(" "); ReportLog.Dump(" "); ReportLog.Dump(reportLog); } if (EnableDumpStatistics) { CollectStatistics(); } SerializeTasks(); }
/// <summary> /// 获取两个时间之间的分钟数 /// </summary> /// <returns></returns> public int GetMinutes() { return(Convert.ToInt(EndTime.Subtract(StartTime).TotalMinutes)); }
public void FixData(DateTime previousEndTime) { if (Clan != null) { ID = EndTime.ToUniversalTime().ToString("yyyyMMddTHHmmss") + Clan.Tag; ClanTag = Clan.Tag; ClanName = Clan.Name; ClanLevel = Clan.ClanLevel; ClanStars = Clan.Stars; ClanDestructionPercentage = Clan.DestructionPercentage; ClanAttacks = Clan.Attacks; ClanExpEarned = Clan.ExpEarned; if (Clan.BadgeUrls != null) { ClanBadgeUrl = Clan.BadgeUrls.Small; } ICollection <WarMember> opponentMembers = null; if (Opponent != null && Opponent.Members != null) { opponentMembers = Opponent.Members; } else { opponentMembers = new List <WarMember>(); } if (Clan.Members != null && Opponent.Members != null) { FixMembers(Clan.Members, Opponent.Members, false); FixMembers(Opponent.Members, Clan.Members, true); } } if (Opponent != null) { OpponentTag = Opponent.Tag; OpponentName = Opponent.Name; OpponentLevel = Opponent.ClanLevel; OpponentStars = Opponent.Stars; OpponentDestructionPercentage = Opponent.DestructionPercentage; if (Opponent.BadgeUrls != null) { OpponentBadgeUrl = Opponent.BadgeUrls.Small; } } if (string.IsNullOrEmpty(Result) && !string.IsNullOrEmpty(State)) { Result = State; } var timeSincePreviousWar = EndTime.Subtract(previousEndTime); if (ClanExpEarned == 0 && ClanStars > 0 && string.IsNullOrEmpty(State)) { Friendly = true; } else if (timeSincePreviousWar.TotalHours <= 47.0 && timeSincePreviousWar.TotalMinutes > 1) { Friendly = true; } }
/// <summary> /// 获取两个时间之间的毫秒数 /// </summary> /// <returns></returns> public int GetMilliseconds() { return(Convert.ToInt(EndTime.Subtract(StartTime).TotalMilliseconds)); }
/// <summary> /// Returns true if PipelineActivity instances are equal /// </summary> /// <param name="other">Instance of PipelineActivity to be compared</param> /// <returns>Boolean</returns> public bool Equals(PipelineActivity other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Artifacts == other.Artifacts || Artifacts != null && Artifacts.SequenceEqual(other.Artifacts) ) && ( DurationInMillis == other.DurationInMillis || DurationInMillis != null && DurationInMillis.Equals(other.DurationInMillis) ) && ( EstimatedDurationInMillis == other.EstimatedDurationInMillis || EstimatedDurationInMillis != null && EstimatedDurationInMillis.Equals(other.EstimatedDurationInMillis) ) && ( EnQueueTime == other.EnQueueTime || EnQueueTime != null && EnQueueTime.Equals(other.EnQueueTime) ) && ( EndTime == other.EndTime || EndTime != null && EndTime.Equals(other.EndTime) ) && ( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Organization == other.Organization || Organization != null && Organization.Equals(other.Organization) ) && ( Pipeline == other.Pipeline || Pipeline != null && Pipeline.Equals(other.Pipeline) ) && ( Result == other.Result || Result != null && Result.Equals(other.Result) ) && ( RunSummary == other.RunSummary || RunSummary != null && RunSummary.Equals(other.RunSummary) ) && ( StartTime == other.StartTime || StartTime != null && StartTime.Equals(other.StartTime) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( Type == other.Type || Type != null && Type.Equals(other.Type) ) && ( CommitId == other.CommitId || CommitId != null && CommitId.Equals(other.CommitId) )); }
protected bool Equals(ExplicitPeakBounds other) { return(StartTime.Equals(other.StartTime) && EndTime.Equals(other.EndTime) && Score.Equals(other.Score)); }
protected bool Equals(AbstractSearch other) { return(StartTime.Equals(other.StartTime) && EndTime.Equals(other.EndTime) && ProcessedFilesCount == other.ProcessedFilesCount && Phrases.SequenceEqual(other.Phrases) && this.SequenceEqual(other)); }
public TimeSpan Duration() { return(EndTime.Subtract(StartTime)); }
/// <summary> /// Returns a string that represents the current object. /// </summary> /// <returns>A string that represents the current object.</returns> public override string ToString() { return(MoonPhase.ToString() + " - " + EndTime.ToLocalTime().ToString(CultureInfo.CurrentCulture)); }
public void AddNewShareSkill() { #region Navigate to Share Skills Page // Click on Share Skills Page ShareSkills.Click(); Thread.Sleep(1000); //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); // Enter Title Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); Base.test.Log(LogStatus.Info, "Title has been successfully entered"); //Enter description Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); Base.test.Log(LogStatus.Info, "Description has been successfully entered"); //click on category dropdown menu Thread.Sleep(500); Category.Click(); Thread.Sleep(1000); //Select the category ProgrammingandTech.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category")); Thread.Sleep(1000); //Click on subcatogory drop down option Thread.Sleep(1000); SubCategory.Click(); //Select the Sub-Category option SubCategory.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory")); SubCategory.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Info, "SubCategory has been successfully entered"); QA.Click(); //Enter Tags Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Enter); Base.test.Log(LogStatus.Info, "TagName has been successfully entered"); //Select service type //ServiceTypeHourly.Click(); if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "Hourly basis service") { ServiceTypeHourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service") { ServiceTypeOneOff.Click(); } //Select Location Type //LocationTypeOnline.Click(); if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online") { LocationTypeOnline.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site") { LocationTypeOnsite.Click(); } //Click the start date StartDate.Click(); Thread.Sleep(500); //Select the date Thread.Sleep(500); StartDate.SendKeys(Keys.Backspace); StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date")); //Select the end Date Thread.Sleep(1000); EndDate.SendKeys(Keys.Backspace); EndDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Date")); //Select the Days available selectDays.Click(); Thread.Sleep(500); //Select starttime Thread.Sleep(1000); StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); //Select EndTime Thread.Sleep(1000); EndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); //Select Skill Trade Credit.Click(); Thread.Sleep(500); if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange") { RequiredSkills.Click(); RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade")); RequiredSkills.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit") { CreditAmount.Click(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount")); CreditAmount.SendKeys(Keys.Enter); //Enter credit amount // CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount")); //Select the stats // StatusActive.Click(); //Thread.Sleep(500); if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Active") { StatusActive.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Hidden") { StatusHidden.Click(); } //Save the Share Skill Thread.Sleep(500); SaveShareSkills.Click(); Thread.Sleep(500); //Verify if newShared skill is saved Thread.Sleep(3000); string ShareSkillSucess = Global.GlobalDefinitions.driver.FindElement(By.CssSelector("#listing-management-section > div:nth-child(3) > div:nth-child(2) > table > thead > tr > th:nth-child(1)")).Text; if (ShareSkillSucess == "Image") { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Saved Skill Successful"); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Saving Skill Unsuccessful"); } } }
private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string raidImageUrl) { var pkmnInfo = MasterFile.GetPokemon(PokemonId, Form); var name = IsEgg ? "Egg" /*TODO: Localize*/ : Translator.Instance.GetPokemonName(PokemonId); var form = Translator.Instance.GetFormName(Form); var costume = Translator.Instance.GetCostumeName(Costume); var evo = Translator.Instance.GetEvolutionName(Evolution); var gender = Gender.GetPokemonGenderIcon(); var level = Level; var move1 = Translator.Instance.GetMoveName(FastMove); var move2 = Translator.Instance.GetMoveName(ChargeMove); var types = pkmnInfo?.Types; var type1 = types?[0]; var type2 = types?.Count > 1 ? types?[1] : PokemonType.None; var type1Emoji = types?[0].GetTypeEmojiIcons(); var type2Emoji = pkmnInfo?.Types?.Count > 1 ? types?[1].GetTypeEmojiIcons() : string.Empty; var typeEmojis = $"{type1Emoji} {type2Emoji}"; var weaknesses = Weaknesses == null ? string.Empty : string.Join(", ", Weaknesses); var weaknessesEmoji = types?.GetWeaknessEmojiIcons(); var perfectRange = PokemonId.MaxCpAtLevel(20); var boostedRange = PokemonId.MaxCpAtLevel(25); var worstRange = PokemonId.MinCpAtLevel(20); var worstBoosted = PokemonId.MinCpAtLevel(25); var exEmojiId = MasterFile.Instance.Emojis["ex"]; var exEmoji = exEmojiId > 0 ? $"<:ex:{exEmojiId}>" : "EX"; var teamEmojiId = MasterFile.Instance.Emojis[Team.ToString().ToLower()]; var teamEmoji = teamEmojiId > 0 ? $"<:{Team.ToString().ToLower()}:{teamEmojiId}>" : Team.ToString(); var gmapsLink = string.Format(Strings.GoogleMaps, Latitude, Longitude); var appleMapsLink = string.Format(Strings.AppleMaps, Latitude, Longitude); var wazeMapsLink = string.Format(Strings.WazeMaps, Latitude, Longitude); var scannerMapsLink = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude); var templatePath = Path.Combine(whConfig.StaticMaps.TemplatesFolder, whConfig.StaticMaps.Raids.TemplateFile); var staticMapLink = Utils.GetStaticMapsUrl(templatePath, whConfig.Urls.StaticMap, whConfig.StaticMaps.Raids.ZoomLevel, Latitude, Longitude, raidImageUrl, Team); var gmapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink); var appleMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink); var wazeMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink); var scannerMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink); var address = Utils.GetAddress(city, Latitude, Longitude, whConfig); //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink); var now = DateTime.UtcNow.ConvertTimeFromCoordinates(Latitude, Longitude); var startTimeLeft = now.GetTimeRemaining(StartTime).ToReadableStringNoSeconds(); var endTimeLeft = now.GetTimeRemaining(EndTime).ToReadableStringNoSeconds(); const string defaultMissingValue = "?"; var dict = new Dictionary <string, string> { //Raid boss properties { "pkmn_id", PokemonId.ToString() }, { "pkmn_id_3", PokemonId.ToString("D3") }, { "pkmn_name", name }, { "pkmn_img_url", raidImageUrl }, { "evolution", evo }, { "evolution_id", Convert.ToInt32(Evolution).ToString() }, { "evolution_id_3", Evolution.ToString("D3") }, { "form", form }, { "form_id", Form.ToString() }, { "form_id_3", Form.ToString("D3") }, { "costume", costume }, { "costume_id", Costume.ToString() }, { "costume_id_3", Costume.ToString("D3") }, { "is_egg", Convert.ToString(IsEgg) }, { "is_ex", Convert.ToString(IsExEligible) }, { "ex_emoji", exEmoji }, { "team", Team.ToString() }, { "team_id", Convert.ToInt32(Team).ToString() }, { "team_emoji", teamEmoji }, { "cp", CP ?? defaultMissingValue }, { "lvl", level ?? defaultMissingValue }, { "gender", gender ?? defaultMissingValue }, { "move_1", move1 ?? defaultMissingValue }, { "move_2", move2 ?? defaultMissingValue }, { "moveset", $"{move1}/{move2}" }, { "type_1", type1?.ToString() ?? defaultMissingValue }, { "type_2", type2?.ToString() ?? defaultMissingValue }, { "type_1_emoji", type1Emoji }, { "type_2_emoji", type2Emoji }, { "types", $"{type1}/{type2}" }, { "types_emoji", typeEmojis }, { "weaknesses", weaknesses }, { "weaknesses_emoji", weaknessesEmoji }, { "perfect_cp", perfectRange.ToString() }, { "perfect_cp_boosted", boostedRange.ToString() }, { "worst_cp", worstRange.ToString() }, { "worst_cp_boosted", worstBoosted.ToString() }, //Time properties { "start_time", StartTime.ToLongTimeString() }, { "start_time_24h", StartTime.ToString("HH:mm:ss") }, { "start_time_left", startTimeLeft }, { "end_time", EndTime.ToLongTimeString() }, { "end_time_24h", EndTime.ToString("HH:mm:ss") }, { "end_time_left", endTimeLeft }, //Location properties { "geofence", city ?? defaultMissingValue }, { "lat", Latitude.ToString() }, { "lng", Longitude.ToString() }, { "lat_5", Latitude.ToString("0.00000") }, { "lng_5", Longitude.ToString("0.00000") }, //Location links { "tilemaps_url", staticMapLink }, { "gmaps_url", gmapsLocationLink }, { "applemaps_url", appleMapsLocationLink }, { "wazemaps_url", wazeMapsLocationLink }, { "scanmaps_url", scannerMapsLocationLink }, { "address", address?.Address }, //Gym properties { "gym_id", GymId }, { "gym_name", GymName }, { "gym_url", GymUrl }, // Discord Guild properties { "guild_name", guild?.Name }, { "guild_img_url", guild?.IconUrl }, { "date_time", DateTime.Now.ToString() }, //Misc properties { "br", "\r\n" } }; return(dict); }
public override string ToString() { return($"Thread (Start: {StartTime.ToMinutes()}, End: {EndTime.ToMinutes()}, Active: {ActiveTime.ToMinutes()})"); }
public string SaveInDatabase() { string connection = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\user1\Documents\DEVELOPER-PC.mdf;Integrated Security=True;Connect Timeout=30"; SqlConnection connectionobj = new SqlConnection(connection); string query = string.Format("INSERT INTO Task VALUES('{0}','{1}','{2}','{3}')", Title, StartTime.ToString(), EndTime.ToString(), CurrentTime.ToString()); SqlCommand command = new SqlCommand(query, connectionobj); connectionobj.Open(); int number = command.ExecuteNonQuery(); connectionobj.Close(); if (number > 0) { return("data inserted"); } else { return("something error"); } }
//对期号查询进行处理 private void IssueInquiry(string TransMessage) { System.Xml.XmlDocument XmlDoc = new XmlDocument(); XmlDoc.Load(new StringReader(TransMessage)); System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("response"); System.Xml.XmlNodeList nodesIssue = XmlDoc.GetElementsByTagName("issue"); string LotteryName = ""; string Number = ""; DateTime StartTime; DateTime EndTime; if (nodes != null) { if (nodes[0].Attributes["code"].Value == "0000") { if (nodesIssue != null) { for (int i = 0; i < nodesIssue.Count; i++) { LotteryName = nodesIssue[i].Attributes["gameName"].Value; //彩种 Number = nodesIssue[i].Attributes["number"].Value; //期号 StartTime = DateTime.Parse(nodesIssue[i].Attributes["startTime"].Value); //奖期开始时间 EndTime = DateTime.Parse(nodesIssue[i].Attributes["stopTime"].Value); //奖期结束时间 int LotteryID = GetLotteryID(LotteryName); if (LotteryName == "ssc") { string IntervalType = DAL.Functions.F_GetLotteryIntervalType(LotteryID); int Interval = int.Parse(IntervalType.Substring(1, IntervalType.IndexOf(";") - 1)); StartTime = EndTime.AddMinutes(-Interval); } if (LotteryID > 0) { if (new DAL.Tables.T_Isuses().GetCount("LotteryID = " + LotteryID.ToString() + " and [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(Number) + "'") < 1) { long IssueID = -1; string ReturnDescription = ""; if (DAL.Procedures.P_IsuseAdd(LotteryID, Number, StartTime, EndTime, "", ref IssueID, ref ReturnDescription) < 0) { new Log("ElectronTicket\\HPCQ").Write("写入恒朋-重庆电子票网关通知的期号错误,彩种:" + LotteryName + ",期号:" + Number); return; } if (IssueID < 0) { new Log("ElectronTicket\\HPCQ").Write("写入恒朋-重庆电子票网关通知的期号错误:" + ReturnDescription + ",彩种:" + LotteryName + ",期号:" + Number); return; } } } System.Threading.Thread.Sleep(2000); //进行休眠两秒 } } } } }
public int GetDuration() { return(EndTime.Subtract(StartTime).Days); }
/// <summary> /// 导出Excel事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Ib_ExportData_Click(object sender, EventArgs e) { string fileName = Regex.Replace(TVGoodsClass.SelectedNode.Text, @"[\s\|\-\/\<>\*\?\\]", "") + StartTime.ToShortDateString() + "-" + EndTime.ToShortDateString() + "销量排行"; fileName = Server.UrlEncode(fileName); RGSGR.ExportSettings.ExportOnlyData = true; RGSGR.HorizontalAlign = HorizontalAlign.Right; RGSGR.ExportSettings.IgnorePaging = true; RGSGR.ExportSettings.FileName = fileName; RGSGR.MasterTableView.ExportToExcel(); }