Esempio n. 1
0
        public History CreateFileChangeLog(int operation, string filePath)
        {
            //throw new NotImplementedException();
            try
            {
                var log = new History
                {
                    LogTypeId = 5,
                    InteractionTypeId = 9,
                    Domain = Environment.UserDomainName,
                    UserName = Environment.UserName,
                    PCName = Environment.MachineName,
                    FileName = filePath,
                    FileOperationId = operation,
                    ErrorMsg = null,
                };
                return log;

            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                return null;
            }
        }
        public bool CommitLogEntry(History log)
        {
            //throw new NotImplementedException();
            using (var db = new FileSyncLoggingEntities())
            {
                try
                {
                    db.Histories.Add(log);

                    try
                    {
                        db.SaveChanges();
                    }
                    catch (DbEntityValidationException dbEx)
                    {
                        foreach (var validationErrors in dbEx.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }

                return true;
            }
        }
Esempio n. 3
0
 public bool CommitLog(History log)
 {
     _logDataAccess.CommitLogEntry(log);
     return true;
 }
Esempio n. 4
0
        public History CreateSyncLog(int interaction)
        {
            //throw new NotImplementedException();
            try
            {
                var log = new History
                {
                    LogTypeId = 5,
                    InteractionTypeId = interaction,
                    Domain = Environment.UserDomainName,
                    UserName = Environment.UserName,
                    PCName = Environment.MachineName,
                    FileName = null,
                    FileOperationId = null,
                    ErrorMsg = null
                };
                return log;

            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                return null;
            }
        }