Exemplo n.º 1
0
        public static Model.Error404 GetError404Model(DataRow row)
        {
            Model.Error404 objModel = new General.ErrorLogging.Model.Error404();
            objModel.ID          = SqlConvert.ToInt32(row["Error404ID"]);
            objModel.AppID       = SqlConvert.ToInt32(row["Error404AppID"]);
            objModel.Environment = (Environment.EnvironmentContext)SqlConvert.ToInt16(row["Error404EnvironmentID"]);
            if (row["Error404ClientID"] != DBNull.Value)
            {
                objModel.ClientID = SqlConvert.ToString(row["Error404ClientID"]);
            }
            if (row["Error404FirstTime"] != DBNull.Value)
            {
                objModel.FirstTime = (DateTimeOffset)row["Error404FirstTime"];
            }
            if (row["Error404LastTime"] != DBNull.Value)
            {
                objModel.LastTime = (DateTimeOffset)row["Error404LastTime"];
            }
            objModel.URL       = SqlConvert.ToString(row["Error404URL"]);
            objModel.Count     = SqlConvert.ToInt16(row["Error404Count"]);
            objModel.Hide      = SqlConvert.ToBoolean(row["Error404Hide"]);
            objModel.UserAgent = SqlConvert.ToString(row["Error404UserAgent"]);
            objModel.Detail    = SqlConvert.ToString(row["Error404Detail"]);

            if (row.Table.Columns.Contains("AppURL"))
            {
                objModel.AppName = SqlConvert.ToString(row["AppName"]);
                objModel.AppURL  = SqlConvert.ToString(row["AppURL"]);
            }

            return(objModel);
        }
Exemplo n.º 2
0
        public static ILoggingFilter GetFilterModel(DataRow row, LoggingFilterViewType viewType = LoggingFilterViewType.Full)
        {
            ILoggingFilter objModel;

            if (viewType == LoggingFilterViewType.Browser)
            {
                objModel = new General.ErrorLogging.Model.LoggingFilterBrowserView();
            }
            else if (viewType == LoggingFilterViewType.RemoteServer)
            {
                objModel = new General.ErrorLogging.Model.LoggingFilterRemoteServerView();
            }
            else
            {
                objModel = new General.ErrorLogging.Model.LoggingFilter();
            }
            objModel.ID    = SqlConvert.ToInt32(row["FilterID"]);
            objModel.Name  = SqlConvert.ToString(row["FilterName"]);
            objModel.AppID = SqlConvert.ToInt32(row["FilterAppID"]);
            //if (row["AppFilter"] != DBNull.Value && !StringFunctions.IsNullOrWhiteSpace(row["AppFilter"].ToString()))
            //    objModel.AppFilter = Model.ApplicationFilterModel.FromJson<Model.ApplicationFilterModel>(row["AppFilter"].ToString());
            if (row["ClientFilter"] != DBNull.Value && !StringFunctions.IsNullOrWhiteSpace(row["ClientFilter"].ToString()))
            {
                objModel.ClientFilter = Model.ClientFilterModel.FromJson <Model.ClientFilterModel>(row["ClientFilter"].ToString());
            }
            if (row["UserFilter"] != DBNull.Value && !StringFunctions.IsNullOrWhiteSpace(row["UserFilter"].ToString()))
            {
                objModel.UserFilter = Model.UserFilterModel.FromJson <Model.UserFilterModel>(row["UserFilter"].ToString());
            }
            if (row["EnvironmentFilter"] != DBNull.Value && !StringFunctions.IsNullOrWhiteSpace(row["EnvironmentFilter"].ToString()))
            {
                objModel.EnvironmentFilter = Model.EnvironmentFilterModel.FromJson <Model.EnvironmentFilterModel>(row["EnvironmentFilter"].ToString());
            }
            if (row["EventFilter"] != DBNull.Value && !StringFunctions.IsNullOrWhiteSpace(row["EventFilter"].ToString()))
            {
                objModel.EventFilter = Model.EventFilterModel.FromJson <Model.EventFilterModel>(row["EventFilter"].ToString());
            }

            objModel.Enabled = SqlConvert.ToBoolean(row["FilterEnabled"]);
            if (row["FilterStartDate"] != DBNull.Value)
            {
                objModel.StartDate = (DateTimeOffset)row["FilterStartDate"];
            }
            if (row["FilterEndDate"] != DBNull.Value)
            {
                objModel.EndDate = (DateTimeOffset)row["FilterEndDate"];
            }
            if (row["FilterPageEmail"] != DBNull.Value)
            {
                objModel.PageEmail = (EmailAddress)row["FilterPageEmail"].ToString();
            }
            if (row["FilterPageSMS"] != DBNull.Value)
            {
                objModel.PageSMS = (PhoneNumber)row["FilterPageSMS"].ToString();
            }

            General.FingerPrint objFingerPrint = new General.FingerPrint();
            objFingerPrint.CreatedBy = SqlConvert.ToInt32(row["FilterCreatedBy"]);
            if (row["FilterCreateDate"] != DBNull.Value)
            {
                objFingerPrint.CreatedOn = ((DateTimeOffset)row["FilterCreateDate"]).LocalDateTime;
            }
            if (row["FilterModifyDate"] != DBNull.Value)
            {
                objFingerPrint.ModifiedOn = ((DateTimeOffset)row["FilterModifyDate"]).LocalDateTime;
            }
            objModel.FingerPrint = objFingerPrint;

            objModel.Custom1 = SqlConvert.ToString(row["FilterCustom1"]);
            objModel.Custom2 = SqlConvert.ToString(row["FilterCustom2"]);
            objModel.Custom3 = SqlConvert.ToString(row["FilterCustom3"]);

            return(objModel);
        }