private void EditLogReportDetailsView_ColmnSelected(object sender, EditDataItemColumnDetailsDTO e)
 {
     if (e == null || !e.FormulaUsageParemeters.Any())
     {
         (sender as I_View_EditLogReportDetails).ColumnParameterVisibility = false;
     }
     else
     {
         (sender as I_View_EditLogReportDetails).ColumnParameterVisibility = true;
         (sender as I_View_EditLogReportDetails).AddColumnFormulaParameters(e.FormulaUsageParemeters);
     }
 }
        private DataLogDTO ToUpdateSuccessfulLog(EditQueryResultItem item, Guid packageGUID)
        {
            var dataLog = GetBaseLog(item.QueryItem);

            dataLog.EditDataItemExceptionLog = new EditDataItemExceptionLogDTO();
            dataLog.EditDataItemExceptionLog.DataUpdateQuery = item.QueryItem.Query;
            if (item.AfterSaveActionActivitiesResult == Enum_DR_SimpleResultType.ExceptionThrown)
            {
                dataLog.MinorException = true;
                dataLog.EditDataItemExceptionLog.AfterSaveActionExceptionMessage = item.BeforeSaveActionActivitiesMessage;
            }
            foreach (var column in item.QueryItem.EditingProperties)
            {
                var logColumn = new EditDataItemColumnDetailsDTO();
                logColumn.ColumnID = column.ColumnID;
                logColumn.NewValue = column.Value;
                if (item.QueryItem.DataItem.OriginalProperties.Any(x => x.ColumnID == column.ColumnID))
                {
                    logColumn.OldValue = item.QueryItem.DataItem.OriginalProperties.First(x => x.ColumnID == column.ColumnID).Value;
                }
                if (column.FormulaID != 0)
                {
                    logColumn.FormulaID        = column.FormulaID;
                    logColumn.FormulaException = column.FormulaException;
                    foreach (var fparam in column.FormulaUsageParemeters)
                    {
                        logColumn.FormulaUsageParemeters.Add(new FormulaUsageParemetersDTO()
                        {
                            ParameterName            = fparam.ParameterName,
                            ParameterValue           = fparam.ParameterValue,
                            RelationshipPropertyTail = fparam.RelationshipPropertyTail,
                        });
                    }
                }
                dataLog.EditDataItemColumnDetails.Add(logColumn);
            }
            return(dataLog);
        }
Example #3
0
        private DataLogDTO ToDataLogDTO(DR_Requester requester, DataLog item, bool withDetails)
        {
            var message = new DataLogDTO();

            message.ID = item.ID;
            if (item.MyDataItemID != null && item.MyDataItemID != 0)
            {
                message.DatItem = bizDataItem.ToDataViewDTO(requester, item.MyDataItem, withDetails);
            }
            message.Date          = item.Date;
            message.vwPersianDate = GeneralHelper.GetShamsiDate(item.Date);
            //  message.DataInfo = item.DataInfo;
            var entity = bizTableDrivedEntity.GetTableDrivedEntity(requester, item.MyDataItem.TableDrivedEntityID, ModelEntites.EntityColumnInfoType.WithSimpleColumns, ModelEntites.EntityRelationshipInfoType.WithoutRelationships);

            if (item.MyDataItem != null)
            {
                //بهتر شود

                message.vwEntityAlias = entity.Alias;
            }
            message.Duration       = item.Duration ?? 0;
            message.MajorException = item.MajorFunctionException;
            message.MinorException = item.MinorFunctionException;
            message.MajorFunctionExceptionMessage = item.MajorFunctionExceptionMessage;
            message.LocationInfo = item.LocationInfo;
            message.PackageGuid  = item.PackageGuid;
            message.Time         = item.Time;
            message.MainType     = (DataLogType)item.MainType;
            message.UserID       = item.UserID;
            message.vwUserInfo   = bizUser.GetUserFullName(item.UserID);
            if (withDetails)
            {
                foreach (var columnLog in item.EditDataItemColumnDetails)
                {
                    var colMsg = new EditDataItemColumnDetailsDTO();
                    colMsg.ColumnID = columnLog.ColumnID;
                    var column = entity.Columns.FirstOrDefault(x => x.ID == colMsg.ColumnID);
                    if (column != null)
                    {
                        colMsg.vwColumnName  = column.Name;
                        colMsg.vwColumnAlias = column.Alias;
                    }
                    colMsg.Info     = columnLog.Info;
                    colMsg.NewValue = columnLog.NewValue;
                    colMsg.OldValue = columnLog.OldValue;
                    message.EditDataItemColumnDetails.Add(colMsg);
                    colMsg.FormulaException = columnLog.FormulaException;
                    colMsg.FormulaID        = columnLog.FormulaID ?? 0;
                    foreach (var formulaParam in columnLog.FormulaUsageParemeters)
                    {
                        FormulaUsageParemetersDTO paramDTO = new FormulaUsageParemetersDTO();
                        paramDTO.ID                       = formulaParam.ID;
                        paramDTO.ParameterName            = formulaParam.ParameterName;
                        paramDTO.ParameterValue           = formulaParam.ParameterValue;
                        paramDTO.RelationshipPropertyTail = formulaParam.RelationshipKeyColumnTail;
                        colMsg.FormulaUsageParemeters.Add(paramDTO);
                    }
                }
                if (item.EditDataItemExceptionLog != null)
                {
                    message.EditDataItemExceptionLog = new EditDataItemExceptionLogDTO();
                    message.EditDataItemExceptionLog.AfterSaveActionExceptionMessage = item.EditDataItemExceptionLog.AfterSaveActionExceptionMessage;
                    //message.EditDataItemExceptionLog.BeforeSaveActionExceptionMessage = item.EditDataItemExceptionLog.BeforeSaveActionExceptionMessage;
                    //message.EditDataItemExceptionLog.DataUpdateExceptionMessage = item.EditDataItemExceptionLog.DataUpdateExceptionMessage;
                    message.EditDataItemExceptionLog.DataUpdateQuery = item.EditDataItemExceptionLog.DataUpdateQuery;
                    //message.EditDataItemExceptionLog.ForumulaUsageExceptionMessage = item.EditDataItemExceptionLog.FormulaUsageExceptionMessage;
                    message.EditDataItemExceptionLog.ID = item.EditDataItemExceptionLog.ID;
                }
                //if (item.ArchiveItemLog != null)
                //{
                //    message.ArchiveItemLog = new  ArchiveItemLogDTO();
                //    message.ArchiveItemLog.ID = item.ArchiveItemLog.ID;
                //    message.ArchiveItemLog.Exception = item.ArchiveItemLog.Exception;
                //}
            }

            return(message);
        }