Example #1
0
    public static string LogException(Exception exc, string source)
    {
        // Include enterprise logic for logging exceptions
        Helper     my          = new Helper();
        SqlCommand cmd         = new SqlCommand("setErrorLog");
        string     projectName = string.Empty;
        string     module      = string.Empty;
        string     Location    = source;

        string[] errorSource = source.Split('/');
        if (errorSource.Length > 2)
        {
            projectName = errorSource[2];
            module      = errorSource[errorSource.Length - 1].ToString();
        }


        cmd.Parameters.AddWithValue("@Project", projectName);
        cmd.Parameters.AddWithValue("@Module", module);
        cmd.Parameters.AddWithValue("@Location", Location);


        if (exc.InnerException != null)
        {
            cmd.Parameters.AddWithValue("@InnerExceptionType", exc.InnerException.GetType().ToString());
            cmd.Parameters.AddWithValue("@InnerExceptionMessage", exc.InnerException.Message);
            cmd.Parameters.AddWithValue("@InnerExceptionSource", exc.InnerException.Source);
            cmd.Parameters.AddWithValue("@InnerExceptionStackTrace", exc.InnerException.StackTrace);
        }

        cmd.Parameters.AddWithValue("@ExceptionType", exc.GetType().ToString());
        cmd.Parameters.AddWithValue("@ExceptionMessage", exc.Message);
        cmd.Parameters.AddWithValue("@ExceptionSource", source);
        cmd.Parameters.AddWithValue("@ExceptionStackTrace", exc.StackTrace);
        cmd.Parameters.AddWithValue("@UpdatedBy", PageExtensionMethods.getMyWindowsID());
        cmd.Parameters.Add("@ID", SqlDbType.Int);
        cmd.Parameters["@ID"].Direction = ParameterDirection.Output;
        my.ExecuteDMLCommand(ref cmd, "", "S");
        string id = cmd.Parameters["@ID"].Value.ToString();

        return(id);
    }
Example #2
0
        public ActionResult Index()
        {
            DB     my     = new DB();
            string myNTID = PageExtensionMethods.getMyWindowsID().ToString();
            //myNTID = "ktriv003";
            getEmployeeData_Result Model = my.getEmployeeData(myNTID).FirstOrDefault();

            Session["Me"]  = Model;
            ViewData.Model = Model;
            if (Request.UrlReferrer != null)
            {
                var previousURL = Request.UrlReferrer.AbsoluteUri;
                Redirect(previousURL);
            }
            else
            {
                return(View(Model));
            }
            return(null);
        }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.UrlReferrer != null)
        {
            PreviousPageUrl = Request.UrlReferrer.ToString();
        }
        myNTID  = PageExtensionMethods.getMyWindowsID().ToString();
        empCode = PageExtensionMethods.getMyEmployeeID();
        if (PageExtensionMethods.AmIAllowedThisPage(empCode, HttpContext.Current.Request.Url.AbsolutePath))
        {
            testPanel.Visible = true;
        }
        else
        {
            testPanel.Visible = false;
        }

        if (Request.QueryString["ex"] != null)
        {
            pnlError.Visible               = true;
            pnlSuccess.Visible             = false;
            errorID                        = Request.QueryString["ex"].ToString();
            lnkFlag4Followup.OnClientClick = "window.location.href = 'mailto:[email protected]?subject=PACMAN%20Issue%20%3A%20" + errorID + "&body=Hi%20Team%2C%0APlease%20help%20me%20with%20my%20PACMAN%20Issue%20logged%20today%20with%20ID%20%3A%20" + errorID + "%0AMy%20Login%20ID%20is%20%3A%20" + myNTID + "%0AMy%20Emp%20Code%20is%20%3A%20" + empCode + "'";
            lnkFlag4Followup.Text.Replace("*****@*****.**", "[email protected] with ID : " + errorID);
            btnErrorMessage.CommandName     = "FollowUp";
            btnErrorMessage.CommandArgument = errorID;
            btnErrorMessage.Visible         = true;
            btnErrorMessage.Enabled         = true;
            btnErrorMessage.Text            = "Kindly Followup on this error!";
        }
        else
        {
            resetLinks();
            pnlError.Visible   = false;
            pnlSuccess.Visible = true;
        }
    }