Ejemplo n.º 1
0
        public FI.Common.Data.FIDataTable GetReportHeaders(System.Type ReportType)
        {
            FI.Common.Data.FIDataTable table = null;


            if (ReportType == typeof(OlapReport))
            {
                FI.Common.DataAccess.IOlapReportsDA dacObj = DataAccessFactory.Instance.GetOlapReportsDA();
                table = dacObj.ReadReportHeaders(_owner.ID);
            }
            else if (ReportType == typeof(StorecheckReport))
            {
                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                table = dacObj.ReadReportHeaders(_owner.ID);
            }
            else if (ReportType == typeof(CustomSqlReport))
            {
                FI.Common.DataAccess.ICustomSqlReportsDA dacObj = DataAccessFactory.Instance.GetCustomSqlReportsDA();
                table = dacObj.ReadReportHeaders(_owner.ID);
            }
            else if (ReportType == typeof(CustomMdxReport))
            {
                FI.Common.DataAccess.ICustomMdxReportsDA dacObj = DataAccessFactory.Instance.GetCustomMdxReportsDA();
                table = dacObj.ReadReportHeaders(_owner.ID);
            }
            else
            {
                throw new NotSupportedException();
            }

            return(table);
        }
Ejemplo n.º 2
0
        public FI.Common.Data.FIDataTable GetUsersWithChildReports(Report ParentReport)
        {
            FI.Common.Data.FIDataTable table = null;


            if (ParentReport.GetType() == typeof(OlapReport))
            {
                FI.Common.DataAccess.IOlapReportsDA dacObj = DataAccessFactory.Instance.GetOlapReportsDA();
                table = dacObj.ReadUsersWithChildReports(ParentReport.ID, this.GetReportTypeCode(ParentReport.GetType()));
            }
            else if (ParentReport.GetType() == typeof(StorecheckReport))
            {
                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                table = dacObj.ReadUsersWithChildReports(ParentReport.ID, this.GetReportTypeCode(ParentReport.GetType()));
            }
            else if (ParentReport.GetType() == typeof(CustomSqlReport))
            {
                FI.Common.DataAccess.ICustomSqlReportsDA dacObj = DataAccessFactory.Instance.GetCustomSqlReportsDA();
                table = dacObj.ReadUsersWithChildReports(ParentReport.ID, this.GetReportTypeCode(ParentReport.GetType()));
            }
            else if (ParentReport.GetType() == typeof(CustomMdxReport))
            {
                FI.Common.DataAccess.ICustomMdxReportsDA dacObj = DataAccessFactory.Instance.GetCustomMdxReportsDA();
                table = dacObj.ReadUsersWithChildReports(ParentReport.ID, this.GetReportTypeCode(ParentReport.GetType()));
            }
            else
            {
                throw new NotSupportedException();
            }

            return(table);
        }
        public FI.Common.Data.FIDataTable GetReportPage(ReportPageTypeEnum PageType, int StartIndex, int RecordCount, string FilterExpression, string SortExpression)
        {
            if (this.State != StateEnum.Executed)
            {
                throw new Exception("Report is not executed");
            }

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            return(dacObj.GetReportPage(this.ID, this._oltpDatabase, (byte)PageType, StartIndex, RecordCount, FilterExpression, SortExpression));
        }
        private void ClearCache()
        {
            if (_cacheExists)
            {
                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                dacObj.DeleteReportCache(this.ID);
            }

            _cacheExists = false;
        }
Ejemplo n.º 5
0
        public decimal CreateAsSharedFrom(Report parentReport, Report.SharingEnum subscriberSharing)
        {
            if (this.Owner == parentReport.Owner)
            {
                throw new Exception("Cannot share to same user");
            }

            parentReport.LoadHeader();

            if (subscriberSharing == Report.SharingEnum.None)
            {
                throw new Exception("Wrong sharing option");
            }

            if (parentReport.SharingStatus != Report.SharingEnum.None)
            {
                throw new Exception("Shared report cannot be source of other shared report");
            }


            decimal newReportId = 0;

            System.Type reportType = parentReport.GetType();
            // ----------------------------------------
            if (reportType == typeof(OlapReport))
            {
                FI.Common.DataAccess.IOlapReportsDA dacObj = DataAccessFactory.Instance.GetOlapReportsDA();
                newReportId = dacObj.CreateSharedReport(parentReport.ID, this.Owner.ID, (int)subscriberSharing);
            }
            else if (reportType == typeof(StorecheckReport))
            {
                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                newReportId = dacObj.CreateSharedReport(parentReport.ID, this.Owner.ID, (int)subscriberSharing);
            }
            else if (reportType == typeof(CustomSqlReport))
            {
                FI.Common.DataAccess.ICustomSqlReportsDA dacObj = DataAccessFactory.Instance.GetCustomSqlReportsDA();
                newReportId = dacObj.CreateSharedReport(parentReport.ID, this.Owner.ID, (int)subscriberSharing);
            }
            else if (reportType == typeof(CustomMdxReport))
            {
                FI.Common.DataAccess.ICustomMdxReportsDA dacObj = DataAccessFactory.Instance.GetCustomMdxReportsDA();
                newReportId = dacObj.CreateSharedReport(parentReport.ID, this.Owner.ID, (int)subscriberSharing);
            }
            // ----------------------------------------


            // update max
            if (((int)parentReport._maxSubscriberSharing) < ((int)subscriberSharing))
            {
                parentReport._maxSubscriberSharing = subscriberSharing;
            }

            return(newReportId);
        }
        override protected internal void _SaveState()
        {
            string productsXml = "";
            string filterXml   = "";

            this.SaveToXml(ref productsXml, ref filterXml);

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            dacObj.SaveState(this.ID, this.MaxStateCount, productsXml,
                             (byte)this.ProductsJoinLogic, this.Days, filterXml, this.InSelOnly, this.InBSelOnly, (byte)this.DataSource, ref this._undoStateCount);
        }
        public override void LoadHeader()
        {
            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            FI.Common.Data.FIDataTable dataTable             = dacObj.ReadReportHeader(this.Owner.ID, this.ID);

            this._parentReportId       = (decimal)dataTable.Rows[0]["parent_report_id"];
            this._name                 = (string)dataTable.Rows[0]["name"];
            this._description          = (string)dataTable.Rows[0]["description"];
            this._isSelected           = (bool)dataTable.Rows[0]["is_selected"];
            this._sharing              = (Report.SharingEnum)((byte)dataTable.Rows[0]["sharing_status"]);
            this._maxSubscriberSharing = (Report.SharingEnum)((byte)dataTable.Rows[0]["max_subscriber_sharing_status"]);
            this._cacheTimestamp       = (DateTime)dataTable.Rows[0]["cache_timestamp"];
        }
        protected internal override Report _Clone(string Name, string Description)
        {
            string productsXml = null;
            string filterXml   = null;

            this.SaveToXml(ref productsXml, ref filterXml);

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            decimal newId = dacObj.InsertReport(this.Owner.ID, 0, 0, Name, Description, false, productsXml,
                                                (byte)this.ProductsJoinLogic, this.Days, filterXml, this._cacheTimestamp, this.InSelOnly, this.InBSelOnly, (byte)this.DataSource);

            return(_owner.ReportSystem.GetReport(newId, typeof(StorecheckReport), false));
        }
        override protected internal void _LoadState(short StateCode)
        {
            string productsXml   = "";
            byte   productsLogic = 0;
            string filterXml     = "";
            byte   dataSource    = 0;

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            dacObj.LoadState(this.ID, StateCode, ref productsXml,
                             ref productsLogic, ref this._days, ref filterXml, ref this._inSelOnly, ref this._inBSelOnly, ref dataSource, ref this._undoStateCount, ref this._redoStateCount);

            this.ProductsJoinLogic = (ProductsJoinLogicEnum)productsLogic;
            this.DataSource        = (DataSourceEnum)dataSource;
            this.LoadFromXml(productsXml, filterXml);
        }
Ejemplo n.º 10
0
        override protected internal void _Save()
        {
            string productsXml = null;
            string filterXml   = null;

            this.SaveToXml(ref productsXml, ref filterXml);

            if (this.IsDirty)            // because cache is valid for current state
            {
                this.ClearCache();
            }

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            dacObj.SaveReport(_owner.ID, this._id, productsXml,
                              (byte)this.ProductsJoinLogic, this.Days, filterXml, this._cacheTimestamp, this.InSelOnly, this.InBSelOnly, (byte)this.DataSource);
        }
Ejemplo n.º 11
0
        public void DeleteSharedReport(Report parentReport, Report childReport)
        {
            System.Type reportType = childReport.GetType();

            if (parentReport.GetType() != reportType)
            {
                throw new Exception("Parent and child report type mismatch");
            }

            short maxSurscriberSharing = 0;

            // delete child report states
            childReport._DeleteStates();


            // ----------------------------------------
            if (reportType == typeof(OlapReport))
            {
                FI.Common.DataAccess.IOlapReportsDA dacObj = DataAccessFactory.Instance.GetOlapReportsDA();
                dacObj.DeleteSharedReport(parentReport.ID, childReport.ID, ref maxSurscriberSharing);
            }
            else if (reportType == typeof(StorecheckReport))
            {
                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                dacObj.DeleteSharedReport(parentReport.ID, childReport.ID, ref maxSurscriberSharing);
            }
            else if (reportType == typeof(CustomSqlReport))
            {
                FI.Common.DataAccess.ICustomSqlReportsDA dacObj = DataAccessFactory.Instance.GetCustomSqlReportsDA();
                dacObj.DeleteSharedReport(parentReport.ID, childReport.ID, ref maxSurscriberSharing);
            }
            else if (reportType == typeof(CustomMdxReport))
            {
                FI.Common.DataAccess.ICustomMdxReportsDA dacObj = DataAccessFactory.Instance.GetCustomMdxReportsDA();
                dacObj.DeleteSharedReport(parentReport.ID, childReport.ID, ref maxSurscriberSharing);
            }
            else
            {
                throw new NotSupportedException();
            }
            // ----------------------------------------

            childReport._sharing = Report.SharingEnum.None;
            parentReport._maxSubscriberSharing = (Report.SharingEnum)maxSurscriberSharing;
        }
        private void CreateCache()
        {
            if (_cacheExists && this._cacheTimestamp.Date == DateTime.Today)
            {
                return;                 //cache already exists
            }
            DateTime endDate   = DateTime.Today;
            DateTime startDate = endDate.Subtract(TimeSpan.FromDays(this.Days));

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            dacObj.DeleteReportCache(this.ID);
            dacObj.CreateReportCache(this.ID, this._oltpDatabase, this._productsSerNoList,
                                     (byte)this.ProductsJoinLogic, startDate, endDate, this.InSelOnly, this.InBSelOnly, (byte)this.DataSource);

            _cacheExists    = true;
            _cacheTimestamp = DateTime.Today;
            this.SaveHeader();
        }
        internal StorecheckReport(decimal ID, User Owner) : base(ID, Owner)
        {
            if (ID == 0)          //if new
            {
                string productsXml = null;
                string filterXml   = null;
                this.SaveToXml(ref productsXml, ref filterXml);

                FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
                _id = dacObj.InsertReport(_owner.ID, 0, 0, "New Report", "", this.IsSelected, productsXml,
                                          (byte)this.ProductsJoinLogic, this.Days, filterXml, this._cacheTimestamp, this.InSelOnly, this.InBSelOnly, (byte)this.DataSource);

                _isProxy = false;
                _isDirty = false;
            }

            _oltpDatabase = Owner.OltpDatabase;
        }
        override protected internal void _Open()
        {
            short  sharing = 0;
            short  maxSubscriberSharing = 0;
            byte   productsLogic        = 0;
            string productsXml          = null;
            string filterXml            = null;
            byte   dataSource           = 0;

            FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
            dacObj.ReadReport(_owner.ID, this.ID,
                              ref this._parentReportId,
                              ref this._name,
                              ref this._description,
                              ref sharing,
                              ref maxSubscriberSharing,
                              ref this._isSelected,
                              ref productsXml,
                              ref productsLogic,
                              ref this._days,
                              ref filterXml,
                              ref this._cacheTimestamp,
                              ref this._cacheExists,
                              ref this._inSelOnly,
                              ref this._inBSelOnly,
                              ref dataSource,
                              ref this._oltpDatabase,
                              ref _undoStateCount,
                              ref _redoStateCount);

            this._sharing = (Report.SharingEnum)sharing;
            this._maxSubscriberSharing = (Report.SharingEnum)maxSubscriberSharing;
            this._productsJoinLogic    = (ProductsJoinLogicEnum)productsLogic;
            this._dataSource           = (DataSourceEnum)dataSource;
            this.LoadFromXml(productsXml, filterXml);
        }
 public FI.Common.Data.FIDataTable GetSppProductsPage(bool IncludeExistingProducts, int StartIndex, int RecordCount, string FilterExpression, string SortExpression)
 {
     FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
     return(dacObj.GetSppProductsPage(this._oltpDatabase, this._productsSerNoList, IncludeExistingProducts, StartIndex, RecordCount, FilterExpression, SortExpression));
 }
 override protected internal void _Delete(bool DenyShared)
 {
     FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
     dacObj.DeleteReportCache(this.ID);
     dacObj.DeleteReport(_owner.ID, this.ID, DenyShared);
 }
 override protected internal void _DeleteStates()
 {
     FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
     dacObj.DeleteReportStates(this.ID);
 }
 protected internal override void _SaveHeader()
 {
     FI.Common.DataAccess.IStorecheckReportsDA dacObj = DataAccessFactory.Instance.GetStorecheckReportsDA();
     dacObj.UpdateReportHeader(this.Owner.ID, this.ID, this._parentReportId, (byte)this.SharingStatus, this.Name, this.Description, this.IsSelected, this._cacheTimestamp);
 }