Example #1
0
        public LogWebErrors DeleteLogWebErrors(long ID)
        {
            LogWebErrors dbEntry = context.LogWebErrors.Find(ID);

            if (dbEntry != null)
            {
                try
                {
                    context.LogWebErrors.Remove(dbEntry);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    e.SaveErrorMethod(String.Format("DeleteLogWebErrors(ID={0})", ID), blog);
                    return(null);
                }
            }
            return(dbEntry);
        }
Example #2
0
        public long SaveLogWebErrors(LogWebErrors LogWebErrors)
        {
            LogWebErrors dbEntry;

            try
            {
                if (LogWebErrors.ID == 0)
                {
                    dbEntry = new LogWebErrors()
                    {
                        ID                 = 0,
                        DateTime           = LogWebErrors.DateTime,
                        UserName           = LogWebErrors.UserName,
                        Authentication     = LogWebErrors.Authentication,
                        AuthenticationType = LogWebErrors.AuthenticationType,
                        UserHostName       = LogWebErrors.UserHostName,
                        UserHostAddress    = LogWebErrors.UserHostAddress,
                        url                = LogWebErrors.url,
                        PhysicalPath       = LogWebErrors.PhysicalPath,
                        UserAgent          = LogWebErrors.UserAgent,
                        RequestType        = LogWebErrors.RequestType,
                        HttpCode           = LogWebErrors.HttpCode,
                        HResult            = LogWebErrors.HResult,
                        InnerException     = LogWebErrors.InnerException,
                        Message            = LogWebErrors.Message,
                        Source             = LogWebErrors.Source,
                        StackTrace         = LogWebErrors.StackTrace
                    };
                    context.LogWebErrors.Add(dbEntry);
                }
                else
                {
                    dbEntry = context.LogWebErrors.Find(LogWebErrors.ID);
                    if (dbEntry != null)
                    {
                        dbEntry.DateTime           = LogWebErrors.DateTime;
                        dbEntry.UserName           = LogWebErrors.UserName;
                        dbEntry.Authentication     = LogWebErrors.Authentication;
                        dbEntry.AuthenticationType = LogWebErrors.AuthenticationType;
                        dbEntry.UserHostName       = LogWebErrors.UserHostName;
                        dbEntry.UserHostAddress    = LogWebErrors.UserHostAddress;
                        dbEntry.url            = LogWebErrors.url;
                        dbEntry.PhysicalPath   = LogWebErrors.PhysicalPath;
                        dbEntry.UserAgent      = LogWebErrors.UserAgent;
                        dbEntry.RequestType    = LogWebErrors.RequestType;
                        dbEntry.HttpCode       = LogWebErrors.HttpCode;
                        dbEntry.HResult        = LogWebErrors.HResult;
                        dbEntry.InnerException = LogWebErrors.InnerException;
                        dbEntry.Message        = LogWebErrors.Message;
                        dbEntry.Source         = LogWebErrors.Source;
                        dbEntry.StackTrace     = LogWebErrors.StackTrace;
                    }
                }

                context.SaveChanges();
            }
            catch (Exception e)
            {
                e.SaveErrorMethod(String.Format("SaveLogWebErrors(LogWebErrors={0})", LogWebErrors.GetFieldsAndValue()), blog);

                return(-1);
            }
            return(dbEntry.ID);
        }