Example #1
0
 public void SetSectionFilters(SectionFilterCollection i_Sections)
 {        //Modified at 2008-11-3 14:31:58@Scott
     if (i_Sections != null)
     {
         this.SectionFilters.Apply(i_Sections);
     }
 }
Example #2
0
        public void SortSections(DataTable i_Table, Int32Collection i_InnerRows)
        {
            if (this.SortingBy == SortingByTypes.None)
            {
                return;
            }

            if (this.SectionFilters.Count == 0)
            {
                return;
            }

            SectionGroupInfo sectionGroup = this.Copy() as SectionGroupInfo;

            sectionGroup.SubGroupInfos = null;

            sectionGroup.CalculateGroupResult(i_Table, i_InnerRows, i_InnerRows, sectionGroup);

            sectionGroup.GroupResults.Sort(this.Sorting, this.SortingBy, this.UserDefinedOrders);

            SectionFilterCollection sectionFilters = new SectionFilterCollection();

            foreach (GroupResult result in sectionGroup.GroupResults)
            {
                string name = result.GroupValue.ToString();

                SectionFilter scFilter = sectionGroup.Sections(name);

                sectionFilters.Add(scFilter);
            }

            this.SectionFiltersWrapper = new SectionFilterCollectionWrapper(sectionFilters, ReportScType.Custom);

            this.SectionFilters = sectionFilters;
        }
Example #3
0
        // 08-22-2011 Scott
        public bool UpdateEffFilter()
        {
            this.C_LBAdvFilters.Items.Clear();

            this.txtValue.Text = string.Empty;

            ScFilterList scFilterList = Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters;

            AdvFilterConvertor convert = new AdvFilterConvertor();

            sectionFilters = convert.GetEffFilters(scFilterList);

            if (sectionFilters.Count > 0)
            {
                foreach (SectionFilter filter in sectionFilters)
                {
                    this.C_LBAdvFilters.Items.Add(filter);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        private void RemoveSectionFilters()
        {
            this.C_FilterList.Nodes.Clear();

            this.SectionFilters.Clear();

            this.SectionFiltersWrapper.SectionFilters = this.SectionFilters;                    //Modified at 2009-1-15 10:43:11@Scott
        }
Example #5
0
        public SectionGroupInfo(SectionFilterCollection sectionFilters)
        {
            this._OneValuePerRow = true;

            this.SectionFiltersWrapper.SectionFilters.Apply(sectionFilters);               //Added this code at 2009-1-24 12:51:35@Simon

            this.SectionFilters.Apply(sectionFilters);
        }
Example #6
0
        public SectionGroupInfo(PageSectionInfo pageGroupInfo) : base(pageGroupInfo)
        {
            this._OneValuePerRow = true;

            this.SectionFiltersWrapper = pageGroupInfo.SectionFilterWrapper;     //Added this code at 2009-1-24 12:51:35@Simon

            this._SectionFiltersWrapper.UpdateSectionFilters();

            this._SectionFilters = this._SectionFiltersWrapper.SectionFilters;
        }
Example #7
0
        public bool LoadAdvSectionFilters(string strUserFolder, ReportScType rsctype)
        {//Modified at 2009-1-19 14:23:11@Scott
            AdvFilterConvertor convertor = new AdvFilterConvertor();

            this.SectionFilters = convertor.GetReportFilters(Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters, rsctype); //add 1-19-2008 scott

            this.SectionFiltersWrapper.SectionFilters = this.SectionFilters;                                                            //Modified at 2009-1-15 10:43:11@Scott

            return(true);
        }
Example #8
0
        private void AddFilters(SectionFilterCollection i_SectionFilters)
        {
            this.C_FilterList.Nodes.Clear();

            foreach (SectionFilter m_Filter in i_SectionFilters)
            {
                TreeNode m_Node = new TreeNode(m_Filter.FilterName);
                m_Node.Tag = m_Filter;
                this.C_FilterList.Nodes.Add(m_Node);
            }
        }
 public ConfigFieldPanelLayout()
 {
     // This call is required by the Windows.Forms Form Designer.
     InitializeComponent();
     this.C_Buttons       = new ArrayList();
     this._ColsInRows     = new Int32Collection();
     this._LayOut         = new FieldLayOut();
     this._SectionFilters = new SectionFilterCollection();
     this.SetStyle(ControlStyles.DoubleBuffer, true);
     SetStyle(ControlStyles.Opaque, true);
     // TODO: Add any initialization after the InitializeComponent call
 }
Example #10
0
        private void UpdateScFilters(string strName, SectionFilter newFilter)
        {
            foreach (SectionFilter scFilter in this.SectionFilters)
            {
                if (scFilter.FilterName == strName)
                {
                    scFilter.Apply(newFilter);
                }
            }
            this.SectionFiltersWrapper.SectionFilters = this.SectionFilters;

            this.AddFilters(this.SectionFilters);
        }
        public SectionFilterCollection GetSelectedSectionFilters()
        {
            SectionFilterCollection secFilters = new SectionFilterCollection();

            foreach (object item in this.C_ListSelectedSecFilters.Items)
            {
                if (item is SectionFilter)
                {
                    secFilters.Add(item as SectionFilter);
                }
            }

            return(secFilters);
        }
Example #12
0
        public SectionFiltersEditorForm(object value)
        {
            if (DataProvider == null)
            {
                this.DataProvider = new Webb.Reports.DataProvider.WebbDataProvider();
            }
            InitializeComponent();
            this.cmbAttribute.SelectedIndex = 0;
            if (value != null)
            {
                SectionFilterCollection i_SectionFilters = null;

                if (value is SectionFilterCollectionWrapper)
                {
                    i_SectionFilters = (value as SectionFilterCollectionWrapper).SectionFilters;                        //Modified at 2009-1-15 10:27:08@Scott
                    int index = (int)((value as SectionFilterCollectionWrapper).ReportScType);                          //Modified at 2009-1-15 11:26:10@Scott

                    if (index < 5)
                    {
                        this.cmbAttribute.SelectedIndex = index;
                    }
                    else
                    {
                        this.cmbAttribute.SelectedIndex = this.cmbAttribute.Items.Count - 1;
                    }

                    if ((value as SectionFilterCollectionWrapper).ReportScType != ReportScType.Custom)
                    {
                        this.LoadAdvSectionFilters(string.Empty, (value as SectionFilterCollectionWrapper).ReportScType);
                        this.AddFilters(this.SectionFilters);
                        return;
                    }
                }
                else if (value is SectionFilterCollection)
                {
                    i_SectionFilters = value as SectionFilterCollection;
                }
                else
                {
                    i_SectionFilters = new SectionFilterCollection();
                }
                this.AddFilters(i_SectionFilters);
                this.SectionFilters = i_SectionFilters;
                this.SectionFiltersWrapper.SectionFilters = this.SectionFilters;                        //Modified at 2009-1-15 10:43:11@Scott
            }
        }
        public AdvReportSectionFiltersForm(SectionFilterCollection sectionFilters)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this._InitSectionFilters = sectionFilters;

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.Load += new EventHandler(CustomSectionFiltersForm_Load);

            this._SaveFileDialog = new NameForm();

            this._PropertyForm = new PropertyForm();
        }
Example #14
0
        public new bool Update()
        {
            this.C_LBAdvFilters.Items.Clear();

            this.txtValue.Text = string.Empty;

            ScFilterList scFilterList = Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters;

//			if(scFilterList==null)
//			{
//				object objUserFolder = RegKey.GetValue(KeyName);
//
//				if(objUserFolder == null) return false;
//
//				string strUserFolder = objUserFolder.ToString();
//
//				if(strUserFolder.EndsWith("\\")) strUserFolder = strUserFolder.Remove(strUserFolder.Length - 1,1);
//
//				int index = strUserFolder.LastIndexOf('\\');
//
//				strUserFolder = strUserFolder.Remove(index + 1,strUserFolder.Length - index - 1);
//
//				strUserFolder += @"WebbRpt\ScFilter.dat";
//
//				if(!scFilterList.ReadOldFiltersFromDisk(strUserFolder))return false;
//			}

            AdvFilterConvertor convert = new AdvFilterConvertor();

            sectionFilters = convert.GetReportFilters(scFilterList);

            if (sectionFilters.Count > 0)
            {
                foreach (SectionFilter filter in sectionFilters)
                {
                    this.C_LBAdvFilters.Items.Add(filter);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #15
0
        public bool LoadSectionFilters(Int32Collection nCols, SectionFilterCollection secFilters)
        {
            if (nCols == null)
            {
                return(false);
            }
            if (secFilters == null)
            {
                return(false);
            }

            int lack = GetCount(nCols) - secFilters.Count;

            if (lack > 0)
            {
                for (int i = 0; i < lack; i++)
                {
                    secFilters.Add(new SectionFilter(new Webb.Data.DBFilter()));
                }
            }
            return(true);
        }
Example #16
0
        //Add summaries by section filters
        private void Menu_AddSectionSummarys_Click(object sender, System.EventArgs e)
        {
            TreeNode m_Node = this.C_GroupInfoTree.SelectedNode;

            if (m_Node == null)
            {
                return;
            }

            while (!(m_Node.Tag is GroupInfo))
            {
                m_Node = m_Node.Parent;
            }

            if (m_Node.Parent == null)
            {
                ReportScType reportScType = (m_Node.Tag as GroupInfo).ReportScType;     //Modified at 2009-1-21 14:38:11@Scott

                SectionFilterCollection secFilters = new SectionFilterCollection();

                SectionFilterCollectionWrapper wrapper = new SectionFilterCollectionWrapper(secFilters, reportScType); //Modified at 2009-1-21 14:38:06@Scott

                SectionFiltersEditorForm editForm = new SectionFiltersEditorForm(wrapper);                             //Modified at 2009-1-21 14:37:57@Scott

                if (editForm.ShowDialog() == DialogResult.OK)
                {
                    this.RemoveALlSummaryNodes(m_Node);                                                   //Modified at 2009-1-21 15:27:18@Scott

                    (m_Node.Tag as GroupInfo).ReportScType = editForm.SectionFiltersWrapper.ReportScType; //Modified at 2009-1-21 14:37:47@Scott

                    secFilters.Apply(editForm.SectionFilters);

                    foreach (SectionFilter secFilter in secFilters)
                    {
                        this.AddSummary(m_Node, secFilter);
                    }
                }
            }
        }
        public void UpdateSectionFilters(SectionFilterCollection secFilters)
        {
            if (secFilters == null)
            {
                return;
            }

            secFilters.Clear();

            for (int i = 0; i < this.C_Buttons.Count; i++)
            {
                ButtonTags pctag = (ButtonTags)(this.C_Buttons[i] as Control).Tag;

                SectionFilter secFilter = pctag.filter;

                SectionFilter newSecFilter = new SectionFilter();

                newSecFilter.Apply(secFilter);

                secFilters.Add(newSecFilter);
            }
        }
Example #18
0
        public SectionGroupInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context)
        {
            try
            {
                _ShowZero = info.GetBoolean("_ShowZero");
            }
            catch
            {
                _ShowZero = true;
            }
            try
            {
                Visible = info.GetBoolean("Visible");
            }
            catch
            {
                Visible = true;
            }

            try
            {
                _SectionFilters = info.GetValue("_SectionFilters", typeof(SectionFilterCollection)) as SectionFilterCollection;
            }
            catch
            {
                _SectionFilters = new SectionFilterCollection();
            }

            //Modified at 2009-1-21 13:54:02@Scott
            try
            {
                this.SectionFiltersWrapper = info.GetValue("SectionFiltersWrapper", typeof(SectionFilterCollectionWrapper)) as SectionFilterCollectionWrapper;
            }
            catch
            {
                //this.SectionFiltersWrapper = new SectionFilterCollectionWrapper();
            }
        }
        private void CreateSectionGroupInfo(SectionFilterCollection i_Sections)
        {
            if (this._RootGroupInfo is SectionGroupInfo)
            {
                (this._RootGroupInfo as SectionGroupInfo).SetSectionFilters(i_Sections);
            }
            else
            {
                SectionGroupInfo m_SectionInfo = new SectionGroupInfo();

                m_SectionInfo.SetSectionFilters(i_Sections);

                m_SectionInfo.SubGroupInfos.Clear();

                m_SectionInfo.SubGroupInfos.Add(this._RootGroupInfo);

                this._RootGroupInfo = m_SectionInfo;
            }

            this._RootGroupInfo.ColumnHeading = this.SectionTitle;

            this._RootGroupInfo.DistinctValues = this.SectionInOneRow;
        }
        private void CheckSectionFilters()
        {        //need change
            if (this.ExControl == null)
            {
                return;
            }
            if (this.ExControl.Report == null)
            {
                return;
            }
            WebbReport m_WebbReport = this.ExControl.Report as WebbReport;

            if (m_WebbReport == null)
            {
                return;
            }
            if (m_WebbReport.Template.SectionFilters.Count <= 0)
            {
                this.RemoveSectionFilters();
            }
            else
            {
                SectionFilterCollection reportSections = m_WebbReport.Template.SectionFilters;

                AdvFilterConvertor convertor = new AdvFilterConvertor();

                if (DataProvider.VideoPlayBackManager.AdvSectionType != AdvScoutType.None && m_WebbReport.Template.ReportScType != ReportScType.Custom)
                {
                    ReportScType sctype = AdvFilterConvertor.GetScType(m_WebbReport.Template.ReportScType, DataProvider.VideoPlayBackManager.AdvSectionType);   //2009-6-16 10:18:47@Simon Add this Code

                    reportSections = convertor.GetReportFilters(Webb.Reports.DataProvider.VideoPlayBackManager.AdvReportFilters, sctype);                       //add 1-19-2008 scott
                }

                this.CreateSectionGroupInfo(reportSections);
            }
        }
Example #21
0
        private void BtnLoadAdvReportFilters_Click(object sender, EventArgs e)
        {
            if (this.cmbAttribute.SelectedIndex != 0)
            {
                Webb.Utilities.MessageBoxEx.ShowError("Can not convert Non-Custom sections to custom, Please change the 'Attribute' to 'Custom'!");

                return;
            }
            if (this.SectionFilters == null)
            {
                this.SectionFilters = new SectionFilterCollection();
            }

            DialogResult m_result = this.DataProvider.ShowAdvReportFilterSelector(this.SectionFilters);

            if (m_result == DialogResult.OK)
            {
                this.cmbAttribute.SelectedIndex = 0;

                this.AddFilters(this.SectionFilters);

                this.SectionFiltersWrapper.SectionFilters = this.SectionFilters;                        //Modified at 2009-1-15 10:43:11@Scott
            }
        }
Example #22
0
        static void Main(string[] args)
        {
            if (args == null || (args.Length != 1 && args.Length != 10))
            {
                return;
            }

            ReportFileType fileType = ReportFileType.Report;

            DataSet dsDataset = null;

            if (args.Length == 1)
            {
                string filename = args[0];

                if (filename.IndexOf("\n") > 0)
                {
                    args = filename.Split("\n".ToCharArray());

                    if (args.Length != 10)
                    {
                        return;
                    }
                }
                else if (filename.EndsWith(".wmks"))
                {
                    wmksFileManager.WriteFile(filename);

                    return;
                }
                else if (filename.EndsWith(".repx"))
                {
                    string Inwfilename = filename.Replace(".repx", ".inw");

                    args = InwManager.ReadInwFile(Inwfilename);

                    fileType = ReportFileType.InwFile;

                    if (args == null)
                    {
                        args = ConfigFileManager.ReadDataConfig(filename);

                        fileType = ReportFileType.BaseXmlFile;
                    }
                }
                else if (filename.EndsWith(".repw"))
                {
                    string Inwfilename = filename.Replace(".repw", ".inw");

                    args = InwManager.ReadInwFile(Inwfilename);

                    fileType = ReportFileType.InwFile;

                    if (args == null)
                    {
                        args = ConfigFileManager.ReadDataConfig(filename);

                        fileType = ReportFileType.BaseXmlFile;
                    }
                }
                else if (filename.EndsWith(".inw"))
                {
                    args = InwManager.ReadInwFile(filename);

                    fileType = ReportFileType.InwFile;
                }
                else if (filename.EndsWith(".wrdf"))
                {
                    WrdfFileManager.ReadDataConfig(filename, out dsDataset, out args);

                    fileType = ReportFileType.WebbDataFile;
                }
                else
                {
                    return;
                }
                if (args == null)
                {
                    return;
                }
            }

            if (args[3] == "DBConn:" && args[8] == @"Files:")
            {
                return;
            }

            Webb.Utility.CurReportMode = 1;             //set browser mode

            ThreadStart ts = new ThreadStart(LoadingThreadProc);

            Thread thread = new Thread(ts);

            thread.Start();

            CommandManager m_CmdManager = new CommandManager(args);

            //Calculate data source
            if (thread.IsAlive)
            {
                LoadingForm.MessageText = "Loading Data Source...";
            }

            DBSourceConfig m_Config = m_CmdManager.CreateDBConfig();

            if (m_Config.Templates.Count == 0)
            {
                if (thread.IsAlive)
                {
                    LoadingForm.Close();

                    thread.Abort();
                }

                Webb.Utilities.TopMostMessageBox.ShowMessage("Invalid template report name!", MessageBoxButtons.OK);

                Environment.Exit(0);
            }


            if (m_CmdManager.PrintDirectly)
            {
                if (PrinterSettings.InstalledPrinters.Count == 0)
                {
                    if (thread.IsAlive)
                    {
                        LoadingForm.Close();

                        thread.Abort();
                    }

                    Webb.Utilities.TopMostMessageBox.ShowMessage("No printer driver is installed!", MessageBoxButtons.OK);

                    Environment.Exit(0);
                }
            }

            WebbDataProvider m_DBProvider = new WebbDataProvider(m_Config);

            WebbDataSource m_DBSource = new WebbDataSource();

            if (fileType == ReportFileType.WebbDataFile && dsDataset == null)
            {
                m_DBSource.DataSource = dsDataset.Copy();
            }
            else
            {
                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.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider = m_DBProvider;

            Webb.Data.PublicDBFieldConverter.SetAvailableFields(m_Fields);

            Webb.Reports.DataProvider.VideoPlayBackManager.LoadAdvScFilters();  //Modified at 2009-1-19 13:48:30@Scott

            Webb.Reports.DataProvider.VideoPlayBackManager.ReadPictureDirFromRegistry();

            m_DBProvider.UpdateEFFDataSource(m_DBSource);

            Webb.Reports.DataProvider.VideoPlayBackManager.DataSource = m_DBSource.DataSource;  //Set dataset for click event


            //Loading report template
            if (thread.IsAlive)
            {
                LoadingForm.MessageText = "Loading Report Template...";
            }

            #region Modified Area
            ArrayList printedReports = new ArrayList();

            ArrayList invalidateReports = new ArrayList();

            bool unionprint = m_CmdManager.UnionPrint;

            #endregion                    //End Modify at 2008-10-10 14:29:49@Simon


            FilterInfoCollection filterInfos = m_DBSource.Filters;            //2009-7-1 11:09:08@Simon Add this Code  For Union Print

            if (filterInfos == null)
            {
                filterInfos = new FilterInfoCollection();
            }

            string printerName = m_CmdManager.PrinterName;

            foreach (string strTemplate in m_Config.Templates)
            {
                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(Application.ExecutablePath, strTemplateName);                          //1 //create report with template

                    //09-01-2011@Scott
                    if (m_Config.WebbDBType == WebbDBTypes.WebbPlaybook)
                    {
                        SetReportHeader(m_Config, m_Report, m_Config.HeaderName);  //Add this code at 2011-7-28 16:23:41@simon
                    }
                    else
                    {
                        string strHeader = m_CmdManager.GetAttachedHeader(strTemplate, '@');

                        SetReportHeader(m_Config, m_Report, strHeader);
                    }
                    //End
                }
                catch (Exception ex)
                {
                    Webb.Utilities.TopMostMessageBox.ShowMessage("Error", "Can't load report template!\r\n" + ex.Message, MessageBoxButtons.OK);

                    m_Report = new WebbReport();
                }

                bool Canopen = CheckedUserRight(m_Report.LicenseLevel, m_Config.WebbDBType);

                string filename = System.IO.Path.GetFileNameWithoutExtension(strTemplateName);

                if (!Canopen)
                {
                    invalidateReports.Add(filename);
                }
                else
                {
                    //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

                    //Set data source
                    if (thread.IsAlive)
                    {
                        LoadingForm.MessageText = "Set Data Source...";
                        LoadingForm.ProcessText = Webb.Utility.GetCurFileName();
                    }

                    m_Report.LoadAdvSectionFilters(m_Config.UserFolder);

                    m_Report.SetWatermark(m_Config.WartermarkImagePath);                        //06-19-2008@Scott

                    m_Report.SetDataSource(m_DBSource);
                }

                if (m_CmdManager.PrintDirectly)
                {
                    if (!Canopen)
                    {
                        if (!unionprint)
                        {
                            Webb.Utilities.TopMostMessageBox.ShowMessage("LicenseLevel Error", "This report is not designed for your Webb application!" + "", MessageBoxButtons.OK);
                        }
                        continue;
                    }
                    else
                    {
                        printedReports.Add(m_Report);
                    }

                    #region Modified Area
                    if (unionprint)
                    {
                        continue;                                       //Modified at 2008-10-10 10:04:37@Simon
                    }
                    //Print
                    if (Webb.Utility.CancelPrint)
                    {
                        if (thread.IsAlive)
                        {
                            LoadingForm.Close();

                            thread.Join();
                        }

                        return;
                    }

                    if (thread.IsAlive)
                    {
                        LoadingForm.MessageText = "Printing...";
                    }

                    if (printerName != string.Empty)
                    {
                        if (!PrinterExist(printerName))
                        {
                            Webb.Utilities.TopMostMessageBox.ShowMessage("Failed to Print", "WRB Cann't Find The Printer '" + printerName + "' in you system,please check the printer setting!",
                                                                         MessageBoxButtons.OK);
                            Environment.Exit(-1);
                        }
                        m_Report.Print(printerName);
                    }
                    else
                    {
                        m_Report.Print();
                    }
                    #endregion                            //End Modify at 2008-10-9 16:54:58@Simon
                }
                else
                {                //Browser
                    //Create report
                    if (thread.IsAlive)
                    {
                        LoadingForm.MessageText = "Creating Report Browser...";
                    }

                    WebbRepBrowser m_Browser = new WebbRepBrowser();

                    //m_Browser.LoadReport(new WebbReport[]{m_Report,m_Report});	//multiply report

                    if (m_Config.WebbDBType.ToString().ToLower().StartsWith("webbvictory"))
                    {
                        m_Browser.TopMost = true;
                    }
                    else
                    {
                        m_Browser.TopMost = false;
                    }
                    if (Canopen)
                    {
                        m_Browser.LoadReport(m_Report);
                    }

                    if (thread.IsAlive)
                    {
                        LoadingForm.Close();

                        thread.Join();
                    }

                    Webb.Reports.DataProvider.VideoPlayBackManager.PublicBrowser = m_Browser;                           //05-04-2008@Scott

                    if (!Canopen)
                    {
                        m_Browser.ReportName = filename;

                        m_Browser.InvertZorder();
//						Webb.Utilities.TopMostMessageBox.ShowMessage("LicenseLevel Error", "This report is not designed for your Webb application!\n So it would not open" + "", MessageBoxButtons.OK);
                    }

                    Application.Run(m_Browser);
                }
            }
            //add these codes for join all reports to print in only one document
            #region Modified Area

            WebbReport[] AllReportsToPrint = new WebbReport[printedReports.Count];

            for (int i = 0; i < printedReports.Count; i++)
            {
                AllReportsToPrint[i] = printedReports[i] as WebbReport;
            }

            if (m_CmdManager.PrintDirectly && unionprint)
            {
                if (AllReportsToPrint.Length == 0)
                {
                    Webb.Utilities.TopMostMessageBox.ShowMessage("No document", "No document could be print!",
                                                                 MessageBoxButtons.OK);
                }
                else
                {
                    if (thread.IsAlive)
                    {
                        LoadingForm.MessageText = "Printing...";

                        LoadingForm.ProcessText = "Union Printing Documents";
                    }

                    if (invalidateReports.Count > 0)
                    {
                        Webb.Utilities.AutoClosedMessageBox.ShowMessage(invalidateReports);
                    }
                    if (printerName != string.Empty)
                    {
                        if (!PrinterExist(printerName))
                        {
                            Webb.Utilities.TopMostMessageBox.ShowMessage("Failed to Print", "WRB Cann'i Find The Printer '" + printerName + "' in you system,\nplease check the printer setting!",
                                                                         MessageBoxButtons.OK);
                            Environment.Exit(-1);
                        }

                        WebbReport.Print(printerName, AllReportsToPrint);
                    }
                    else
                    {
                        WebbReport.Print(AllReportsToPrint);
                    }
                }
            }
            #endregion                    //End Modify at 2008-10-10 9:42:07@Simon

            if (thread.IsAlive)
            {
                LoadingForm.Close();

                thread.Join();
            }
        }
        //Fill Left List
        private void LoadSectionFilters()
        {
            this.C_ListSecFilters.Items.Clear();

            this.C_ListSelectedSecFilters.Items.Clear();

            ScFilterList scFilterList = new ScFilterList();

            object objUserFolder = RegKey.GetValue(KeyName);

            if (objUserFolder == null)
            {
                return;
            }

            string strUserFolder = objUserFolder.ToString();

            if (strUserFolder.EndsWith("\\"))
            {
                strUserFolder = strUserFolder.Remove(strUserFolder.Length - 1, 1);
            }

            int index = strUserFolder.LastIndexOf('\\');

            strUserFolder = strUserFolder.Remove(index + 1, strUserFolder.Length - index - 1);

            strUserFolder += @"WebbRpt\ScFilter.dat";

            ArrayList arrList = new ArrayList();

            if (this._InitSectionFilters != null)
            {
                foreach (SectionFilter scFilter in this._InitSectionFilters)
                {
                    this.C_ListSelectedSecFilters.Items.Add(scFilter);

                    arrList.Add(scFilter.FilterName);
                }
            }


            if (scFilterList.ReadOldFiltersFromDisk(strUserFolder))
            {
                AdvFilterConvertor convertor = new AdvFilterConvertor();

                SectionFilterCollection sectionFilters = convertor.GetReportFilters(scFilterList);

                foreach (SectionFilter filter in sectionFilters)
                {
                    if (!arrList.Contains(filter.FilterName))
                    {
                        this.C_ListSecFilters.Items.Add(filter);
                    }
                }
            }

            if (this.C_ListSecFilters.Items.Count > 0)
            {
                this.C_ListSecFilters.SelectedIndex = 0;
            }
        }
        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);
        }
Example #25
0
//        public void LoadLayout(FieldLayOut layout, Control ctnControl, SectionFilterCollection sfcfilter, System.Windows.Forms.PropertyGrid propertyGrid)
        public void LoadLayout(FieldLayOut layout, SectionFilterCollection sections)
        {
            if (layout == null || layout.FieldTable == null)
            {
                return;
            }

            _layout = layout;

            Int32Collection nCols = _layout.ColumnsEachRow;

            int nRowCount = nCols.Count;

            if (nRowCount <= 0 || !LoadSectionFilters(nCols, sections))
            {
                return;
            }

            mainControl.Controls.Clear();

            Rectangle rect = mainControl.ClientRectangle;

            mainControl.BackColor = Control.DefaultBackColor;

            this.C_PropertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.C_PropertyGrid_PropertyValueChanged);

            Buttons = new Button[nRowCount][];

            btnContainer = new Panel[nRowCount];

            int sfcindex = 0;


            int panelLocX     = rect.X;
            int panelLocY     = rect.Y;
            int nButtonHeight = 0;

            for (int i = 0; i < nRowCount; i++)
            {
                panelLocY    += nButtonHeight;
                nButtonHeight = (int)(rect.Height * this.GetMaxRadio(layout, i));

                btnContainer[i]             = new Panel();
                btnContainer[i].Name        = i.ToString();
                btnContainer[i].Location    = new Point(panelLocX, panelLocY);
                btnContainer[i].Size        = new Size(rect.Width, nButtonHeight);
                btnContainer[i].BorderStyle = BorderStyle.None;

                int iColCount = nCols[i];
                if (iColCount > 0)
                {
                    Buttons[i] = new Button[iColCount];
                }

                int buttonLocX = 0;

                int restWidth = this.GetRestWidth(i);               //Added this code at 2008-12-12 13:58:28@Simon

                for (int j = 0; j < iColCount; j++)
                {
                    Button newButton = new Button();
                    newButton.Location = new Point(buttonLocX, 0);
                    newButton.Size     = this.GetButtonSize(i, j);
                    if (restWidth > 0)
                    {
                        newButton.Width += 1;
                        restWidth--;
                    }
                    else if (restWidth < 0)
                    {
                        newButton.Width -= 1;
                        restWidth++;
                    }
                    buttonLocX         += newButton.Size.Width;
                    newButton.BackColor = Control.DefaultBackColor;


                    btntag          = new ButtonTags();
                    btntag.RowIndex = i;
                    btntag.ColIndex = j;
                    btntag.RowMax   = nRowCount - 1;
                    btntag.ColMax   = nRowCount - 1;
                    btntag.btnLoc   = new Point(newButton.Location.X, newButton.Location.X);
                    btntag.btnSize  = new Size(newButton.Width, newButton.Height);
                    btntag.filter   = sections[sfcindex];

                    sfcindex++;
                    newButton.Name = string.Format("Button{0}", sfcindex);
                    newButton.Text = btntag.filter.FilterName;
                    newButton.Tag  = btntag;



                    newButton.MouseDown  += new System.Windows.Forms.MouseEventHandler(MyMouseDown);
                    newButton.MouseLeave += new System.EventHandler(MyMouseLeave);
                    newButton.MouseMove  += new System.Windows.Forms.MouseEventHandler(MyMouseMove);
                    newButton.Click      += new System.EventHandler(MyClick);

                    Buttons[i][j] = newButton;
                    btnContainer[i].Controls.Add(newButton);
                }
                this.mainControl.Controls.Add(btnContainer[i]);
            }
        }
        public ArrayList GetMaxValues(SectionFilter OneValueScFilter, SectionFilterCollection repeatFilters)
        {
            DataTable i_Table = this.GetDataSource();

            bool allpercent = true;

            ArrayList maxNames = new ArrayList();

            if (OneValueScFilter == null)
            {
                return(maxNames);
            }

            foreach (Data.Series series in this.WebbChartExView.Settings.SeriesCollection)
            {
                if (!series.SeriesLabel.Percent)
                {
                    allpercent = false;

                    break;
                }
            }

            float MaxDataPoint = 0f;

            float[] DataValues = new float[repeatFilters.Count];

            for (int i = 0; i < repeatFilters.Count; i++)
            {
                SectionFilter scfilter = repeatFilters[i];

                Webb.Collections.Int32Collection InnerRows = new Webb.Collections.Int32Collection();

                Webb.Collections.Int32Collection OutterRows = this.DenominatorFilter.GetFilteredRows(i_Table);

                OutterRows.CopyTo(InnerRows);

                InnerRows = OneValueScFilter.Filter.GetFilteredRows(i_Table, InnerRows);

                InnerRows = scfilter.Filter.GetFilteredRows(i_Table, InnerRows);                 //Added this code at 2008-12-26 12:22:40@Simon

                float datapoint = 0f;

                if (allpercent)
                {
                    if (OutterRows.Count > 0)
                    {
                        datapoint = InnerRows.Count / (float)OutterRows.Count;
                    }
                }
                else
                {
                    datapoint = InnerRows.Count;
                }
                if (MaxDataPoint < datapoint)
                {
                    MaxDataPoint = datapoint;
                }

                DataValues[i] = datapoint;
            }
            for (int i = 0; i < DataValues.Length; i++)
            {
                if (DataValues[i] == MaxDataPoint)
                {
                    maxNames.Add(repeatFilters[i].FilterName);
                }
            }

            return(maxNames);
        }