public override void UpdateData(object i_Data) { //Scott@2007-11-23 09:30 modified some of the following code. DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; m_DBConfig.SectionFilterIDs = this.GetSelectedFilterIDs(); }
public override void SetData(object i_Data) { //base.SetData (i_Data); DBSourceConfig config = i_Data as DBSourceConfig; this._ConnType = config.DBConnType; this._WebbDBType = config.WebbDBType; //Scott@2007-11-30 12:48 modified some of the following code. //this.C_SelectedFile.Clear(); if (this._ConnType == Webb.Data.DBConnTypes.OleDB) { this.WizardTitle = "Step 2: Select an Access file."; this.C_AccessGroup.Text = "Select Access data source file"; this.C_TitleMsg.Text = "Please select a Database to open."; this.C_OpenFileDialog.DefaultExt = "mdb"; this.C_OpenFileDialog.DereferenceLinks = false; this.C_OpenFileDialog.FileName = ".mdb"; this.C_OpenFileDialog.Filter = "Access database file(*.mdb)|*.mdb"; this.C_OpenFileDialog.RestoreDirectory = true; this.C_OpenFileDialog.Title = "Choose Database file to open"; } else if (this._ConnType == Webb.Data.DBConnTypes.XMLFile) { this.WizardTitle = "Step 2: Select an XML file."; this.C_AccessGroup.Text = "Select Xml data source file"; this.C_TitleMsg.Text = "Please select a XML file to open."; this.C_OpenFileDialog.DefaultExt = "xml"; this.C_OpenFileDialog.DereferenceLinks = false; this.C_OpenFileDialog.FileName = ".xml"; this.C_OpenFileDialog.Filter = "XML file(*.xml)|*.xml"; this.C_OpenFileDialog.RestoreDirectory = true; this.C_OpenFileDialog.Title = "Choose Xml file to open"; } else /*never*/ } {
public void SetDataConfig(DBSourceConfig config) { if (this._DBSourceConfig == null) { _DBSourceConfig = new DBSourceConfig(); } this._DBSourceConfig.ApplyConfig(config); switch (config.WebbDBType) { case WebbDBTypes.CoachCRM: _DBSourceConfig.DBConnType = DBConnTypes.XMLFile; this.InitCoachCRMData(); break; case WebbDBTypes.WebbVictoryFootball: case WebbDBTypes.WebbVictoryBasketball: case WebbDBTypes.WebbVictoryHockey: case WebbDBTypes.WebbVictoryVolleyball: case WebbDBTypes.WebbVictoryLacrosse: case WebbDBTypes.WebbVictorySoccer: _DBSourceConfig.DBConnType = DBConnTypes.OleDB; this.InitVictoryData(); break; case WebbDBTypes.WebbAdvantageFootball: default: _DBSourceConfig.DBConnType = DBConnTypes.File; this.InitControl(); break; } }
public bool UpdateConfig(DBSourceConfig _DBSourceConfig) { _DBSourceConfig.DefaultSQLCmd = this.txtSql.Text.Trim(); string lowerWord = _DBSourceConfig.DefaultSQLCmd.ToLower(); bool unsafeWords = (lowerWord.IndexOf("delete ") >= 0); unsafeWords = unsafeWords || (lowerWord.IndexOf("drop ") >= 0); unsafeWords = unsafeWords || (lowerWord.IndexOf("create ") >= 0); unsafeWords = unsafeWords || (lowerWord.IndexOf("update ") >= 0); unsafeWords = unsafeWords || (lowerWord.IndexOf("insert ") >= 0); unsafeWords = unsafeWords || (lowerWord.IndexOf("alter table ") >= 0); if (unsafeWords) { Webb.Utilities.MessageBoxEx.ShowError("Unsafety SQL statements to change datastructure for database."); return(false); } if (_DBSourceConfig.DefaultSQLCmd == string.Empty) { Webb.Utilities.MessageBoxEx.ShowError("Failed to load data ,please check the config."); return(false); } return(true); }
public bool UpdateConfig(DBSourceConfig _DBSourceConfig) { if (this.cmbServer.Text.Trim() == string.Empty) { MessageBox.Show("Please input the serverIP which the database located in!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (this.txtDataBase.Text.Trim() == string.Empty) { MessageBox.Show("Please input the database name!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (this.cmbTable.Text.Trim() == string.Empty && this.RadioSimple.Checked) { MessageBox.Show("Please input the table name or connect the database to fetch the tabel name!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } string connectionstring = string.Format(strFormat, this.cmbServer.Text, this.txtDataBase.Text, this.txtUser.Text, this.txtPwd.Text); _DBSourceConfig.ConnString = connectionstring; string Sql = "select * from [" + this.cmbTable.Text + "]"; _DBSourceConfig.DefaultSQLCmd = Sql; WriteRegistery(); return(true); }
// private void C_SelectedFile_TextChanged(object sender, System.EventArgs e) // { // if(System.IO.File.Exists(this.C_SelectedFile.Text)) // { // this.ParentWizardForm.WizardStatus |= WizardStatus.Next; // } // else // { // this.ParentWizardForm.WizardStatus &= ~WizardStatus.Next; // } // } public override void UpdateData(object i_Data) { //base.UpdateData (i_Data); DBSourceConfig m_Config = i_Data as DBSourceConfig; m_Config.DBFilePath = this.C_SelectedFile.Text; }
//Scott@2007-11-19 08:58 modified some of the following code. public override void UpdateData(object i_Data) { //base.UpdateData(i_Data); DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; m_DBConfig.FilterIDs = this.GetSelectedFilterIDs(); }
public override void UpdateData(object i_Data) { if (!(i_Data is DBSourceConfig)) { return; } DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; m_DBConfig.PlayBookFormFiles = new StringCollection(); string path = string.Empty; foreach (object o in this.C_ListSelectedGames.Items) { path = (o as PlayBookFileDescription).FileName; m_DBConfig.PlayBookFormFiles.Add(path); } foreach (object o in this.C_ListSelectedPlays.Items) { path = (o as PlayBookFileDescription).FileName; m_DBConfig.PlayBookFormFiles.Add(path); } m_DBConfig.HeaderName = string.Empty; base.UpdateData(i_Data); }
public override void UpdateData(object i_Data) { if (!(i_Data is DBSourceConfig)) { return; } DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; m_DBConfig.DBFilePath = this.Folder; m_DBConfig.Games.Clear(); m_DBConfig.Edls.Clear(); string path = string.Empty; foreach (object o in this.C_ListSelectedGames.Items) { path = (o as AdvFileInfo).FilePath; m_DBConfig.Games.Add(path); } foreach (object o in this.C_ListSelectedEdls.Items) { path = (o as AdvFileInfo).FilePath; m_DBConfig.Edls.Add(path); } m_DBConfig.UserFolder = this.Folder; m_DBConfig.HeaderName = string.Empty; }
public override void SetData(object i_Data) { //base.SetData (i_Data); DBSourceConfig m_config = i_Data as DBSourceConfig; //set members this._ConnType = m_config.DBConnType; this._WebbDBType = m_config.WebbDBType; //set data base type this.C_SQLType.Checked = this._ConnType == DBConnTypes.SQLDB; this.C_TypeOLE.Checked = this._ConnType == DBConnTypes.OleDB; this.C_XMLType.Checked = this._ConnType == DBConnTypes.XMLFile; this.C_FileType.Checked = this._ConnType == DBConnTypes.File; //set data source type this.C_WebbFootball.Checked = this._WebbDBType == WebbDBTypes.WebbAdvantageFootball; this.C_WebbVictory.Checked = (int)this._WebbDBType >= 100 && (int)this._WebbDBType <= 105; //football, basketball, volleyball, hockey if (this.C_WebbVictory.Checked) { this.C_CBVictoryType.Enabled = true; this.C_CBVictoryType.SelectedIndex = (int)this._WebbDBType - 100; } this.C_WebbCoachCRM.Checked = this._WebbDBType == WebbDBTypes.CoachCRM; this.C_WebbPlayBook.Checked = this._WebbDBType == WebbDBTypes.WebbPlaybook; this.C_CommonDataSource.Checked = this._WebbDBType == WebbDBTypes.Others; }
private void GetUserInfo(string strUserCmd, DBSourceConfig i_Config) { string[] arrCmd = strUserCmd.Split('?'); string strCmdHeader, strCmdValue; foreach (string strCmd in arrCmd) { int index = strCmd.IndexOf(@":"); if (index <= 0) { continue; } strCmdHeader = strCmd.Substring(0, index); strCmdValue = strCmd.Remove(0, index + 1); switch (strCmdHeader) { case "USER": i_Config.UserFolder = strCmdValue; break; case "HEADER": i_Config.HeaderName = strCmdValue; break; default: continue; } } }
public bool UpdateConfig(ref DBSourceConfig m_DBConfig) { m_DBConfig.Games.Clear(); m_DBConfig.Edls.Clear(); string path = string.Empty; foreach (object o in this.C_ListSelectedGames.Items) { path = (o as AdvFileInfo).FilePath; m_DBConfig.Games.Add(path); } foreach (object o in this.C_ListSelectedEdls.Items) { path = (o as AdvFileInfo).FilePath; m_DBConfig.Edls.Add(path); } m_DBConfig.UserFolder = this.Folder; return(true); }
public Webb.Reports.DataProvider.DBSourceConfig CreateDBConfig() { DBSourceConfig m_DBConfig = new DBSourceConfig(); this.InitializeDBConfig(m_DBConfig); return(m_DBConfig); }
//Scott@2007-11-19 08:47 modified some of the following code. public override void UpdateData(object i_Data) { //base.UpdateData(i_Data); DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; m_DBConfig.GameIDs = this.GetSelectedGameIDs(); m_DBConfig.Edls = this.GetSelectedEdlIDs(); }
//Parse action command private void GetActions(string strActionCmd, DBSourceConfig i_Config) { string[] subActionCmds = strActionCmd.Split(','); foreach (string subActionCmd in subActionCmds) { if (!subActionCmd.StartsWith("[") || !strActionCmd.EndsWith("]")) { continue; } string strSubAction = subActionCmd.Substring(1, subActionCmd.Length - 2); int index = strSubAction.IndexOf(":"); if (index < 0) { continue; } string strActionName = strSubAction.Substring(0, index); string strActionValue = strSubAction.Substring(index + 1, strSubAction.Length - index - 1); switch (strActionName) { case "WATERMARK": { if (System.IO.File.Exists(strActionValue)) { i_Config.WartermarkImagePath = strActionValue; } break; } case "CLICKEVENT": { VideoPlayBackManager.ClickEvent = strActionValue != "0"; break; } case "DIAGRAM": { string[] arrDiagram = strActionValue.Split('?'); if (arrDiagram.Length > 0) { VideoPlayBackManager.DiagramScoutType = arrDiagram[0]; } break; } default: break; } } }
public override void UpdateData(object i_Data) { //base.UpdateData (i_Data); // DBSourceConfig m_config = i_Data as DBSourceConfig; m_config.DBConnType = this._ConnType; m_config.WebbDBType = this._WebbDBType; }
private void GetFiles(string command, DBSourceConfig i_Config) { i_Config.Games.Clear(); i_Config.Edls.Clear(); i_Config.UserFolder = string.Empty; i_Config.HeaderName = string.Empty; i_Config.PlayBookFormFiles.Clear(); string strFiles = this._Commands.GetValue(command); if (strFiles == null || strFiles == string.Empty) { return; } string[] arrFiles = strFiles.Split(','); //System.Windows.Forms.MessageBox.Show(strFiles); foreach (string strFile in arrFiles) { if (strFile == string.Empty) { continue; } if (strFile.EndsWith(ExtConst.GameExt)) { //System.Windows.Forms.MessageBox.Show(strFile); i_Config.Games.Add(strFile); } else if (strFile.EndsWith(ExtConst.EdlExt)) { i_Config.Edls.Add(strFile); } else if (strFile.StartsWith(@"[") && strFile.EndsWith(@"]")) { string strUserCmd = strFile.Substring(1, strFile.Length - 2); this.GetUserInfo(strUserCmd, i_Config); } else if (i_Config.WebbDBType == WebbDBTypes.WebbPlaybook && System.IO.File.Exists(strFile)) { i_Config.PlayBookFormFiles.Add(strFile); } else { continue; } } }
public void SetConfig(DBSourceConfig config) { if (!System.IO.Directory.Exists(_ShareUserFolder)) { this.chkShare.Enabled = false; } else { this.chkShare.Enabled = true; } this.chkLocal.Checked = true; this.chkShare.Checked = false; this.ClearAllList(); this.C_TextFolder.Text = this._LocalUserFolder; this.lblShare.Text = "Shared folder Path:" + this._ShareUserFolder; if (this.chkLocal.Checked) { this.LoadFilesName(this._LocalUserFolder); this.C_BtnOpenFolder.Enabled = true; } else { this.C_BtnOpenFolder.Enabled = false; } if (this.chkShare.Checked) { this.LoadFilesName(_ShareUserFolder + "\\Imported Games"); this.lblShare.Visible = true; } else { if (this.chkShare.Enabled) { this.lblShare.Visible = false; } else { this.lblShare.Text = "Unable to access your Shared Games!"; this.lblShare.Visible = true; } } }
private void GetProductType(string strProductCmd, DBSourceConfig i_Config) { if (strProductCmd.ToLower() == "advantage") { i_Config.WebbDBType = WebbDBTypes.WebbAdvantageFootball; } else { try { i_Config.WebbDBType = (WebbDBTypes)Enum.Parse(typeof(WebbDBTypes), strProductCmd, true); } catch { i_Config.WebbDBType = WebbDBTypes.WebbAdvantageFootball; } } }
public override void UpdateData(object i_Data) { if (!(i_Data is DBSourceConfig)) { return; } DBSourceConfig m_DBConfig = i_Data as DBSourceConfig; object item = this.C_CheckList.SelectedItem; if (item == null) { return; } string strConn = item.ToString(); switch (strConn) { case "Local": strConn = m_strLocalPath; break; default: strConn = m_strSharedPath; break; } int index = strConn.IndexOf(';'); strConn = strConn.Substring(index + 1, strConn.Length - index - 1); m_DBConfig.ConnString = strConn; //Modified at 2009-1-6 9:01:04@Scott if (File.Exists(this.m_strIniPath)) { int bsIndex = this.m_strIniPath.LastIndexOf(@"\"); m_DBConfig.UserFolder = this.m_strIniPath.Remove(bsIndex, this.m_strIniPath.Length - bsIndex); } }
public static WebbDataSource CreateDataSourse(string[] args, bool throwException) { if (args == null || args.Length != 10) { return(null); } if (args[3] == "DBConn:" && args[8] == @"Files:") { return(null); } try { CommandManager m_CmdManager = new CommandManager(args); DBSourceConfig m_Config = m_CmdManager.CreateDBConfig(); WebbDataProvider m_DBProvider = new WebbDataProvider(m_Config); WebbDataSource m_DBSource = new WebbDataSource(); m_DBProvider.GetDataSource(m_Config, m_DBSource); Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = m_DBProvider; return(m_DBSource); } catch (Exception ex) { if (throwException) { MessageBox.Show("Bad parameters in Config File!\r\n" + ex.Message); } return(null); } }
public void InitControl() { if (this._DBSourceConfig == null) { _DBSourceConfig = new DBSourceConfig(); } this._DBSourceConfig.ConnString = string.Empty; _DBSourceConfig.WebbDBType = WebbDBTypes.WebbAdvantageFootball; _DBSourceConfig.DBConnType = DBConnTypes.File; if (this.Step_ConfigAdvFile == null) { this.Step_ConfigAdvFile = new ConfigAdvFile(); } this.Step_ConfigAdvFile.SetData(this._DBSourceConfig); this.LoadControl(this.Step_ConfigAdvFile); this.HideNextAndBack(); }
private void InitializeDBConfig(DBSourceConfig i_Config) { //[0]TemplatePath i_Config.Templates.Clear(); string strTemplates = this._Commands.GetValue(M_CommandNames[0]); string[] arrTemplates = strTemplates.Split(','); foreach (string strTemplate in arrTemplates) { string strTemplateName = this.GetTemplateName(strTemplate, '@'); if (File.Exists(strTemplateName)) { i_Config.Templates.Add(strTemplate); } } //[1]Action string strActionCmd = this._Commands.GetValue(M_CommandNames[1]); this.GetActions(strActionCmd, i_Config); //06-19-2008@Scott //[2]Product string strProductCmd = this._Commands.GetValue(M_CommandNames[2]); try { i_Config.WebbDBType = (WebbDBTypes)Enum.Parse(typeof(WebbDBTypes), strProductCmd, true); } catch { i_Config.WebbDBType = WebbDBTypes.WebbAdvantageFootball; } //[7]FilterIDs this.GetFiltersName(i_Config); //[8]Files if (this._Commands.GetValue(M_CommandNames[8]) != string.Empty) { string m_ConnStr = this._Commands.GetValue(M_CommandNames[3]); i_Config.ConnString = m_ConnStr; i_Config.DBConnType = Webb.Data.DBConnTypes.File; #region Modify codes at 2009-2-2 15:32:34@Simon if (m_ConnStr != "") { i_Config.DefaultSQLCmd = this._Commands.GetValue(M_CommandNames[4]); } #endregion //End Modify this.GetFiles(M_CommandNames[8], i_Config); return; } //[3]DBConnStr string m_ConnTypes = this._Commands.GetValue(M_CommandNames[3]); if (m_ConnTypes == StringResource.Default_ConnString_Victory) { i_Config.DBConnType = Webb.Data.DBConnTypes.OleDB; i_Config.DBFilePath = StringResource.Default_AccessFile_Victory; } else if (m_ConnTypes == StringResource.Default_Connstring_Advdantage) { i_Config.DBConnType = Webb.Data.DBConnTypes.SQLDB; i_Config.DBFilePath = StringResource.Default_SQLCatalog; } else { i_Config.DBConnType = Webb.Data.DBConnTypes.OleDB; if (File.Exists(m_ConnTypes)) { i_Config.DBFilePath = m_ConnTypes; } else { i_Config.DBFilePath = StringResource.Default_AccessFile_Victory; } } //[4]SQLCmd i_Config.DefaultSQLCmd = this._Commands.GetValue(M_CommandNames[4]); //[5]GameIDs string m_StrGameIDs = this._Commands.GetValue(M_CommandNames[5]); string[] m_StrGameIDArray = m_StrGameIDs.Split(','); i_Config.GameIDs = new Int32Collection(); foreach (string i_GameID in m_StrGameIDArray) { try { if (i_GameID == string.Empty) { continue; } int m_GameID = Convert.ToInt32(i_GameID); i_Config.GameIDs.Add(m_GameID); } catch { continue; } } //[6]EdlIDs string m_StrEDLIDs = this._Commands.GetValue(M_CommandNames[6]); string[] m_StrEDLIDArray = m_StrEDLIDs.Split(','); i_Config.Edls = new StringCollection(); foreach (string i_EDLID in m_StrEDLIDArray) { try { if (i_EDLID == string.Empty) { continue; } int m_EDLID = Convert.ToInt32(i_EDLID); i_Config.Edls.Add(i_EDLID); } catch { continue; } } //[9]Print }
public override void SetData(object i_Data) { System.Diagnostics.Trace.Assert(i_Data is Webb.Reports.DataProvider.DBSourceConfig); this._DBSourceConfig = i_Data as DBSourceConfig; }
private void GetFiltersName(DBSourceConfig i_Config) { string m_StrFilterCmd = this._Commands.GetValue(M_CommandNames[7]); int indexStart = m_StrFilterCmd.IndexOf('['); int indexEnd = m_StrFilterCmd.IndexOf(']'); string m_StrFilterIDs = string.Empty; if (indexStart < indexEnd) { if (indexStart == 0) { m_StrFilterIDs = this._Commands.GetValue(M_CommandNames[7]).Substring(indexStart + 1, indexEnd - indexStart - 1); string[] arrFilterGroup = m_StrFilterIDs.Split('?'); int index = arrFilterGroup[0].IndexOf(":"); string strFilters = arrFilterGroup[0].Substring(index + 1, arrFilterGroup[0].Length - index - 1); string[] arrFilters = strFilters.Split(','); i_Config.Filters = new StringCollection(); foreach (string strFilter in arrFilters) { i_Config.Filters.Add(strFilter); } } else { if (indexStart < 0) { m_StrFilterIDs = this._Commands.GetValue(M_CommandNames[7]); } else { m_StrFilterIDs = this._Commands.GetValue(M_CommandNames[7]).Substring(0, indexStart); } string[] m_StrFilterIDArray = m_StrFilterIDs.Split(','); i_Config.FilterIDs = new Int32Collection(); foreach (string i_FilterID in m_StrFilterIDArray) { try { if (i_FilterID == string.Empty) { continue; } int m_FilterID = Convert.ToInt32(i_FilterID); i_Config.FilterIDs.Add(m_FilterID); } catch { continue; } } } } }
public DataSourceWizard() { InitializeComponent(); _DBSourceConfig = new DBSourceConfig(); }
public string ExportUnionReportToPdf(string strInwFile, string DestinationPdfFile) { Webb.Utility.CurReportMode = 2; DestinationPdfFile = AdjustPDFFile(DestinationPdfFile); string[] args = InwManager.ReadInwFile(strInwFile); if (args == null) { return("Failed"); } CommandManager m_CmdManager = new CommandManager(args); DBSourceConfig m_Config = m_CmdManager.CreateDBConfig(); WebbDataProvider m_DBProvider = new WebbDataProvider(m_Config); WebbDataSource m_DBSource = new WebbDataSource(); try { m_DBProvider.GetDataSource(m_Config, m_DBSource); ArrayList m_Fields = new ArrayList(); foreach (System.Data.DataColumn m_col in m_DBSource.DataSource.Tables[0].Columns) { if (m_col.Caption == "{EXTENDCOLUMNS}" && m_col.ColumnName.StartsWith("C_")) { continue; } m_Fields.Add(m_col.ColumnName); } Webb.Data.PublicDBFieldConverter.SetAvailableFields(m_Fields); Webb.Reports.DataProvider.VideoPlayBackManager.DataSource = m_DBSource.DataSource; //Set dataset for click event Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = m_DBProvider; //Webb.Reports.DataProvider.VideoPlayBackManager.ReadPictureDirFromRegistry(); Webb.Reports.DataProvider.VideoPlayBackManager.LoadAdvScFilters(); //Modified at 2009-1-19 13:48:30@Scott m_DBProvider.UpdateEFFDataSource(m_DBSource); } catch (Exception e) { return("Failed:at addding datasouce|" + e.Message); } FilterInfoCollection filterInfos = m_DBSource.Filters; //2009-7-1 11:09:08@Simon Add this Code For Union Print if (filterInfos == null) { filterInfos = new FilterInfoCollection(); } if (m_Config.Templates.Count <= 0) { return("Failed"); } XtraReport[] preparedReports = new WebbReport[m_Config.Templates.Count]; if (System.IO.File.Exists(DestinationPdfFile)) { System.IO.File.Delete(DestinationPdfFile); } System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); string dllPath = System.IO.Path.GetDirectoryName(asm.Location); if (!dllPath.EndsWith(@"\")) { dllPath += @"\"; } for (int i = 0; i < m_Config.Templates.Count; i++) { string strTemplate = m_Config.Templates[i]; string strTemplateName = m_CmdManager.GetTemplateName(strTemplate, '@'); //Modified at 2009-2-3 9:17:34@Scott WebbReport m_Report = null; try { m_Report = m_CmdManager.CreateReport(dllPath, strTemplateName); //1 //create report with template } catch (Exception ex) { return("Failed:in create report" + ex.Message); } //Add attached filter here #region Modified Area m_DBSource.Filters = filterInfos.Copy(); //2009-7-1 11:09:04@Simon Add this Code For Union Print string strFilterName = m_CmdManager.GetAttachedFilter(strTemplate, '@'); if (strFilterName != string.Empty) //2009-7-1 11:09:04@Simon For display Filternames In GameListInfo { if (!m_DBProvider.DBSourceConfig.Filters.Contains(strFilterName)) { FilterInfo filterInfo = new FilterInfo(); filterInfo.FilterName = strFilterName; m_DBSource.Filters.Add(filterInfo); } } ScAFilter scaFilter = Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters.GetFilter(strFilterName); //Modified at 2009-1-19 14:25:30@Scott AdvFilterConvertor convertor = new AdvFilterConvertor(); DBFilter AdvFilter = convertor.GetReportFilter(scaFilter).Filter; if (AdvFilter != null || AdvFilter.Count > 0) //2009-5-6 9:38:37@Simon Add this Code { AdvFilter.Add(m_Report.Template.Filter); m_Report.Template.Filter = AdvFilter; } #endregion //Modify at 2008-11-24 16:04:05@Scott try { m_Report.LoadAdvSectionFilters(m_Config.UserFolder); m_Report.SetWatermark(m_Config.WartermarkImagePath); //06-19-2008@Scott m_Report.SetDataSource(m_DBSource); preparedReports[i] = m_Report; } catch (Exception ex2) { return("Failed:load report|" + ex2.Message); } } try { XtraReport.UnionReportsToPdf(preparedReports, DestinationPdfFile); } catch (Exception ex3) { return("Failed:in create PDf Documnet|" + ex3.Message); } if (!System.IO.File.Exists(DestinationPdfFile)) { return("Failed:file didn't exist"); } return(DestinationPdfFile); }
public string CreateReport(string strInwFile, string strFile, string dllpath) { Webb.Utility.CurReportMode = 2; strFile = AdjustPDFFile(strFile); string[] args = InwManager.ReadInwFile(strInwFile); if (args == null) { return("Failed"); } CommandManager m_CmdManager = new CommandManager(args); DBSourceConfig m_Config = m_CmdManager.CreateDBConfig(); WebbDataProvider m_DBProvider = new WebbDataProvider(m_Config); WebbDataSource m_DBSource = new WebbDataSource(); try { m_DBProvider.GetDataSource(m_Config, m_DBSource); ArrayList m_Fields = new ArrayList(); foreach (System.Data.DataColumn m_col in m_DBSource.DataSource.Tables[0].Columns) { if (m_col.Caption == "{EXTENDCOLUMNS}" && m_col.ColumnName.StartsWith("C_")) { continue; } m_Fields.Add(m_col.ColumnName); } Webb.Data.PublicDBFieldConverter.SetAvailableFields(m_Fields); Webb.Reports.DataProvider.VideoPlayBackManager.DataSource = m_DBSource.DataSource; //Set dataset for click event Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = m_DBProvider; Webb.Reports.DataProvider.VideoPlayBackManager.LoadAdvScFilters(); //Modified at 2009-1-19 13:48:30@Scott m_DBProvider.UpdateEFFDataSource(m_DBSource); Webb.Reports.DataProvider.VideoPlayBackManager.ReadPictureDirFromRegistry(); } catch (Exception e) { return("Failed:at addding datasouce|" + e.Message); } FilterInfoCollection filterInfos = m_DBSource.Filters; //2009-7-1 11:09:08@Simon Add this Code For Union Print if (filterInfos == null) { filterInfos = new FilterInfoCollection(); } if (m_Config.Templates.Count <= 0) { return("Failed:No tempaltes"); } string strTemplate = m_Config.Templates[0]; string strTemplateName = m_CmdManager.GetTemplateName(strTemplate, '@'); //Modified at 2009-2-3 9:17:34@Scott WebbReport m_Report = null; try { m_Report = m_CmdManager.CreateReport(dllpath, strTemplateName); //1 //create report with template } catch (Exception ex) { return("Failed:Can't load report template" + ex.Message); } //Add attached filter here #region Modified Area m_DBSource.Filters = filterInfos.Copy(); //2009-7-1 11:09:04@Simon Add this Code For Union Print string strFilterName = m_CmdManager.GetAttachedFilter(strTemplate, '@'); if (strFilterName != string.Empty) //2009-7-1 11:09:04@Simon For display Filternames In GameListInfo { if (!m_DBProvider.DBSourceConfig.Filters.Contains(strFilterName)) { FilterInfo filterInfo = new FilterInfo(); filterInfo.FilterName = strFilterName; m_DBSource.Filters.Add(filterInfo); } } ScAFilter scaFilter = Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters.GetFilter(strFilterName); //Modified at 2009-1-19 14:25:30@Scott AdvFilterConvertor convertor = new AdvFilterConvertor(); DBFilter AdvFilter = convertor.GetReportFilter(scaFilter).Filter; if (AdvFilter != null || AdvFilter.Count > 0) //2009-5-6 9:38:37@Simon Add this Code { AdvFilter.Add(m_Report.Template.Filter); m_Report.Template.Filter = AdvFilter; } SectionFilterCollection sectionFilter = m_Report.Template.SectionFilters.Copy(); if (m_Report.Template.ReportScType == ReportScType.Custom) { m_Report.Template.SectionFilters = AdvFilterConvertor.GetCustomFilters(Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters, sectionFilter); } #endregion //Modify at 2008-11-24 16:04:05@Scott try { if (System.IO.File.Exists(strFile)) { System.IO.File.Delete(strFile); } m_Report.LoadAdvSectionFilters(m_Config.UserFolder); m_Report.SetWatermark(m_Config.WartermarkImagePath); //06-19-2008@Scott m_Report.SetDataSource(m_DBSource); m_Report.CreatePdfDocument(strFile); if (!System.IO.File.Exists(strFile)) { return("Failed:dll path " + dllpath); } } catch (Exception ex2) { return("Failed:in create PDf Documnet|" + ex2.Message); } return(strFile); }
//10-14-2011 Scott Read public string CreatePlayerReport(DataSet ds, string strDestineFile, string dllpath, string strUserFolder, string[] templateFiles) { WebbLog.Instance.WriteLog("AdjustPDFFile"); strDestineFile = AdjustPDFFile(strDestineFile); WebbLog.Instance.WriteLog("AdjustPDFFile Complete"); if (!strUserFolder.EndsWith(@"\")) { strUserFolder += @"\"; } WebbLog.Instance.WriteLog("new WebbReport"); XtraReport[] preparedReports = new WebbReport[templateFiles.Length]; WebbLog.Instance.WriteLog("new WebbReport Complete"); try { if (System.IO.File.Exists(strDestineFile)) { System.IO.File.Delete(strDestineFile); } WebbLog.Instance.WriteLog("ReplaceImagePathAndUnionTable"); ds = this.ReplaceImagePathAndUnionTable(ds, strUserFolder); WebbLog.Instance.WriteLog("ReplaceImagePathAndUnionTable Complete"); DBSourceConfig dBSourceConfig = new DBSourceConfig(); dBSourceConfig.WebbDBType = WebbDBTypes.CoachCRM; Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = new WebbDataProvider(dBSourceConfig); WebbLog.Instance.WriteLog("for"); for (int i = 0; i < templateFiles.Length; i++) { WebbLog.Instance.WriteLog("1"); templateFiles[i] = templateFiles[i].Replace(@"/", @"\"); string strTemplate = strUserFolder + templateFiles[i]; if (strTemplate != string.Empty) { WebbLog.Instance.WriteLog("2"); WebbDataSource m_DBSource = new WebbDataSource(); m_DBSource.DataSource = ds.Copy(); WebbLog.Instance.WriteLog("3"); ArrayList m_Fields = new ArrayList(); foreach (System.Data.DataColumn m_col in m_DBSource.DataSource.Tables[0].Columns) { if (m_col.Caption == "{EXTENDCOLUMNS}" && m_col.ColumnName.StartsWith("C_")) { continue; } m_Fields.Add(m_col.ColumnName); } WebbLog.Instance.WriteLog("5"); Webb.Data.PublicDBFieldConverter.SetAvailableFields(m_Fields); WebbLog.Instance.WriteLog("6"); Webb.Reports.DataProvider.VideoPlayBackManager.DataSource = m_DBSource.DataSource; //Set dataset for click event WebbReport m_Report = new WebbReport(); WebbLog.Instance.WriteLog("7"); Webb.Utility.ReplaceRefPathInRepxFile(strTemplate, dllpath); //Modify template file WebbLog.Instance.WriteLog("8"); m_Report.LoadLayout(strTemplate); WebbLog.Instance.WriteLog("9"); Webb.Utility.CurFileName = strTemplate; //06-23-2008@Scott m_Report.SetDataSource(m_DBSource); preparedReports[i] = m_Report; WebbLog.Instance.WriteLog("10"); } } WebbLog.Instance.WriteLog("for complete"); } catch (Exception ex) { return("Failed:in create report|" + ex.Message); } try { WebbLog.Instance.WriteLog("11"); if (preparedReports.Length == 1) { WebbLog.Instance.WriteLog("22"); preparedReports[0].CreatePdfDocument(strDestineFile); WebbLog.Instance.WriteLog("33"); } else { WebbLog.Instance.WriteLog("44"); XtraReport.UnionReportsToPdf(preparedReports, strDestineFile); WebbLog.Instance.WriteLog("55"); } } catch (Exception ex2) { return("Failed:in create PDf Document|" + ex2.Message); } if (!System.IO.File.Exists(strDestineFile)) { return("Failed:Undestine Pdf Error in create PDF"); } return(strDestineFile); }
public string CreateGameReport(string[] strCommands, string strDestinePdfFile, string strDllPath) { Webb.Utility.CurReportMode = 2; strDestinePdfFile = AdjustPDFFile(strDestinePdfFile); if (strCommands == null) { return("Failed"); } CommandManager m_CmdManager = new CommandManager(strCommands); DBSourceConfig m_Config = m_CmdManager.CreateDBConfig(); WebbDataProvider m_DBProvider = new WebbDataProvider(m_Config); WebbDataSource m_DBSource = new WebbDataSource(); try { m_DBProvider.GetDataSource(m_Config, m_DBSource); ArrayList m_Fields = new ArrayList(); foreach (System.Data.DataColumn m_col in m_DBSource.DataSource.Tables[0].Columns) { if (m_col.Caption == "{EXTENDCOLUMNS}" && m_col.ColumnName.StartsWith("C_")) { continue; } m_Fields.Add(m_col.ColumnName); } Webb.Data.PublicDBFieldConverter.SetAvailableFields(m_Fields); Webb.Reports.DataProvider.VideoPlayBackManager.DataSource = m_DBSource.DataSource; //Set dataset for click event Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = m_DBProvider; Webb.Reports.DataProvider.VideoPlayBackManager.LoadAdvScFilters(); //Modified at 2009-1-19 13:48:30@Scott m_DBProvider.UpdateEFFDataSource(m_DBSource); } catch (Exception e) { return("Failed:at addding datasouce|" + e.Message); } if (m_Config.Templates.Count <= 0) { return("Failed:No tempaltes"); } XtraReport[] preparedReports = new WebbReport[m_Config.Templates.Count]; for (int i = 0; i < m_Config.Templates.Count; i++) { string strTemplateName = m_Config.Templates[i]; WebbReport m_Report = null; try { m_Report = m_CmdManager.CreateReport(strDllPath, strTemplateName); //1 //create report with template } catch (Exception ex) { return("Failed:Can't load report template" + ex.Message); } try { m_Report.LoadAdvSectionFilters(m_Config.UserFolder); m_Report.SetWatermark(m_Config.WartermarkImagePath); //06-19-2008@Scott m_Report.SetDataSource(m_DBSource); preparedReports[i] = m_Report; } catch (Exception ex2) { return("Failed:in create PDf Documnet\r\n" + strTemplateName + "\r\n" + ex2.Message); } } try { if (System.IO.File.Exists(strDestinePdfFile)) { System.IO.File.Delete(strDestinePdfFile); } XtraReport.UnionReportsToPdf(preparedReports, strDestinePdfFile); } catch (Exception ex3) { return("Failed:in create PDf Documnet|" + ex3.Message); } if (!System.IO.File.Exists(strDestinePdfFile)) { return("Failed:some error happed,and report could not be created!"); } return(strDestinePdfFile); }