예제 #1
0
        public static void LogError(DbEntityValidationException ex, string loggedInUserId)
        {
            foreach (var eve in ex.EntityValidationErrors)
            {
                string ErrorMessage;
                foreach (var ve in eve.ValidationErrors)
                {
                    ErrorMessage = ve.PropertyName + "  " + ve.ErrorMessage;
                }
            }
            HttpContext            ctxObject = HttpContext.Current;
            GST_TRN_ERROR_HANDLING error     = new GST_TRN_ERROR_HANDLING();

            error.CreatedDate = DateTime.Now;
            error.Status      = (byte)EnumConstants.ErrorHandling.Pending;
            error.ErrorPage   = Path.GetFileName(ctxObject.Request.Path);
            error.CreatedBy   = loggedInUserId;
            error.Message     = ex.Message;
            error.RequestUrl  = (ctxObject.Request.Url != null) ? ctxObject.Request.Url.ToString() : String.Empty;
            if (ctxObject.Request.ServerVariables["HTTP_REFERER"] != null)
            {
                error.ServerName = ctxObject.Request.ServerVariables["HTTP_REFERER"].ToString();
            }
            error.UserIP      = (ctxObject.Request.UserHostAddress != null) ? ctxObject.Request.UserHostAddress : String.Empty;
            error.ErrorSource = ex.Source;
            error.TargetSite  = ex.TargetSite.ToString();
            error.StackTrace  = ex.StackTrace;
            cls_ErrorLog errorLog = new cls_ErrorLog();

            errorLog.SaveError(error);
        }
예제 #2
0
        public static void LogError(Exception ex, string loggedInUserId)
        {
            HttpContext            ctxObject = HttpContext.Current;
            GST_TRN_ERROR_HANDLING error     = new GST_TRN_ERROR_HANDLING();

            error.CreatedDate = DateTime.Now;
            error.Status      = (byte)EnumConstants.ErrorHandling.Pending;
            error.ErrorPage   = Path.GetFileName(ctxObject.Request.Path);
            error.CreatedBy   = loggedInUserId;
            error.Message     = ex.Message;
            error.RequestUrl  = (ctxObject.Request.Url != null) ? ctxObject.Request.Url.ToString() : String.Empty;
            if (ctxObject.Request.ServerVariables["HTTP_REFERER"] != null)
            {
                error.ServerName = ctxObject.Request.ServerVariables["HTTP_REFERER"].ToString();
            }
            string ipaddress;

            ipaddress = ctxObject.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
            if (ipaddress == "" || ipaddress == null)
            {
                error.UserIP = ctxObject.Request.ServerVariables["REMOTE_ADDR"];
            }
            //error. = (ctxObject.Request.UserHostAddress != null) ? ctxObject.Request.UserHostAddress : String.Empty;
            error.ErrorSource = ex.Source;
            error.TargetSite  = ex.TargetSite.ToString();
            error.StackTrace  = ex.StackTrace;
            cls_ErrorLog errorLog = new cls_ErrorLog();

            errorLog.SaveError(error);
        }
예제 #3
0
 public void SaveError(GST_TRN_ERROR_HANDLING error)
 {
     try
     {
         unitOfWork.ErrorHandlingRepository.Create(error);
         unitOfWork.Save();
     }
     catch (Exception ex)
     {  }
 }
예제 #4
0
        protected void lv_ErrorHandling_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            LinkButton lkbUpdate = (lv_ErrorHandling.Items[e.ItemIndex].FindControl("lkbUpdate")) as LinkButton;

            if (lkbUpdate.CommandName == "Update")
            {
                int id = Convert.ToInt32(lkbUpdate.CommandArgument);
                GST_TRN_ERROR_HANDLING invoice = unitofwork.ErrorHandlingRepository.Filter(x => x.ErrorLogId == id).SingleOrDefault();
                if (invoice != null)
                {
                    DropDownList ddlStatus = (lv_ErrorHandling.Items[e.ItemIndex].FindControl("ddlStatus")) as DropDownList;
                    if (ddlStatus.SelectedIndex > -1)
                    {
                        invoice.Status = Convert.ToByte(ddlStatus.SelectedValue);
                    }
                }
                unitofwork.ErrorHandlingRepository.Update(invoice);
                unitofwork.Save();
            }
            lv_ErrorHandling.EditIndex = -1;
            BindItems();
        }