Пример #1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //// Get the error details
            Exception CurrentException = Server.GetLastError();
            if (CurrentException.Message == "Maximum request length exceeded.")
            {
                Response.Redirect("/Home/UploadTooLarge");
            }
            else
            {
            //HttpException lastErrorWrapper = Server.GetLastError() as HttpException;
            string error = CurrentException.ToString();
            string innerException = null;
            try
            {
                innerException = CurrentException.InnerException.InnerException.Message;
            }
            catch
            {
            }

            ExceptionLog obj = new ExceptionLog();
            obj.ClientID = Convert.ToInt32(Session["UserID"]);
            obj.ErrorDetails = error;
            obj.InnerException = innerException;
            obj.EventDateTime = DateTime.Now.Date;
            WorkBountyDBEntities entity = new WorkBountyDBEntities();
            entity.ExceptionLogs.Add(obj);
            entity.SaveChanges();
            Server.ClearError();
            Response.Redirect("/Home/Error");
            }
        }
Пример #2
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //// Get the error details
            Exception CurrentException = Server.GetLastError();

            if (CurrentException.Message == "Maximum request length exceeded.")
            {
                Response.Redirect("/Home/UploadTooLarge");
            }
            else
            {
                //HttpException lastErrorWrapper = Server.GetLastError() as HttpException;
                string error          = CurrentException.ToString();
                string innerException = null;
                try
                {
                    innerException = CurrentException.InnerException.InnerException.Message;
                }
                catch
                {
                }

                ExceptionLog obj = new ExceptionLog();
                obj.ClientID       = Convert.ToInt32(Session["UserID"]);
                obj.ErrorDetails   = error;
                obj.InnerException = innerException;
                obj.EventDateTime  = DateTime.Now.Date;
                WorkBountyDBEntities entity = new WorkBountyDBEntities();
                entity.ExceptionLogs.Add(obj);
                entity.SaveChanges();
                Server.ClearError();
                Response.Redirect("/Home/Error");
            }
        }
Пример #3
0
        public string getUpdateTeamName(Team teamName)
        {
            try
            {
                using (var entities = new WorkBountyDBEntities())
                {
                    var checkTeamName = entities.Teams.Where(x => x.TeamName == teamName.TeamName).FirstOrDefault();

                        if(checkTeamName==null)
                             {
                                  var getTeamName = entities.Teams.Where(x => x.TeamUserInfoID == teamName.TeamUserInfoID).ToList();
                                     getTeamName.ForEach(a =>
                                            {
                                                   a.TeamName = teamName.TeamName;
                                             } );
                                entities.SaveChanges();
                               return "Success";
                                }
                        else
                        {
                            return "Error";
                        }
                    }

            }
            catch (Exception)
            {
                return "Error";
            }
        }