private static string GetComment(Dictionary <string, Dictionary <string, SeriesDTO> > dicSeries) { if (dicSeries == null || dicSeries.Count == 0) { return(string.Empty); } string strComment = string.Empty; foreach (KeyValuePair <string, Dictionary <string, SeriesDTO> > kvDic in dicSeries) { if (kvDic.Value != null) { foreach (KeyValuePair <string, SeriesDTO> kv in kvDic.Value) { SeriesDTO dtoSeries = kv.Value; if (dtoSeries != null && dtoSeries.Points != null && dtoSeries.Points.Count > 0) { DateTime dtEnd = Convert.ToDateTime(dtoSeries.Points[dtoSeries.Points.Count - 1].Argument); strComment = string.Format("更新时间:{0}", dtEnd.ToString("HH:mm:ss")); break; } } } } return(strComment); }
public bool AddSeriesBooking(SeriesDTO SeriesDTO, List <SeriesDetailDTO> oSeriesDetailList, List <BookingOfSeriesDTO> BookingsOfSeries, out int SeriesId) { int iSeriesId = 0; int iBookingId = 0; BookingHandler bookingHandler = new BookingHandler(); SeriesDetailHandler oSeriesDetailHandler = new SeriesDetailHandler(); //BookingDTO oBookingData; //BookedRooms oBookedRooms; //BookingWaitListDTO oBookingWaitListData; //BookingOfSeriesDTO FinalizedBookingDTO; List <BookingOfSeriesDTO> FinalizedBookingList = new List <BookingOfSeriesDTO>(); #region Saving Series in Master and Detail AddSeries(SeriesDTO, out iSeriesId); foreach (SeriesDetailDTO var in oSeriesDetailList) { var.SeriesID = iSeriesId; } oSeriesDetailHandler.AddSeriesDetail(oSeriesDetailList); #endregion #region Pulling EveryBooking and Saving It foreach (BookingOfSeriesDTO FinalBooking in BookingsOfSeries) { FinalBooking.Booking.SeriesId = iSeriesId; bookingHandler.AddBooking(FinalBooking.Booking, FinalBooking.BookedRooms.ToArray(), FinalBooking.WaitListedRooms.ToArray(), out iBookingId); } #endregion Pulling EveryBooking and Saving It SeriesId = iSeriesId; return(true); }
private static string GetComment(SensorDataHeadEntity eHead, SeriesDTO dtoSeries) { if (eHead == null || !eHead.BeginDate.HasValue || dtoSeries == null || dtoSeries.Points == null || dtoSeries.Points.Count == 0) { return(string.Empty); } StringBuilder builder = new StringBuilder(); builder.AppendLine("开始时间:"); builder.Append(" ").AppendLine(eHead.BeginDate.Value.ToString("yyyy-MM-dd")); builder.Append(" ").AppendLine(eHead.BeginDate.Value.ToString("HH:mm:ss")); DateTime dtEnd = Convert.ToDateTime(dtoSeries.Points[dtoSeries.Points.Count - 1].Argument); //TimeSpan ts = dtEnd - eHead.BeginDate.Value; //builder.AppendLine("已用时间:"); //builder.Append(" ").Append(ts.TotalMinutes.ToString("f2")).AppendLine("分"); builder.AppendLine("更新时间:"); builder.Append(" ").AppendLine(dtEnd.ToString("HH:mm:ss")); return(builder.ToString()); }
public IActionResult Put([FromBody] SeriesDTO dto, [FromRoute] Guid id) { var cars = dto.CarIds.Count == 0 ? new List <Car>() :_context.Cars.Where(c => dto.CarIds.Contains(c.Id)).ToList(); if (cars.Count != dto.CarIds.Count) { return(BadRequest("Unable to find all the car ids for the series")); } var existing = _context.Series .Include(s => s.SeriesCars).ThenInclude(s => s.Car).FirstOrDefault(s => s.Id == id); if (existing == null) { return(NotFound($"Series with id {id} was not found")); } existing.Name = dto.Name; existing.IsArchived = dto.IsArchived; existing.LastUpdated = DateTime.UtcNow; existing.LogoImgUrl = dto.LogoImgUrl; existing.Description = dto.Description; existing.IsLeague = dto.IsLeague; _context.SaveChanges(); if (cars.Count > 0) { var existingSeriesCars = _context.SeriesCars.Where(s => s.SeriesId == id).Include(c => c.Car); var seriesCars = new List <SeriesCar>(); var carIds = dto.CarIds; foreach (var seriesCar in existingSeriesCars) { if (!carIds.Contains(seriesCar.CarId)) { _context.SeriesCars.Remove(seriesCar); } else { seriesCars.Add(seriesCar); } } var newCarIds = carIds.Where(c => existingSeriesCars.Where(s => s.CarId == c).Count() == 0).ToList(); foreach (var car in newCarIds) { SeriesCar seriesCar = new SeriesCar { Series = existing, SeriesId = existing.Id, Car = cars.First(c => c.Id == car), CarId = car }; _context.SeriesCars.Add(seriesCar); seriesCars.Add(seriesCar); } _context.SaveChanges(); existing.SeriesCars = seriesCars; } return(Ok(new SeriesDTO(existing))); }
public List <SeriesDTO> GetSeries(int AccomodationId, int SeriesId, DateTime SeriesStartDate) { SeriesDTO oSeriesDTO = new SeriesDTO(); oSeriesDTO.AccomodationID = AccomodationId; oSeriesDTO.SeriesId = SeriesId; oSeriesDTO.SeriesStartDate = SeriesStartDate; return(GetSeries(oSeriesDTO)); }
private ChartDTO GetSterilizerChartDataInc(SensorDataHeadEntity eHead, DateTime lastReceivedDate) { SeriesDTO s1 = GetSeriesInc(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1, lastReceivedDate); SeriesDTO s2 = GetSeriesInc(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2, lastReceivedDate); SeriesDTO s3 = GetSeriesInc(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3, lastReceivedDate); SeriesDTO s4 = GetSeriesInc(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4, lastReceivedDate); SeriesDTO s5 = GetSeriesInc(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5, lastReceivedDate); SeriesDTO s6 = GetSeriesInc(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6, lastReceivedDate); if (s1 == null || s1.Points == null || s1.Points.Count == 0) { return(null); } MergeSterilizerSensorData(); Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>(); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2); Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>(); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6); ChartDTO chartData = new ChartDTO(); string temp = string.Empty; if (s2 != null && s2.Points.Count > 0) { temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0"); } string p2 = string.Empty; if (s4 != null && s4.Points.Count > 0) { p2 = s4.Points[s4.Points.Count - 1].Values[0].ToString("0"); } chartData.ChartTitle = GetChartTitle(); chartData.RealtimeInfo = string.Format("温度:{0}\n压力:{1}", temp, p2); chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp); chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure); chartData.Comment = GetComment(eHead, s1); chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast); return(chartData); }
public string SeriesGetAllBy(string ui, string f, string t) { int userId = -1; try { userId = Int32.Parse(ui); } catch { } DateTime?from = null; try { from = DateTime.ParseExact(f, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch { } DateTime?to = null; try { to = DateTime.ParseExact(t, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch { } var listSeries = ViewActivitiesBLL.SeriesGetAllBy(userId, from, to); var listSeriesDTO = new List <SeriesDTO>(); foreach (var series in listSeries) { var salesInChargeName = ""; try { salesInChargeName = series.Agency.Sale.FullName; } catch { } var seriesDTO = new SeriesDTO() { AgencyName = series.Agency.Name, SeriesCode = series.SeriesCode, BookerName = series.Booker.Name, SalesInChargeName = salesInChargeName, CutoffDate = series.CutoffDate, NoOfDays = series.NoOfDays == 1 ? "2 days 1 night" : "3 days 2 nights", NoOfBooking = series.ListBooking.Count.ToString(), Status = SeriesGetStatus(series.Id), }; listSeriesDTO.Add(seriesDTO); } return(JsonConvert.SerializeObject(listSeriesDTO)); }
public List <SeriesDTO> GetSeries(SeriesDTO SeriesDTO) { List <SeriesDTO> oSeriesList = new List <SeriesDTO>(); SeriesDTO Series; DataSet dsSeries; DataRow dr; DatabaseManager oDB; string sProcName = string.Empty; try { oDB = new DatabaseManager(); sProcName = "up_Get_Series"; oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@SeriesId", DbType.Int32, SeriesDTO.SeriesId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomId", DbType.Int32, SeriesDTO.AccomodationID); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@SeriesStartDate", DbType.Date, GF.HandleMaxMinDates(SeriesDTO.SeriesStartDate, false)); dsSeries = oDB.ExecuteDataSet(oDB.DbCmd); oDB = null; } catch (Exception exp) { oDB = null; dsSeries = null; GF.LogError("clsSeriesHandler.GetSeries", exp.Message); } if (dsSeries != null) { //oBookingRoomDTO[dsSeries.Tables[0].Rows.Count] = new BookingRoomDTO(); for (int i = 0; i < dsSeries.Tables[0].Rows.Count; i++) { Series = new SeriesDTO(); dr = dsSeries.Tables[0].Rows[i]; Series.SeriesId = Convert.ToInt32(dr.ItemArray.GetValue(0)); Series.Accomodation = Convert.ToString(dr.ItemArray.GetValue(1)); Series.SeriesName = Convert.ToString(dr.ItemArray.GetValue(2)); Series.NoOfNights = Convert.ToInt32(dr.ItemArray.GetValue(3)); Series.GAP = Convert.ToInt32(dr.ItemArray.GetValue(4).ToString()); Series.NoOfDepartures = Convert.ToInt32(dr.ItemArray.GetValue(5)); Series.SeriesStartDate = Convert.ToDateTime(dr.ItemArray.GetValue(6)); Series.AccomodationID = Convert.ToInt32(dr.ItemArray.GetValue(7)); Series.AccomTypeID = Convert.ToInt32(dr.ItemArray.GetValue(8)); Series.AgentId = Convert.ToInt32(dr.ItemArray.GetValue(9)); oSeriesList.Add(Series); } } return(oSeriesList); }
private SeriesDTO ToSeriesDTO(SensorDataHeadEntity eHead, string seriesName, DataRow[] rows) { if (rows != null && rows.Length > 0) { IList <SeriesPointDTO> lstPoints = new List <SeriesPointDTO>(); SeriesPointDTO sp = null; int spCount = 0; DateTime?curSensorDate = null; DateTime?preSensorDate = null; double dif = 0; foreach (DataRow row in rows) { long sts = Convert.ToInt64(row["SensorTimeSpan"]); curSensorDate = ParseHelper.ParseToDateTime(row["SensorDate"]); // 间隔 spCount++; if (spCount > 1 && spCount < rows.Length) { dif = curSensorDate.Value.Subtract(preSensorDate.Value).TotalMilliseconds; if (dif < mReadingInterval) { continue; } } sp = new SeriesPointDTO(); sp.Argument = curSensorDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff"); sp.Values = new double[] { Convert.ToDouble(row["ContentNumber"]) }; sp.ReceivedDate = Convert.ToDateTime(row["ReceivedDate"]); lstPoints.Add(sp); preSensorDate = curSensorDate; } SeriesDTO s = new SeriesDTO(); s.SeriesTitle = seriesName; s.Points = lstPoints; return(s); } else { return(null); } }
private SeriesDTO MakeSeries(IList <SeriesPointDTO> lstPoints, string seriesName) { if (lstPoints.Count > 0) { SeriesDTO s = new SeriesDTO(); s.SeriesTitle = seriesName; s.Points = lstPoints; return(s); } else { return(null); } }
public bool AddSeriesBooking(SeriesDTO SeriesDTO, List <SeriesDetailDTO> oSeriesDetailDatas, List <BookingOfSeriesDTO> oBookingOfSeriesDTO, out int SeriesId) { try { if (seriesBookingHelper == null) { seriesBookingHelper = new SeriesBookingHelper(); } return(seriesBookingHelper.AddSeriesBooking(SeriesDTO, oSeriesDetailDatas, oBookingOfSeriesDTO, out SeriesId)); } catch (Exception exp) { throw exp; } }
private SeriesDTO ToSeriesDTO(string seriesName, IList <MonitorCollectDataEntryEntity> lstDetail, string propertyName) { if (lstDetail != null && lstDetail.Count > 0) { IList <SeriesPointDTO> lstPoints = new List <SeriesPointDTO>(); SeriesPointDTO sp = null; int spCount = 0; DateTime?curSensorDate = null; DateTime?preSensorDate = null; double dif = 0; foreach (MonitorCollectDataEntryEntity row in lstDetail) { curSensorDate = row.FDate; // 间隔 spCount++; if (spCount > 1 && spCount < lstDetail.Count) { dif = curSensorDate.Value.Subtract(preSensorDate.Value).TotalMilliseconds; if (dif < mReadingInterval) { continue; } } sp = new SeriesPointDTO(); sp.Argument = curSensorDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff"); sp.Values = new double[] { Convert.ToDouble(Common.Utility.GetValueByProperty(row, propertyName)) }; sp.ReceivedDate = curSensorDate; lstPoints.Add(sp); preSensorDate = curSensorDate; } SeriesDTO s = new SeriesDTO(); s.SeriesTitle = seriesName; s.Points = lstPoints; return(s); } else { return(null); } }
private ChartDTO GetSterilizerChartData(MonitorCollectDataEntity eHead, IList <MonitorCollectDataEntryEntity> lstDetail) { SeriesDTO s1 = GetSeries(lstDetail, "FValue1", Properties.Resource.SterilizerSeries1); SeriesDTO s2 = GetSeries(lstDetail, "FValue2", Properties.Resource.SterilizerSeries2); SeriesDTO s3 = GetSeries(lstDetail, "FValue3", Properties.Resource.SterilizerSeries3); SeriesDTO s4 = GetSeries(lstDetail, "FValue4", Properties.Resource.SterilizerSeries4); SeriesDTO s5 = GetSeries(lstDetail, "FValue5", Properties.Resource.SterilizerSeries5); SeriesDTO s6 = GetSeries(lstDetail, "FValue6", Properties.Resource.SterilizerSeries6); AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString()); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.TempMinValue); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.TempMaxValue); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit); AxesDTO axesPressure = new AxesDTO(AxesName.Pressure.ToString()); if (Properties.Resource.PressureMinValue.Equals(Properties.Resource.PressureMaxValue)) { axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.PressureMinValue); axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.PressureMaxValue); } axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit); Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>(); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2); Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>(); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6); ChartDTO chartData = new ChartDTO(); chartData.ChartTitle = GetChartTitle(eHead); chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp); chartData.AxesDictionary.Add(AxesName.Pressure.ToString(), axesPressure); chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp); chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure); chartData.Comment = GetComment(eHead, s1); return(chartData); }
private void GetSeriesDto(IList <SensorDataLineEntity> lstLine, ref SeriesDTO sTemperature, ref SeriesDTO sPressure, ref SeriesDTO sHumidity, ref SeriesDTO sVoltage) { if (lstLine != null && lstLine.Count > 0) { IList <SeriesPointDTO> lstTemperaturePoints = new List <SeriesPointDTO>(); IList <SeriesPointDTO> lstPressurePoints = new List <SeriesPointDTO>(); IList <SeriesPointDTO> lstHumidityPoints = new List <SeriesPointDTO>(); IList <SeriesPointDTO> lstVoltagePoints = new List <SeriesPointDTO>(); int spCount = 0; DateTime?curSensorDate = null; DateTime?preSensorDate = null; double dif = 0; foreach (SensorDataLineEntity sdle in lstLine) { curSensorDate = ParseHelper.ParseToDateTime(sdle.ReceivedDate.Value); // 间隔 spCount++; if (spCount > 1 && spCount < lstLine.Count) { dif = curSensorDate.Value.Subtract(preSensorDate.Value).TotalMilliseconds; if (dif < mReadingInterval) { continue; } } MakeSeriesPoint(lstTemperaturePoints, curSensorDate, sdle.ValueNumber1); //Temperature MakeSeriesPoint(lstPressurePoints, curSensorDate, sdle.ValueNumber2); //Pressure MakeSeriesPoint(lstHumidityPoints, curSensorDate, sdle.ValueNumber3); //Humidity MakeSeriesPoint(lstVoltagePoints, curSensorDate, sdle.ValueNumber4); //Voltage preSensorDate = curSensorDate; } sTemperature = MakeSeries(lstTemperaturePoints, Properties.Resource.TemperatureSeries); sPressure = MakeSeries(lstPressurePoints, Properties.Resource.PressureSeries); sHumidity = MakeSeries(lstHumidityPoints, Properties.Resource.HumiditySeries); sVoltage = MakeSeries(lstVoltagePoints, Properties.Resource.VoltageSeries); } }
private ChartDTO GetWasherChartData(MonitorCollectDataEntity eHead, IList <MonitorCollectDataEntryEntity> lstDetail) { SeriesDTO s1 = GetSeries(lstDetail, "FValue1", Properties.Resource.WasherSeries1); //Med SeriesDTO s2 = GetSeries(lstDetail, "FValue2", Properties.Resource.WasherSeries2); //CT SeriesDTO s3 = GetSeries(lstDetail, "FValue3", Properties.Resource.WasherSeries3); //CDNo SeriesDTO s5 = GetSeries(lstDetail, "FValue4", Properties.Resource.WasherSeries5); //Ao SeriesDTO s4 = GetSeries(lstDetail, "FValue5", Properties.Resource.WasherSeries4); //DosV AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString()); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit); //axesTemp.SeriesList.Add(sTempIndepCham); AxesDTO axesAo = new AxesDTO(AxesName.AoValue.ToString()); axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.A0MinValue); axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.A0MaxValue); Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>(); dicSeriesTemp.Add(Properties.Resource.WasherSeries2, s2); Dictionary <string, SeriesDTO> dicSeriesAo = new Dictionary <string, SeriesDTO>(); dicSeriesAo.Add(Properties.Resource.WasherSeries5, s5); dicSeriesAo.Add(Properties.Resource.WasherSeries1, s1); dicSeriesAo.Add(Properties.Resource.WasherSeries3, s3); dicSeriesAo.Add(Properties.Resource.WasherSeries4, s4); ChartDTO chartData = new ChartDTO(); chartData.ChartTitle = GetChartTitle(eHead); chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp); chartData.AxesDictionary.Add(AxesName.AoValue.ToString(), axesAo); chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp); chartData.SeriesDictionary.Add(AxesName.AoValue.ToString(), dicSeriesAo); chartData.Comment = GetComment(eHead, s1); //chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast); return(chartData); }
public IActionResult Post([FromBody] SeriesDTO dto) { var cars = dto.CarIds.Count == 0 ? new List <Car>() :_context.Cars.Where(c => dto.CarIds.Contains(c.Id)).ToList(); if (cars.Count != dto.CarIds.Count) { return(BadRequest("Unable to find all the car ids for the series")); } Series series = new Series() { Name = dto.Name, IsTeam = dto.IsTeam, IsArchived = dto.IsArchived, LastUpdated = DateTime.UtcNow, LogoImgUrl = dto.LogoImgUrl, Description = dto.Description, IsLeague = dto.IsLeague }; _context.Series.Add(series); _context.SaveChanges(); if (cars.Count > 0) { var list = new List <SeriesCar>(); foreach (var car in cars) { SeriesCar seriesCar = new SeriesCar { Series = series, SeriesId = series.Id, Car = car, CarId = car.Id }; _context.SeriesCars.Add(seriesCar); list.Add(seriesCar); } series.SeriesCars = list; _context.SaveChanges(); } return(Ok(new SeriesDTO(series))); }
private bool AddSeries(SeriesDTO SeriesDTO, out int SeriesId) { DatabaseManager oDB; int sId = 0; bool Success = false; SeriesId = 0; try { oDB = new DatabaseManager(); string sProcName = "up_Ins_Series"; if (SeriesDTO != null) { oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@SeriesName", DbType.String, SeriesDTO.SeriesName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@NoOfNights", DbType.Int32, SeriesDTO.NoOfNights); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@GAP", DbType.Int32, SeriesDTO.GAP); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@NoOfDeps", DbType.Int32, SeriesDTO.NoOfDepartures); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomId", DbType.Int32, SeriesDTO.AccomodationID); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomTypeId", DbType.Int32, SeriesDTO.AccomTypeID); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AgentId", DbType.Int32, SeriesDTO.AgentId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@SeriesStartDate", DbType.DateTime, SeriesDTO.SeriesStartDate); sId = Convert.ToInt32(oDB.ExecuteScalar(oDB.DbCmd)); oDB.DbCmd.Parameters.Clear(); SeriesId = sId; Success = true; } } catch (Exception exp) { oDB = null; GF.LogError("clsSeriesManager.AddSeriesBooking", exp.Message); Success = false; } finally { oDB = null; SeriesDTO = null; } return(Success); }
public SeriesDTO[] GetRoomsForSeries(int AccomodationId) { SeriesDTO[] oSeriesDTO; DataSet dsSeriesData; DataRow dr; string sProcName; DatabaseManager oDB; dsSeriesData = null; oSeriesDTO = null; try { oDB = new DatabaseManager(); sProcName = "up_Get_RoomsForSeries"; oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomId", DbType.Int32, AccomodationId); dsSeriesData = oDB.ExecuteDataSet(oDB.DbCmd); oDB = null; } catch (Exception exp) { oDB = null; dsSeriesData = null; GF.LogError("clsBookingRoomHandler.GetBookingRoomsForSeries", exp.Message); } if (dsSeriesData != null) { oSeriesDTO = new SeriesDTO[dsSeriesData.Tables[0].Rows.Count]; for (int i = 0; i < dsSeriesData.Tables[0].Rows.Count; i++) { oSeriesDTO[i] = new SeriesDTO(); dr = dsSeriesData.Tables[0].Rows[i]; oSeriesDTO[i].RoomCategoryId = (dr.ItemArray.GetValue(0) == DBNull.Value ? 0 : Convert.ToInt32(dr.ItemArray.GetValue(0))); oSeriesDTO[i].RoomCategory = (dr.ItemArray.GetValue(0) == DBNull.Value ? "" : Convert.ToString(dr.ItemArray.GetValue(1))); oSeriesDTO[i].RoomTypeId = (dr.ItemArray.GetValue(0) == DBNull.Value ? 0 : Convert.ToInt32(dr.ItemArray.GetValue(2))); oSeriesDTO[i].RoomType = (dr.ItemArray.GetValue(0) == DBNull.Value ? "" : Convert.ToString(dr.ItemArray.GetValue(3))); oSeriesDTO[i].TotalRooms = (dr.ItemArray.GetValue(0) == DBNull.Value ? 0 : Convert.ToInt32(dr.ItemArray.GetValue(4))); } } return(oSeriesDTO); }
public static Series ConstructFromDto(SeriesDTO dto) { var seasonAndYear = dto.season != null?AniListApiHelper.GetSeasonType($"{dto.season}") : null; return(new Series() { Id = dto.id, TitleRomaji = dto.title_romaji, TitleEnglish = dto.title_english, TitleJapanese = dto.title_japanese, Type = dto.type?.GetEnumValue <MediaTypes>() ?? MediaTypes.NotFound, SeriesType = dto.series_type?.GetEnumValue <SeriesType>() ?? Types.SeriesType.NotFound, StartDate = dto.start_date, EndDate = dto.end_date, Season = seasonAndYear?.First().Value ?? Seasons.NotFound, Year = seasonAndYear?.First().Key, Description = dto.description, IsAdult = dto.adult, AverageScore = dto.average_score, Popularity = dto.popularity, IsFavourite = dto.favourite, ImageUrlSmall = dto.image_url_sml, ImageUrlMedium = dto.image_url_med, ImageUrlLarge = dto.image_url_lge, ImageUrlBanner = dto.image_url_banner, Genres = dto.genres?.Select(x => x.GetEnumValue <Genres>()).ToList(), Synonyms = dto.synonyms, YoutubeId = dto.youtube_id, Hashtag = dto.hashtag, UpdatedAt = dto.updated_at, ScoreDistribution = dto.score_distribution, ListStats = dto.list_stats != null?ListStats.ConstructFromDto(dto.list_stats) : null, TotalEpisodes = dto.total_episodes, Duration = dto.duration, AiringStatus = dto.airing_status?.GetEnumValue <AiringStatus>() ?? Types.AiringStatus.NotFound, Source = dto.source?.GetEnumValue <AnimeSourceTypes>() ?? AnimeSourceTypes.NotFound, Classification = dto.classification, AiringStats = dto.airing_stats != null?ConvertAiringStatsDtoDictionaryToDictionary(dto.airing_stats) : null }); }
public bool AddSeriesBookingRooms(SeriesDTO SeriesDTO) { DatabaseManager oDB; //int SeriesID = 0; try { oDB = new DatabaseManager(); string sProcName = "up_SaveSeriesBookingRooms"; if (SeriesDTO != null) { oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iBookingID", DbType.Int32, SeriesDTO.BookingId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iSeriesID", DbType.Int32, SeriesDTO.SeriesId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@dtStartDate", DbType.DateTime, Convert.ToDateTime(SeriesDTO.StartDate.ToString())); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@dtEndDate", DbType.DateTime, Convert.ToDateTime(SeriesDTO.EndDate.ToString())); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iAccomID", DbType.Int32, SeriesDTO.AccomodationID); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iRoomCategoryID", DbType.Int32, SeriesDTO.RoomCategoryId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iRoomTypeID", DbType.Int32, SeriesDTO.RoomTypeId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iRequired", DbType.Int32, SeriesDTO.TotalRooms); oDB.ExecuteNonQuery(oDB.DbCmd); oDB.DbCmd.Parameters.Clear(); } } catch (Exception exp) { oDB = null; GF.LogError("clsSeriesManager.AddSeriesBooking", exp.Message); return(false); } finally { oDB = null; SeriesDTO = null; } return(true); }
public string CreateSeries(string ai, string bi, string sc, string cd, string nod) { var agencyId = -1; try { agencyId = Convert.ToInt32(ai); } catch { } var agency = AddSeriesBookingsBLL.AgencyGetById(agencyId); var bookerId = -1; try { bookerId = Convert.ToInt32(bi); } catch { } var booker = AddSeriesBookingsBLL.AgencyContactGetById(bookerId); var seriesCode = sc; DateTime?cutoffDate = null; try { cutoffDate = DateTime.ParseExact(cd, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch { } var noOfDays = -1; try { noOfDays = Convert.ToInt32(nod); } catch { noOfDays = 0; } var series = new Series() { SeriesCode = seriesCode, CutoffDate = cutoffDate, NoOfDays = noOfDays, }; if (booker != null) { series.Booker = booker; } else if (agency != null) { series.Agency = agency; } AddSeriesBookingsBLL.SeriesSaveOrUpdate(series); var seriesDTO = new SeriesDTO() { Id = series.Id, SeriesCode = series.SeriesCode, CutoffDate = series.CutoffDate.HasValue ? series.CutoffDate.Value.ToString("dd/MM/yyyy") : "", NoOfDays = series.NoOfDays }; if (series.Booker != null) { seriesDTO.Booker = new SeriesDTO.BookerDTO() { Id = series.Booker.Id, Name = series.Booker.Name, }; series.Agency = series.Booker.Agency; } if (series.Agency != null) { seriesDTO.Agency = new SeriesDTO.AgencyDTO() { Id = series.Agency.Id, Name = series.Agency.Name }; } Dispose(); return(JsonConvert.SerializeObject(seriesDTO)); }
private ChartDTO GetSterilizerChartData(SensorDataHeadEntity eHead) { SeriesDTO s1 = null; SeriesDTO s2 = null; SeriesDTO s3 = null; SeriesDTO s4 = null; SeriesDTO s5 = null; SeriesDTO s6 = null; if (mIsCompressed) { s1 = GetCompressedSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1); s2 = GetCompressedSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2); s3 = GetCompressedSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3); s4 = GetCompressedSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4); s5 = GetCompressedSeries(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5); s6 = GetCompressedSeries(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6); } else { s1 = GetSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1); s2 = GetSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2); s3 = GetSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3); s4 = GetSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4); s5 = GetSeries(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5); s6 = GetSeries(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6); } MergeSterilizerSensorData(); AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString()); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.TempMinValue); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.TempMaxValue); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit); AxesDTO axesPressure = new AxesDTO(AxesName.Pressure.ToString()); if (!Properties.Resource.PressureMinValue.Equals(Properties.Resource.PressureMaxValue)) { axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.PressureMinValue); axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.PressureMaxValue); } axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit); Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>(); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1); dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2); Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>(); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5); dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6); ChartDTO chartData = new ChartDTO(); string temp = string.Empty; if (s2 != null && s2.Points.Count > 0) { temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0"); } string p2 = string.Empty; if (s4 != null && s4.Points.Count > 0) { p2 = s4.Points[s4.Points.Count - 1].Values[0].ToString("0"); } chartData.ChartTitle = GetChartTitle(); chartData.RealtimeInfo = string.Format("温度:{0}\n压力:{1}", temp, p2); chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp); chartData.AxesDictionary.Add(AxesName.Pressure.ToString(), axesPressure); chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp); chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure); chartData.Comment = GetComment(eHead, s1); chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast); return(chartData); }
public string UpdateSeries(string si, string ai, string bi, string sc, string cd, string nod, string sr) { var seriesId = -1; try { seriesId = Convert.ToInt32(si); } catch { } var series = AddSeriesBookingsBLL.SeriesGetById(seriesId); var agencyId = -1; try { agencyId = Convert.ToInt32(ai); } catch { } var agency = AddSeriesBookingsBLL.AgencyGetById(agencyId); var bookerId = -1; try { bookerId = Convert.ToInt32(bi); } catch { } var booker = AddSeriesBookingsBLL.AgencyContactGetById(bookerId); var seriesCode = sc; int cutoffDate = -1; try { cutoffDate = Convert.ToInt32(cd); } catch { } var noOfDays = -1; try { noOfDays = Convert.ToInt32(nod); } catch { } var specialRequest = sr; series.CutoffDate = cutoffDate; series.NoOfDays = noOfDays; series.Booker = booker; series.Agency = agency; series.SpecialRequest = specialRequest; AddSeriesBookingsBLL.SeriesSaveOrUpdate(series); series.SeriesCode = String.IsNullOrEmpty(seriesCode) ? "OSS" + series.Id : seriesCode; AddSeriesBookingsBLL.SeriesSaveOrUpdate(series); var createdBy = ""; try { createdBy = series.CreatedBy.FullName; } catch { } var createdDate = ""; try { createdDate = series.CreatedDate.Value.ToString("dd/MM/yyyy HH:mm"); } catch { } var seriesDTO = new SeriesDTO() { Id = series.Id, SeriesCode = series.SeriesCode, CutoffDate = series.CutoffDate, NoOfDays = series.NoOfDays.ToString(), NoOfDaysTrip = series.NoOfDays == 2 ? "2 days 1 night" : "3 days 2 nights", CreatedBy = createdBy, CreatedDate = createdDate, SpecialRequest = specialRequest, }; if (series.Booker != null) { seriesDTO.Booker = new SeriesDTO.BookerDTO() { Id = series.Booker.Id, Name = series.Booker.Name, }; } if (series.Agency != null) { seriesDTO.Agency = new SeriesDTO.AgencyDTO() { Id = series.Agency.Id, Name = series.Agency.Name }; } Dispose(); return(JsonConvert.SerializeObject(seriesDTO)); }
public string SeriesGetByid(string si) { int seriesId = -1; try { seriesId = Int32.Parse(si); } catch { } var series = AddSeriesBookingsBLL.SeriesGetById(seriesId); var createdBy = ""; try { createdBy = series.CreatedBy.FullName; } catch { } var createdDate = ""; try { createdDate = series.CreatedDate.Value.ToString("dd/MM/yyyy HH:mm"); } catch { } var seriesDTO = new SeriesDTO() { Id = series.Id, SeriesCode = series.SeriesCode, CutoffDate = series.CutoffDate, NoOfDays = series.NoOfDays.ToString(), NoOfDaysTrip = series.NoOfDays == 2 ? "2 days 1 night" : "3 days 2 nights", CreatedBy = createdBy, CreatedDate = createdDate, SpecialRequest = series.SpecialRequest, }; if (series.Booker != null) { seriesDTO.Booker = new SeriesDTO.BookerDTO() { Id = series.Booker.Id, Name = series.Booker.Name, }; } if (series.Agency != null) { seriesDTO.Agency = new SeriesDTO.AgencyDTO() { Id = series.Agency.Id, Name = series.Agency.Name }; } Dispose(); return(JsonConvert.SerializeObject(seriesDTO)); }
private ChartDTO GetChartDataByHead(SensorDataHeadEntity eHead) { mHeadEntity = eHead; if (mHeadEntity == null) { return(null); } IList <SensorDataLineEntity> lstLine = null; SensorHelper <object> helper = new SensorHelper <object>(); if (mIsCompressed) { lstLine = mSensorCompressedData.GetSensorDataLine(); } else { string strWhere = string.Format("SensorDataHeadID = '{0}'", eHead.SensorDataHeadID.ToString().ToUpper()); lstLine = helper.SelectList <SensorDataLineEntity>(strWhere, "ReceivedDate"); } SeriesDTO sTemperature = null; SeriesDTO sPressure = null; SeriesDTO sHumidity = null; SeriesDTO sVoltage = null; GetSeriesDto(lstLine, ref sTemperature, ref sPressure, ref sHumidity, ref sVoltage); MakeSensorData(lstLine); ChartDTO chartData = new ChartDTO(); chartData.IsAxisXCustomLabels = false; if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Temperature)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate))) { // 温度 AxesDTO axesTemperature = new AxesDTO(Properties.Resource.TemperatureSeries); axesTemperature.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TemperatureUnit); Dictionary <string, SeriesDTO> dicSeriesTemperature = new Dictionary <string, SeriesDTO>(); dicSeriesTemperature.Add(Properties.Resource.TemperatureSeries, sTemperature); chartData.AxesDictionary.Add(Properties.Resource.TemperatureSeries, axesTemperature); chartData.SeriesDictionary.Add(Properties.Resource.TemperatureSeries, dicSeriesTemperature); } if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Humidity)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity))) { // 湿度 AxesDTO axesHumidity = new AxesDTO(Properties.Resource.HumiditySeries); axesHumidity.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.HumidityUnit); Dictionary <string, SeriesDTO> dicSeriesHumidity = new Dictionary <string, SeriesDTO>(); dicSeriesHumidity.Add(Properties.Resource.HumiditySeries, sHumidity); chartData.AxesDictionary.Add(Properties.Resource.HumiditySeries, axesHumidity); chartData.SeriesDictionary.Add(Properties.Resource.HumiditySeries, dicSeriesHumidity); } if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Pressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate))) { // 气压 AxesDTO axesPressure = new AxesDTO(Properties.Resource.PressureSeries); axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit); Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>(); dicSeriesPressure.Add(Properties.Resource.PressureSeries, sPressure); chartData.AxesDictionary.Add(Properties.Resource.PressureSeries, axesPressure); chartData.SeriesDictionary.Add(Properties.Resource.PressureSeries, dicSeriesPressure); } chartData.ChartTitle = GetChartTitle(); chartData.RealtimeInfo = GetRealtimeInfo(lstLine); chartData.Comment = GetComment(chartData.SeriesDictionary); chartData.ErrorData = null; return(chartData); }
private ChartDTO GetChartDataInc(SensorDataHeadEntity eHead, DateTime lastReceivedDate) { IList <SensorDataLineEntity> lstLine = null; SensorHelper <object> helper = new SensorHelper <object>(); if (mIsCompressed) { lstLine = mSensorCompressedData.GetSensorDataLine(); } else { string strWhere = string.Empty; if (CommonValue.DatabaseType == CommonValue.DatabaseFlag.Oracle) { strWhere = string.Format("SensorDataHeadID = '{0}' AND to_char(ReceivedDate, 'YYYY-MM-DD HH24:MI:SS.FF3') > '{1}'", eHead.SensorDataHeadID.ToString().ToUpper(), lastReceivedDate.ToString("yyyy-MM-dd HH:mm:ss.fff")); } else { strWhere = string.Format("SensorDataHeadID = '{0}' AND ReceivedDate > '{1}'", eHead.SensorDataHeadID.ToString().ToUpper(), lastReceivedDate.ToString("yyyy-MM-dd HH:mm:ss.fff")); } lstLine = helper.SelectList <SensorDataLineEntity>(strWhere, "ReceivedDate"); } SeriesDTO sTemperature = null; SeriesDTO sPressure = null; SeriesDTO sHumidity = null; SeriesDTO sVoltage = null; GetSeriesDto(lstLine, ref sTemperature, ref sPressure, ref sHumidity, ref sVoltage); MakeSensorData(lstLine); ChartDTO chartData = new ChartDTO(); chartData.IsAxisXCustomLabels = false; if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Temperature)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate))) { // 温度 Dictionary <string, SeriesDTO> dicSeriesTemperature = new Dictionary <string, SeriesDTO>(); dicSeriesTemperature.Add(Properties.Resource.TemperatureSeries, sTemperature); chartData.SeriesDictionary.Add(Properties.Resource.TemperatureSeries, dicSeriesTemperature); } if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Humidity)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity))) { // 湿度 Dictionary <string, SeriesDTO> dicSeriesHumidity = new Dictionary <string, SeriesDTO>(); dicSeriesHumidity.Add(Properties.Resource.HumiditySeries, sHumidity); chartData.SeriesDictionary.Add(Properties.Resource.HumiditySeries, dicSeriesHumidity); } if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Pressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) || Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate))) { // 气压 Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>(); dicSeriesPressure.Add(Properties.Resource.PressureSeries, sPressure); chartData.SeriesDictionary.Add(Properties.Resource.PressureSeries, dicSeriesPressure); } chartData.ChartTitle = GetChartTitle(); chartData.RealtimeInfo = GetRealtimeInfo(lstLine); chartData.Comment = GetComment(chartData.SeriesDictionary); chartData.ErrorData = null; return(chartData); }
private ChartDTO GetWasherChartData(SensorDataHeadEntity eHead) { SeriesDTO s1 = null; SeriesDTO s2 = null; SeriesDTO s3 = null; SeriesDTO s4 = null; SeriesDTO s5 = null; if (mIsCompressed) { s1 = GetCompressedSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.WasherSeries1); s2 = GetCompressedSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.WasherSeries2); s3 = GetCompressedSeries(eHead, SystemData.MeasurementSensor3, Properties.Resource.WasherSeries3); s4 = GetCompressedSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.WasherSeries4); s5 = GetCompressedSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.WasherSeries5); } else { s1 = GetSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.WasherSeries1); s2 = GetSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.WasherSeries2); s3 = GetSeries(eHead, SystemData.MeasurementSensor3, Properties.Resource.WasherSeries3); s4 = GetSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.WasherSeries4); s5 = GetSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.WasherSeries5); } MergeWasherSensorData(); AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString()); axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit); //axesTemp.SeriesList.Add(sTempIndepCham); AxesDTO axesAo = new AxesDTO(AxesName.AoValue.ToString()); axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.A0MinValue); axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.A0MaxValue); Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>(); dicSeriesTemp.Add(Properties.Resource.WasherSeries2, s2); Dictionary <string, SeriesDTO> dicSeriesAo = new Dictionary <string, SeriesDTO>(); dicSeriesAo.Add(Properties.Resource.WasherSeries5, s5); dicSeriesAo.Add(Properties.Resource.WasherSeries1, s1); dicSeriesAo.Add(Properties.Resource.WasherSeries3, s3); dicSeriesAo.Add(Properties.Resource.WasherSeries4, s4); ChartDTO chartData = new ChartDTO(); string temp = string.Empty; if (s2 != null && s2.Points.Count > 0) { temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0"); } string a0 = string.Empty; if (s5 != null && s5.Points.Count > 0) { a0 = s5.Points[s5.Points.Count - 1].Values[0].ToString("0"); } chartData.ChartTitle = GetChartTitle(); chartData.RealtimeInfo = string.Format("温度:{0}\nA0:{1}", temp, a0); chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp); chartData.AxesDictionary.Add(AxesName.AoValue.ToString(), axesAo); chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp); chartData.SeriesDictionary.Add(AxesName.AoValue.ToString(), dicSeriesAo); chartData.Comment = GetComment(eHead, s1); chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast); return(chartData); }