Beispiel #1
0
        private void OutputLog(LogData data)
        {
            Contract.NotEmpty((string)data.Items[AuditLogData.ScreenIDPropertyKey], AuditLogData.ScreenIDPropertyKey);
            IEnumerable <long> ids = null;

            if (data.Items.ContainsKey(AuditLogData.TargetIDListPropertyKey))
            {
                ids = data.Items[AuditLogData.TargetIDListPropertyKey] as IEnumerable <long>;
            }
            if (ids == null)
            {
                ids = Enumerable.Empty <long>();
            }
            using (ArcsAuditLogEntities context = ArcsAuditLogEntities.CreateContext())
            {
                foreach (int targetID in ids)
                {
                    TSYS001 tSYS001 = new TSYS001()
                    {
                        AADTLOGID = context.NextValFromSequence("SSYS001"),
                        AEMPID    = (long)data.Items[AuditLogData.EmpIDPropertyKey],
                        AEXEFLENM = (string)data.Items[AuditLogData.ScreenIDPropertyKey],
                        AOPEFL    = (byte)(AuditDivision)data.Items[AuditLogData.DivisionPropertyKey],
                        AGETRSLID = targetID,
                        ACRDT     = DateTime.Today,
                        ACRID     = data.Items[AuditLogData.EmpIDPropertyKey].ToString(),
                        AUPDT     = DateTime.Today,
                        AUPID     = data.Items[AuditLogData.EmpIDPropertyKey].ToString(),
                    };
                    context.TSYS001.Add(tSYS001);
                }
                context.SaveChanges();
            }
        }
Beispiel #2
0
        public static ArcsAuditLogEntities CreateContext()
        {
            var config        = ServiceConfigurationLoader.Load();
            var configuration = config.ConnectionStrings[typeof(ArcsAuditLogEntities).Name];
            var context       = new ArcsAuditLogEntities(ConnectionFactory.Create(configuration));

            context.configuration = configuration;
            return(context);
        }