public static GoogleMeetLogModel changeEffectiveDateTime(GoogleMeetLogModel partecipantLog) { if (partecipantLog.Date > partecipantLog.EffectiveMeetingStartDate) { TimeSpan result = partecipantLog.Date.Subtract(partecipantLog.EffectiveMeetingStartDate); partecipantLog.TotalMeetingUserPartecipationInSeconds = result.TotalSeconds; } else { partecipantLog.TotalMeetingUserPartecipationInSeconds = 0; } TimeSpan meetingTime = partecipantLog.EffectiveMeetingEndDate.Subtract(partecipantLog.EffectiveMeetingStartDate); partecipantLog.EffectiveMeetingDurationInSeconds = meetingTime.TotalSeconds; partecipantLog.EffectiveMeetingDurationInMinutes = meetingTime.TotalMinutes; partecipantLog.EffectiveMeetingDurationInHours = meetingTime; if (meetingTime.TotalSeconds < partecipantLog.TotalMeetingUserPartecipationInSeconds) { partecipantLog.TotalMeetingUserPartecipationInSeconds = meetingTime.TotalSeconds; } TimeSpan partecipantTime = TimeSpan.FromSeconds(partecipantLog.TotalMeetingUserPartecipationInSeconds); partecipantLog.TotalMeetingUserPartecipationInMinutes = partecipantTime.TotalMinutes; partecipantLog.TotalMeetingUserPartecipationInHours = partecipantTime; partecipantLog.TotalMeetingUserPartecipationInDecimal = partecipantTime.TotalHours; return(partecipantLog); }
private void dateTimePicker_inizio_previsto_ValueChanged(object sender, EventArgs e) { var logItem = (LogItem)listBox2.SelectedItem; if (logItem.logListModel.Where(item => item.Date == logItem.logListModel.Select(log => log.Date).Min()).FirstOrDefault().EffectiveMeetingStartDate == dateTimePicker_inizio_previsto.Value || dateTimePicker_inizio_previsto.Value == dataPickerValueIni) { return; } if (dateTimePicker_inizio_previsto.Value < logItem.logListModel.Where(item => item.Date == logItem.logListModel.Select(log => log.Date).Min()).FirstOrDefault().Date.AddHours(-12)) { MessageBox.Show("Non è possibile iniziare una riunione più di 12 ore prima della data dell'evento meno recende della riunione in esame", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning); dateTimePicker_inizio_previsto.Value = dataPickerValueIni; return; } if (dateTimePicker_fine_previsto.Value < dateTimePicker_inizio_previsto.Value) { MessageBox.Show("Non è possibile impostare una data di inizio più recente della data di fine", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); dateTimePicker_inizio_previsto.Value = dataPickerValueIni; return; } IList <GoogleMeetLogModel> newModel = new List <GoogleMeetLogModel>(); foreach (GoogleMeetLogModel mod in actualListLog) { mod.EffectiveMeetingStartDate = dateTimePicker_inizio_previsto.Value; GoogleMeetLogModel actualModel = TimesHelper.changeEffectiveDateTime(mod); newModel.Add(actualModel); } dt.Rows.Clear(); DataRow dr; foreach (GoogleMeetLogModel mod in newModel) { dr = dt.NewRow(); foreach (var value in columns) { dr[value] = mod.GetType().GetProperty(value).GetValue(mod); } dt.Rows.Add(dr); } dataGridView1.DataSource = dt; dataPickerValueIni = dateTimePicker_inizio_previsto.Value; }
/// <summary> /// /// </summary> /// <param name="googleMeetLogModel"></param> /// <returns></returns> public static IGoogleMeetLogTO MapObjectModelInTransferObject(this GoogleMeetLogModel googleMeetLogModel, string language) { try { return(new GoogleMeetLogTO { Date = googleMeetLogModel.Date.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), EventName = googleMeetLogModel.EventName, EventDescription = googleMeetLogModel.EventDescription, MeetingCode = googleMeetLogModel.MeetingCode, PartecipantIdentifier = googleMeetLogModel.PartecipantIdentifier, ExternalPartecipantIdentifier = googleMeetLogModel.ExternalPartecipantIdentifier ? "Yes" : "No", ClientType = googleMeetLogModel.ClientType, MeetingOwnerEmail = googleMeetLogModel.MeetingOwnerEmail, ProductType = googleMeetLogModel.ProductType, Duration = googleMeetLogModel.Duration.ToString(), EffectiveMeetingDurationInHours = googleMeetLogModel.EffectiveMeetingDurationInHours.ToString(), EffectiveMeetingDurationInSeconds = googleMeetLogModel.EffectiveMeetingDurationInSeconds.ToString(), EffectiveMeetingDurationInMinutes = googleMeetLogModel.EffectiveMeetingDurationInMinutes.ToString(), CallEvaluationOn5 = googleMeetLogModel.CallEvaluationOn5, PartecipantName = googleMeetLogModel.PartecipantName, IPAddress = googleMeetLogModel.IPAddress, City = googleMeetLogModel.City, Country = googleMeetLogModel.Country, ActionReason = googleMeetLogModel.ActionReason, ActionDescription = googleMeetLogModel.ActionDescription, TargetDisplayNames = googleMeetLogModel.TargetDisplayNames, TargetEmail = googleMeetLogModel.TargetEmail, TargetPhoneNumber = googleMeetLogModel.TargetPhoneNumber, CalendarEventIdentifier = string.IsNullOrEmpty(googleMeetLogModel.CalendarEventIdentifier) ? string.Empty : googleMeetLogModel.CalendarEventIdentifier, ConferenceID = googleMeetLogModel.ConferenceID, NETRoundTrip = googleMeetLogModel.NETRoundTrip, TransportProtocol = googleMeetLogModel.TransportProtocol, EstimatedUploadBandwidthInkbps = googleMeetLogModel.EstimatedUploadBandwidthInkbps.ToString(), EstimatedDownloadBandwidthInkbps = googleMeetLogModel.EstimatedDownloadBandwidthInkbps.ToString(), AudioReceivePacketLossMax = googleMeetLogModel.AudioReceivePacketLossMax.ToString(), AudioReceivePacketLossMean = googleMeetLogModel.AudioReceivePacketLossMean.ToString(), AudioReceiveDuration = googleMeetLogModel.AudioReceiveDuration.ToString(), BitRatioAudioSending = googleMeetLogModel.BitRatioAudioSending.ToString(), AudioSendPacketLossMax = googleMeetLogModel.AudioSendPacketLossMax.ToString(), AudioSendPacketLossMean = googleMeetLogModel.AudioSendPacketLossMean.ToString(), AudioSendDuration = googleMeetLogModel.AudioSendDuration.ToString(), NetworkRecvJitterMeaninms = googleMeetLogModel.NetworkRecvJitterMeaninms.ToString(), NetworkRecvJitterMaxinms = googleMeetLogModel.NetworkRecvJitterMaxinms.ToString(), NetworkSendJitterMeaninms = googleMeetLogModel.NetworkSendJitterMeaninms.ToString(), BitRatioScreencastReception = googleMeetLogModel.BitRatioScreencastReception.ToString(), ScreencastReceiveFPSMean = googleMeetLogModel.ScreencastReceiveFPSMean.ToString(), ScreencastReceiveLongSideMedian = googleMeetLogModel.ScreencastReceiveLongSideMedian.ToString(), ScreencastReceivePacketLossMax = googleMeetLogModel.ScreencastReceivePacketLossMax.ToString(), ScreencastReceivePacketLossMean = googleMeetLogModel.ScreencastReceivePacketLossMean.ToString(), ScreencastReceiveDuration = googleMeetLogModel.ScreencastReceiveDuration.ToString(), ScreencastReceiveShortSideMedian = googleMeetLogModel.ScreencastReceiveShortSideMedian.ToString(), BitRatioScreencastSending = googleMeetLogModel.BitRatioScreencastSending.ToString(), ScreencastSendFPSMean = googleMeetLogModel.ScreencastSendFPSMean.ToString(), ScreencastSendLongSideMedian = googleMeetLogModel.ScreencastSendLongSideMedian.ToString(), ScreencastSendPacketLossMax = googleMeetLogModel.ScreencastSendPacketLossMax.ToString(), ScreencastSendPacketLossMean = googleMeetLogModel.ScreencastSendPacketLossMean.ToString(), ScreencastSendDuration = googleMeetLogModel.ScreencastSendDuration.ToString(), ScreencastSendShortSideMedian = googleMeetLogModel.ScreencastSendShortSideMedian.ToString(), VideoReceiveFPSMean = googleMeetLogModel.VideoReceiveFPSMean.ToString(), VideoReceiveLongSideMedian = googleMeetLogModel.VideoReceiveLongSideMedian.ToString(), VideoReceivePacketLossMax = googleMeetLogModel.MaxVideoReceptionPacketsLost.ToString(), VideoReceivePacketLossMean = googleMeetLogModel.VideoReceivePacketLossMax.ToString(), VideoReceiveDuration = googleMeetLogModel.VideoReceiveDuration.ToString(), VideoReceiveShortSideMedian = googleMeetLogModel.VideoReceiveShortSideMedian.ToString(), BitRatioVideoSending = googleMeetLogModel.BitRatioVideoSending.ToString(), VideoSendFPSMean = googleMeetLogModel.VideoSendFPSMean.ToString(), VideoSendLongSideMedian = googleMeetLogModel.VideoSendLongSideMedian.ToString(), VideoSendPacketLossMax = googleMeetLogModel.VideoSendPacketLossMax.ToString(), VideoSendDuration = googleMeetLogModel.VideoSendDuration.ToString(), VideoSendShortSideMedian = googleMeetLogModel.VideoSendShortSideMedian.ToString(), NetworkCongestionRatio = googleMeetLogModel.NetworkCongestionRatio, MeetingStartDate = googleMeetLogModel.MeetingStartDate.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), EffectiveMeetingStartDate = googleMeetLogModel.EffectiveMeetingStartDate.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), MeetingEndDate = googleMeetLogModel.MeetingEndDate.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), EffectiveMeetingEndDate = googleMeetLogModel.EffectiveMeetingEndDate.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), MeetingEnteringDate = googleMeetLogModel.MeetingEnteringDate.ConvertGoogleDateTimeInString(googleMeetLogModel.TimeZone, language), TotalMeetingUserPartecipationInDecimal = googleMeetLogModel.TotalMeetingUserPartecipationInDecimal.ToString(), TotalMeetingUserPartecipationInSeconds = googleMeetLogModel.TotalMeetingUserPartecipationInSeconds.ToString(), TotalMeetingUserPartecipationInMinutes = googleMeetLogModel.TotalMeetingUserPartecipationInMinutes.ToString(), TotalMeetingUserPartecipationInHours = googleMeetLogModel.TotalMeetingUserPartecipationInHours.ToString(), TimeZone = googleMeetLogModel.TimeZone }); } catch (Exception ex) { throw new TransferException("Errore durante la conversione", ex); } }