예제 #1
0
 public void Clear()
 {
     var ds = new AuditLogViewDataSet();
     this.GridViewAuditLog.DataSource = ds;
     this.GridViewAuditLog.DataMember = ds.T_IC_AUDIT_LOG_QUERY.TableName;
     this.totalCount.Text = string.Format(TotalCountFormat,"0");
 }
예제 #2
0
        public AuditLogViewDataSet GetSummary(AuditTrailSearchCriteria criteria,string appName )
        {
            AuditLogViewDataSet ds = new AuditLogViewDataSet();
            _loggingDBHelper.Fill(ds.T_IC_AUDIT_LOG_QUERY, "P_IC_AUDIT_LOG_SUMMARY_GET",
                appName,
                criteria.TransactionId,
                criteria.FunctionName,
                criteria.UserName,
                criteria.StartDate,
                criteria.EndDate,
                criteria.AppVersion,
                criteria.ExtendedProperties["@p_app_id"],
                criteria.ExtendedProperties["@startIndex"],
                criteria.ExtendedProperties["@endIndex"]);

            return ds;
        }
예제 #3
0
 public BatchProcessEventArgs(AuditLogViewDataSet batchData, AuditTrailSearchCriteria criteria)
 {
     BatchData = batchData;
     Criteria = criteria;
 }
예제 #4
0
        public AuditLogViewDataSet GetAuditDataSummary(AuditTrailSearchCriteria criteria)
        {
            var da = InstanceBuilder.CreateInstance<AuditLogViewDA>();

            //Must there is a storage provider of audit trail
            string appName = AuditTrailConfigurationManager.StorageProviders[0].ApplicationName;
            string appId = da.GetAppID(appName);

            //Store the value of criteria first
            string funcName = ReplaceWildcard(criteria.FunctionName);
            string userName = ReplaceWildcard(criteria.UserName);

            string tableName = ReplaceWildcard(criteria.ExtendedProperties["@tableName"].ToString());
            string operationType = ReplaceWildcard(criteria.ExtendedProperties["@operationType"].ToString());

            string hostName = ReplaceWildcard(criteria.ExtendedProperties["@hostName"].ToString());
            string ipAddress = ReplaceWildcard(criteria.ExtendedProperties["@ipAddress"].ToString());
            string device = ReplaceWildcard(criteria.ExtendedProperties["@device"].ToString());

            Int64 startIndex = (Int64)criteria.ExtendedProperties["@startIndex"];
            Int64 endIndex = (Int64)criteria.ExtendedProperties["@endIndex"];
            Int64 min = (Int64)criteria.ExtendedProperties["min"];
            Int64 max = (Int64)criteria.ExtendedProperties["max"];

            //Do not want to pass the above criteria to SP, so re-create the extended properties
            criteria.ExtendedProperties = new Dictionary<string, object>();
            criteria.ExtendedProperties.Add("@p_app_id", string.IsNullOrEmpty(appId) ? null : appId);
            criteria.ExtendedProperties.Add("@startIndex", startIndex);
            criteria.ExtendedProperties.Add("@endIndex",startIndex+ Offset);

            AuditLogViewDataSet dsResult = null;
            Int64 lastEndIndex = startIndex;
            int count ;

            do
            {
                lastEndIndex = lastEndIndex + Offset;
                //Retrieve from database
                AuditLogViewDataSet ds = da.GetSummary(criteria,appName);

                //Using linq to filter data so that the performance can be improved
                var tempData = (from data in ds.T_IC_AUDIT_LOG_QUERY
                                where CompareData(data["LOG_FUNCTION"].ToString(), funcName)
                       && CompareData(data["USER_NAME"].ToString(), userName)
                       && CompareData(data["TABLE_NAME"].ToString(), tableName)
                       && CompareData(data["OPERATION"].ToString(), operationType)
                       && CompareData(data["HOST_NAME"].ToString(), hostName)
                       && CompareData(data["IP_ADDRESS"].ToString(), ipAddress)
                       && CompareData(data["DEVICE"].ToString(), device)
                       && data.INDEX>=min
                       && data.INDEX<=max
                                select data);

                if (null == dsResult)
                {
                    dsResult = ds.Clone() as AuditLogViewDataSet;
                }
                //Move to next batch
                criteria.ExtendedProperties["@startIndex"] = lastEndIndex;
                criteria.ExtendedProperties["@endIndex"] = lastEndIndex + Offset;
                count = tempData.Count();

                if (dsResult == null)
                {
                    dsResult=new AuditLogViewDataSet();
                }
                DataTable dt = dsResult.T_IC_AUDIT_LOG_QUERY;
                dt.BeginLoadData();
                foreach (var data in tempData)
                {
                    dt.LoadDataRow(data.ItemArray, true);
                }
                dt.EndLoadData();

                ds.Dispose();

                //Found anything, will return
            } while (count == 0 && lastEndIndex < max && lastEndIndex < endIndex);

            dsResult.ExtendedProperties.Add("endIndex", lastEndIndex);
            return dsResult;
        }