public CResolveFieldValue(string strField) { _Field = strField; _DisplayAsImage = false; WebbDataProvider dataProvider = VideoPlayBackManager.PublicDBProvider; if (dataProvider != null && dataProvider.DBSourceConfig != null) { if (dataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.WebbPlaybook) { if (strField == "ImagePath") { _DisplayAsImage = true; this._ColumnWidth = 300; } } else if (dataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.CoachCRM) { if (strField == "Logo(TeamInfo)" || strField == "Photo(Coach)" || strField == "Photo(Player)") { _DisplayAsImage = true; this._ColumnWidth = 80; } } else if ((int)dataProvider.DBSourceConfig.WebbDBType < 10) { PlayBookData playBookdata = new PlayBookData(); if (playBookdata.CheckIsPlaybookImageField(strField)) { _DisplayAsImage = true; this._ColumnWidth = 300; } } } }
private void GetOneValueImage(DataTable dt) { int nWidth = this.ExControl.Width, nHeight = this.ExControl.Height; nHeight = (int)((float)nWidth * 2 / 3); string strField = string.Empty; string strValue = "<NULLVALUES>"; strValue = this.GetFieldValue(dt); if (strValue == "<NULLVALUES>") { if (this.Repeat) { strValue = this.RepeatFilter.FilterName; } else { strValue = this.OneValueScFilter.FilterName; } } if (this.OneValue) { #region OneValue this.Image = null; strField = this.Field; string strScoutType = string.Empty; if (Webb.Utility.CurReportMode == 0) { strScoutType = this.ExControl.Report.Template.DiagramScoutType.ToString(); } else { strScoutType = Webb.Reports.DataProvider.VideoPlayBackManager.DiagramScoutType; } bool IsAddingPlayBookGames = false; bool IsAddingCCRMData = false; WebbDataProvider dataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider; string strUserFolder = string.Empty; if (dataProvider != null && dataProvider.DBSourceConfig != null) { strUserFolder = dataProvider.DBSourceConfig.UserFolder; if (strUserFolder == null) { strUserFolder = string.Empty; } IsAddingPlayBookGames = (dataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.WebbPlaybook); IsAddingCCRMData = (dataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.CoachCRM); } int index = strUserFolder.IndexOf(";"); if (index >= 0) { strUserFolder = strUserFolder.Substring(0, index); } if (Webb.Reports.DataProvider.VideoPlayBackManager.DiaPath != string.Empty) { strUserFolder = Webb.Reports.DataProvider.VideoPlayBackManager.DiaPath; strUserFolder = strUserFolder.TrimEnd(@"\".ToCharArray()); } string strImageFilePath = string.Format(@"{0}\Diagrams\{1}\{2}\{3}.dia", strUserFolder, strScoutType, strField, strValue); PlayBookData playBookData = new PlayBookData(); if (IsAddingPlayBookGames) { nWidth = this.ExControl.Width; nHeight = this.ExControl.Height; string strGetImagePath = this.GetPlayBookImagePath(dt); #region Play Book Games if (System.IO.File.Exists(strGetImagePath)) { this.Image = Webb.Utility.ReadImageFromPath(strGetImagePath); } #endregion } else if (IsAddingCCRMData) { nWidth = this.ExControl.Width; nHeight = this.ExControl.Height; if (System.IO.File.Exists(strValue)) { this.Image = Webb.Utility.ReadImageFromPath(strValue); } } else if (this._ReadDiagramFromPlaybook) { #region PlayBook Diagram if (this._PlayBookScoutType == PlayBookScoutType.Default) { strScoutType = playBookData.CheckOffensiveField(strScoutType, strField); if (playBookData.CheckIsPlaybookImageField(strField)) { this.Image = Webb.Utility.ReadImageFromPath(strValue); } else { this.Image = playBookData.ReadPictureFromValue(strScoutType, strField, strValue); } } else if (this._PlayBookScoutType == PlayBookScoutType.OffenseBaseFormation) { this.Image = playBookData.ReadBaseFormation("Offense"); } else if (this._PlayBookScoutType == PlayBookScoutType.DefenseBaseFormation) { this.Image = playBookData.ReadBaseFormation("Defense"); } else { strScoutType = this._PlayBookScoutType.ToString(); if (playBookData.CheckIsPlaybookImageField(strField)) { this.Image = Webb.Utility.ReadImageFromPath(strValue); } else { this.Image = playBookData.ReadPictureFromValue(strScoutType, strField, strValue); } } #endregion } else if (this._UsePicDir) { #region Use Picture in destine-Directory strUserFolder = Webb.Reports.DataProvider.VideoPlayBackManager.PictureDir; strImageFilePath = string.Format(@"{0}\SavePic\{1}\{2}.bmp", strUserFolder, strField, strValue); if (File.Exists(strImageFilePath)) { this.Image = Webb.Utility.ReadImageFromPath(strImageFilePath); } #endregion } else if (playBookData.CheckIsPlaybookImageField(strField)) { this.Image = Webb.Utility.ReadImageFromPath(strValue); } else { #region Advantage Diagram if (File.Exists(strImageFilePath)) { Image image = new Bitmap(nWidth, nHeight); Graphics g = Graphics.FromImage(image); g.Clear(Color.White); //Modify at 2009-2-24 10:27:26@Simon AdvDiagram diagram = new AdvDiagram(); diagram.OpenDiagram(strImageFilePath); diagram.DrawDiagram(g, nWidth, nHeight); this.Image = image; } #endregion } #endregion } else { if (this._DiagramImage.ToLower().EndsWith(".dia") && File.Exists(this._DiagramImage)) { Image image = new Bitmap(nWidth, nHeight); Graphics g = Graphics.FromImage(image); g.Clear(Color.White); //Modify at 2009-2-24 10:27:30@Simon AdvDiagram diagram = new AdvDiagram(); diagram.OpenDiagram(this._DiagramImage); diagram.DrawDiagram(g, nWidth, nHeight); this.Image = image; } } }