private void ExportSetting()
        {
            this._GradingSectionCollection = new GradingSectionCollection();

            foreach (GradingSection playerPostionSection in this.lstGradingSections.Items)
            {
                this._GradingSectionCollection.Add(playerPostionSection);
            }
            using (SaveFileDialog saveFileDialog = new SaveFileDialog())
            {
                saveFileDialog.Filter = string.Format("ExportFile(*{0})|*{0}", ".exf");

                if (DialogResult.OK == saveFileDialog.ShowDialog())
                {
                    try
                    {
                        System.IO.FileStream stream = System.IO.File.Open(saveFileDialog.FileName, System.IO.FileMode.OpenOrCreate);

                        Webb.Utilities.Serializer.SerializeObject(stream, this._GradingSectionCollection);

                        stream.Close();
                    }
                    catch (Exception ex)
                    {
                        Webb.Utilities.MessageBoxEx.ShowError("Failed to export!\n" + ex.Message);

                        return;
                    }
                }
            }
        }
        public override void UpdateView(ExControlView i_View)
        {
            if (!(i_View is GradingView))
            {
                return;                             //Added this code at 2008-11-20 15:24:38@Simon
            }
            this._GradingSectionCollection = new GradingSectionCollection();

            foreach (GradingSection playerPostionSection in this.lstGradingSections.Items)
            {
                this._GradingSectionCollection.Add(playerPostionSection);
            }

            (i_View as GradingView).GradingSectionCollection = this._GradingSectionCollection;
        }
        private void ImportSetting()
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = string.Format("ExportFile(*{0})|*{0}", ".exf");

                if (DialogResult.OK != openFileDialog.ShowDialog())
                {
                    return;
                }

                if (System.IO.File.Exists(openFileDialog.FileName))
                {
                    try
                    {
                        System.IO.FileStream stream = System.IO.File.Open(openFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                        this._GradingSectionCollection = Webb.Utilities.Serializer.DeserializeObject(stream) as GradingSectionCollection;

                        stream.Close();

                        stream.Dispose();
                    }
                    catch (Exception ex)
                    {
                        Webb.Utilities.MessageBoxEx.ShowError("Failed to import!\n" + ex.Message);

                        return;
                    }
                }
            }


            this.lstGradingSections.Items.Clear();

            this.lstPostions.Items.Clear();

            foreach (GradingSection gradingSection in this._GradingSectionCollection)
            {
                this.lstGradingSections.Items.Add(gradingSection);
            }

            if (this.lstGradingSections.Items.Count > 0)
            {
                this.lstGradingSections.SelectedIndex = 0;
            }
        }
        public override void SetView(ExControlView i_View)
        {
            if (!(i_View is GradingView))
            {
                return;                             //Added this code at 2008-11-20 15:24:38@Simon
            }
            this._GradingSectionCollection = (i_View as GradingView).GradingSectionCollection;

            this.lstGradingSections.Items.Clear();

            this.lstPostions.Items.Clear();

            foreach (GradingSection gradingSection in this._GradingSectionCollection)
            {
                this.lstGradingSections.Items.Add(gradingSection);
            }

            if (this.lstGradingSections.Items.Count > 0)
            {
                this.lstGradingSections.SelectedIndex = 0;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Calculate grouped result
        /// </summary>
        /// <param name="i_Table">data source</param>
        public override void CalculateResult(DataTable i_Table)
        {
            //If have no data source ,clear group struct
            if (i_Table == null)
            {
                this.RootGroupInfo.ClearGroupResult(this._RootGroupInfo);

                return;
            }

            //Filter rows
            Webb.Collections.Int32Collection m_Rows = new Int32Collection();

            if (this.ExControl != null && this.ExControl.Report != null)
            {
                m_Rows = this.ExControl.Report.Filter.GetFilteredRows(i_Table);  //2009-5-25 11:02:57@Simon Add this Code
            }

            m_Rows = this.OneValueScFilter.Filter.GetFilteredRows(i_Table, m_Rows);                                         //06-04-2008@Scott

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

            this.Filter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this.Filter); //2009-4-29 11:37:37@Simon Add UpdateAdvFilter

            m_Rows = this.Filter.GetFilteredRows(i_Table, m_Rows);                                                          //06-04-2008@Scott

            DataTable table = this.GradingSectionCollection.CalcualteGradeTable(i_Table, m_Rows);

            Webb.Data.DBFilter filter = new Webb.Data.DBFilter();

            Int32Collection rows = filter.GetFilteredRows(table);

            this._RootGroupInfo.CalculateGroupResult(table, rows, rows, this._RootGroupInfo);

            GradingSectionCollection.TruncateRowIdIntoPlayId(table, this._RootGroupInfo);
        }
Ejemplo n.º 6
0
 //ctor
 public GradingView(GradingControl i_Control)
     : base(i_Control as ExControl)
 {
     _GradingSectionCollection = new GradingSectionCollection();
     _RootGroupInfo            = new FieldGradingInfo();
 }
Ejemplo n.º 7
0
        public GradingView(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            try
            {
                _GradingSectionCollection = (Webb.Reports.ExControls.Data.GradingSectionCollection)info.GetValue("_GradingSectionCollection", typeof(Webb.Reports.ExControls.Data.GradingSectionCollection));
            }
            catch
            {
                _GradingSectionCollection = new GradingSectionCollection();
            }
            try
            {
                _RootGroupInfo = (Webb.Reports.ExControls.Data.GroupInfo)info.GetValue("_RootGroupInfo", typeof(Webb.Reports.ExControls.Data.GroupInfo));
            }
            catch
            {
                _RootGroupInfo = new FieldGradingInfo();
            }
            try
            {
                _CellSizeAutoAdapting = (Webb.Reports.ExControls.Views.CellSizeAutoAdaptingTypes)info.GetValue("_CellSizeAutoAdapting", typeof(Webb.Reports.ExControls.Views.CellSizeAutoAdaptingTypes));
            }
            catch
            {
                _CellSizeAutoAdapting = CellSizeAutoAdaptingTypes.NotUse;
            }
            try
            {
                _Filter = (Webb.Data.DBFilter)info.GetValue("_Filter", typeof(Webb.Data.DBFilter));
            }
            catch
            {
                _Filter = new Webb.Data.DBFilter();
            }
            try
            {
                _TopCount = info.GetInt32("_TopCount");
            }
            catch
            {
                _TopCount = 0;
            }
            try
            {
                _ShowRowIndicators = info.GetBoolean("_ShowRowIndicators");
            }
            catch
            {
                _ShowRowIndicators = false;
            }
            try
            {
                _HaveHeader = info.GetBoolean("_HaveHeader");
            }
            catch
            {
                _HaveHeader = true;
            }
            try
            {
                _SectionInOneRow = info.GetBoolean("_SectionInOneRow");
            }
            catch
            {
                _SectionInOneRow = true;
            }
            try
            {
                _HeaderRows = (Webb.Collections.Int32Collection)info.GetValue("_HeaderRows", typeof(Webb.Collections.Int32Collection));
            }
            catch
            {
                _HeaderRows = new Int32Collection();
            }
            try
            {
                _SectionRows = (Webb.Collections.Int32Collection)info.GetValue("_SectionRows", typeof(Webb.Collections.Int32Collection));
            }
            catch
            {
                _SectionRows = new Int32Collection();
            }
            try
            {
                _TotalRows = (Webb.Collections.Int32Collection)info.GetValue("_TotalRows", typeof(Webb.Collections.Int32Collection));
            }
            catch
            {
                _TotalRows = new Int32Collection();
            }

            try
            {
                _ColumnsWidth = (Webb.Collections.Int32Collection)info.GetValue("_ColumnsWidth", typeof(Webb.Collections.Int32Collection));
            }
            catch
            {
                _ColumnsWidth = new Int32Collection();
            }
            try
            {
                _RowsHight = (Webb.Collections.Int32Collection)info.GetValue("_RowsHight", typeof(Webb.Collections.Int32Collection));
            }
            catch
            {
                _RowsHight = new Int32Collection();
            }
            try
            {
                _Styles = (Webb.Reports.ExControls.Styles.ExControlStyles)info.GetValue("_Styles", typeof(Webb.Reports.ExControls.Styles.ExControlStyles));
            }
            catch
            {
                _Styles = new ExControlStyles();
            }
            try
            {
                _HeadersData = (HeadersData)info.GetValue("_HeadersData", typeof(Webb.Reports.ExControls.Data.HeadersData));
            }
            catch
            {
                _HeadersData = null;
            }
            try
            {
                _OurBordersSetting = (Webb.Reports.ExControls.Views.OurBordersSetting)info.GetValue("_OurBordersSetting", typeof(Webb.Reports.ExControls.Views.OurBordersSetting));
            }
            catch
            {
                _OurBordersSetting = new OurBordersSetting();
            }
        }