Пример #1
0
        public ExampleDataModel Insert(ExampleDataModel dataModel)         // always do insert and update together. Check if it already exists, if so update, if not insert
        {
            try
            {
                using (AsignioDatabase db = new AsignioDatabase(ConnectionStringName))
                {
                    ExampleDataModel returnModel = GetFromID(dataModel.ExampleID);
                    ExamplePoco      poco        = dataModel.ToPoco();
                    if (returnModel != null)
                    {
                        db.Update(poco);
                    }
                    else
                    {
                        poco.ExampleID = GuidMapper.Map(Guid.NewGuid());
                        poco.DateAdded = DateTime.Now;
                        db.Insert(poco);
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMessage = ex.Message;
            }
            finally
            { }

            return(null);
        }
Пример #2
0
 internal static UserDataModel ToModel(this UserPoco source)
 {
     if (null != source)
     {
         return(new UserDataModel
         {
             EmailAddress = source.EmailAddress,
             UserID = GuidMapper.Map(source.UserID),
         });
     }
     return(null);
 }
Пример #3
0
 internal static LogWebRequestDataModel ToModel(this LogWebRequestPoco source)
 {
     if (null != source)
     {
         return(new LogWebRequestDataModel
         {
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             UserID = GuidMapper.Map(source.UserID),
             RawURL = source.RawURL,
             Parameters = source.Parameters,
             Important = source.Important,
         });
     }
     return(null);
 }
Пример #4
0
 internal static LogControllerActionDataModel ToModel(this LogControllerActionPoco source)
 {
     if (null != source)
     {
         return(new LogControllerActionDataModel
         {
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             UserID = GuidMapper.Map(source.UserID),
             ControllerName = source.ControllerName,
             ActionName = source.ActionName,
             Parameters = source.Parameters,
         });
     }
     return(null);
 }
Пример #5
0
 internal static CombinedLogWebResponseDataModel ToModel(this CombinedLogWebResponsePoco source)
 {
     if (null != source)
     {
         return(new CombinedLogWebResponseDataModel
         {
             EmailAddress = source.EmailAddress,
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             Status = source.Status,
             RedirectLocation = source.RedirectLocation,
             UserID = GuidMapper.Map(source.UserID),
             Important = source.Important,
         });
     }
     return(null);
 }
Пример #6
0
 internal static LogWebResponseDataModel ToModel(this LogWebResponsePoco source)
 {
     if (null != source)
     {
         return(new LogWebResponseDataModel
         {
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             UserID = GuidMapper.Map(source.UserID),
             Status = source.Status,
             StatusCode = source.StatusCode,
             StatusDescription = source.StatusDescription,
             RedirectLocation = source.RedirectLocation,
         });
     }
     return(null);
 }
 internal static LogDataModel ToModel(this LogPoco source)
 {
     if (null != source)
     {
         return(new LogDataModel
         {
             TimeStamp = source.TimeStamp,
             LogID = GuidMapper.Map(source.LogID),
             UserID = GuidMapper.Map(source.UserID),
             Message = source.Message,
             Username = source.Username,
             Source = source.Source,
             Level = source.Level,
         });
     }
     return(null);
 }
Пример #8
0
 internal static LogInfoDataModel ToModel(this LogInfoPoco source)
 {
     if (null != source)
     {
         return(new LogInfoDataModel
         {
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             UserID = GuidMapper.Map(source.UserID),
             Message = source.Message,
             MethodName = source.MethodName,
             Object = source.Object,
             ID = GuidMapper.Map(source.ID),
         });
     }
     return(null);
 }
Пример #9
0
 internal static LogExceptionDataModel ToModel(this LogExceptionPoco source)
 {
     if (null != source)
     {
         return(new LogExceptionDataModel
         {
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             UserID = GuidMapper.Map(source.UserID),
             Message = source.Message,
             MethodName = source.MethodName,
             Source = source.Source,
             StackTrace = source.StackTrace,
         });
     }
     return(null);
 }
Пример #10
0
 internal static CombinedLogDataModel ToModel(this CombinedLogPoco source)
 {
     if (null != source)
     {
         return(new CombinedLogDataModel
         {
             UserID = GuidMapper.Map(source.UserID),
             EmailAddress = source.EmailAddress,
             TimeStamp = source.TimeStamp,
             LogID = GuidMapper.Map(source.LogID),
             Message = source.Message,
             Level = source.Level,
             Source = source.Source,
             Important = source.Important,
         });
     }
     return(null);
 }
Пример #11
0
        internal static ExampleDataModel ToModel(this ExamplePoco source)
        {
            if (null != source)
            {
                return(new ExampleDataModel
                {
                    BoolValue = source.BoolValue,
                    DateAdded = source.DateAdded,
                    DoubleValue = source.DoubleValue,
                    ExampleID = GuidMapper.Map(source.ExampleID),
                    IntValue = source.IntValue,
                    Name = source.Name,
                    StringValue = source.StringValue,
                });
            }

            return(null);
        }
Пример #12
0
        internal static CombinedLogControllerActionDataModel ToModel(this CombinedLogControllerActionPoco source)
        {
            if (null != source)
            {
                return(new CombinedLogControllerActionDataModel
                {
                    EmailAddress = source.EmailAddress,
                    TimeStamp = source.TimeStamp,
                    WebRequestID = GuidMapper.Map(source.WebRequestID),
                    ControllerName = source.ControllerName,
                    ActionName = source.ActionName,
                    Parameters = source.Parameters,
                    UserID = GuidMapper.Map(source.UserID),
                    Important = source.Important,
                });
            }

            return(null);
        }
 internal static CombinedLogExceptionDataModel ToModel(this CombinedLogExceptionPoco source)
 {
     if (null != source)
     {
         return(new CombinedLogExceptionDataModel
         {
             UserID = GuidMapper.Map(source.UserID),
             EmailAddress = source.EmailAddress,
             TimeStamp = source.TimeStamp,
             WebRequestID = GuidMapper.Map(source.WebRequestID),
             Message = source.Message,
             MethodName = source.MethodName,
             Source = source.Source,
             StackTrace = source.StackTrace,
             Important = source.Important,
         });
     }
     return(null);
 }
Пример #14
0
        internal static CombinedLogInfoDataModel ToModel(this CombinedLogInfoPoco source)
        {
            if (null != source)
            {
                return(new CombinedLogInfoDataModel
                {
                    EmailAddress = source.EmailAddress,
                    TimeStamp = source.TimeStamp,
                    WebRequestID = GuidMapper.Map(source.WebRequestID),
                    Message = source.Message,
                    MethodName = source.MethodName,
                    Object = source.Object,
                    UserID = GuidMapper.Map(source.UserID),
                    Important = source.Important,
                });
            }

            return(null);
        }
Пример #15
0
        //public ExampleRepository(string connectionStringName)
        //	: base(typeof(ExampleRepository), connectionStringName)
        //{ }

        public ExampleDataModel GetFromID(Guid ExampleID)
        {
            try
            {
                using (AsignioDatabase db = new AsignioDatabase(ConnectionStringName))
                {
                    return(db.FirstOrDefault <ExamplePoco>(ExamplePoco.SelectByIDSQL, GuidMapper.Map(ExampleID)).ToModel());
                }
            }
            catch (Exception ex)
            {
                string errorMessage = ex.Message;
            }
            finally
            { }

            return(null);
        }