示例#1
0
        public int AddErrorLog(ErrorsLogs ErrorLog)
        {
            try
            {
                HttpClient client = CreateHTTPClient(ConfigurationManager.AppSettings["SecurityServiceBaseURL"]);

                var postTask = client.PostAsJsonAsync("api/ClientsExceptionsLogging/", ErrorLog).Result;
                if (postTask.IsSuccessStatusCode)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private ErrorsLogs CreateErrorLogObject(HttpActionExecutedContext actionExecutedContext)
        {
            ErrorsLogs ErrorLog = new ErrorsLogs();

            ErrorLog.Project = new Projects()
            {
                ProjectID = Convert.ToInt32(ConfigurationManager.AppSettings["ProjectID"])
            };
            ErrorLog.URL            = actionExecutedContext.Request.RequestUri.AbsolutePath;
            ErrorLog.Method         = actionExecutedContext.Request.Method.Method;
            ErrorLog.Message        = GetErrorMessage(actionExecutedContext.Exception);
            ErrorLog.Source         = actionExecutedContext.Exception.Source;
            ErrorLog.StackTrace     = actionExecutedContext.Exception.StackTrace;
            ErrorLog.TargetSiteName = actionExecutedContext.Exception.TargetSite.Name;

            ErrorLog.CreatedBy = new Employees()
            {
                EmployeeCodeID = 22915
            };                                                                               ////????  later we'll change
            ErrorLog.CreatedOn = DateTime.Now;

            return(ErrorLog);
        }
        public JsonResult GetErrorsLogsDataTable(JQueryDataTableParamModel param)
        {
            var oErrorLog = new ErrorsLogs();

            DataTableProcessModel m         = new DataTableProcessModel();
            DataTableProcessModel dtProcess = DataTableProcesses.DataTableEslestir(param, m);

            oErrorLog.SortCol    = dtProcess.SortCol;
            oErrorLog.SortType   = dtProcess.SortType;
            oErrorLog.Page       = dtProcess.Page;
            oErrorLog.RowPerPage = dtProcess.RowPerPage;
            oErrorLog.IsList     = false;

            var getErrorsLogs = DAL.Account.ErrorsLogs.ErrorLogsGet(oErrorLog);

            var getErrorsLogsResult = new List <ErrorsLogs>();

            if (getErrorsLogs.HasResult)
            {
                getErrorsLogsResult = getErrorsLogs.Results;

                int rowCount   = getErrorsLogs.RowCount;
                int lnRowCount = rowCount;

                var result = from q in getErrorsLogsResult
                             select new
                {
                    q.Id,
                    q.UserId,
                    q.IP,
                    q.UserAgent,
                    q.Browser,
                    q.ErrorMessage,
                    q.Link,
                    ErrorDate = q.ErrorDate.ToString("yyyy-MM-dd hh:mm tt"),
                    q.IsSolved,
                    q.IsAjax,
                    q.PostedData
                };

                return(Json(new
                {
                    param.sEcho,
                    iTotalRecords = rowCount,
                    iTotalDisplayRecords = lnRowCount,
                    aaData = result
                },
                            JsonRequestBehavior.AllowGet));
            }
            else
            {
                int rowCount   = getErrorsLogs.RowCount;
                int lnRowCount = rowCount;

                var result = from q in getErrorsLogsResult
                             select new
                {
                    q.Id,
                    q.UserId,
                    q.IP,
                    q.UserAgent,
                    q.Browser,
                    q.ErrorMessage,
                    q.Link,
                    ActionDate = q.ErrorDate.ToString("yyyy-MM-dd hh:mm tt"),
                    q.IsSolved,
                    q.IsAjax,
                    q.PostedData
                };

                return(Json(new
                {
                    param.sEcho,
                    iTotalRecords = rowCount,
                    iTotalDisplayRecords = lnRowCount,
                    aaData = result
                },
                            JsonRequestBehavior.AllowGet));
            }
        }