Ejemplo n.º 1
0
    protected void GrdViewReturns_RowDeleted(object sender, GridViewDeletedEventArgs e)
    {
        try
        {
            if (e.Exception == null)
            {
                GrdViewReturns.DataBind();
            }
            else
            {
                if (e.Exception.InnerException != null)
                {
                    StringBuilder script = new StringBuilder();
                    //script.Append("alert('You are not allowed to delete the record. Please contact Supervisor.');");
                    script.Append(e.Exception.Message);
                    script.Append(e.Exception.StackTrace);
                    script.Append(e.Exception.InnerException.Message);
                    script.Append(e.Exception.InnerException.StackTrace);

                    //if (e.Exception.InnerException.Message.IndexOf("Invalid Date") > -1)
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);

                    e.ExceptionHandled = true;
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Ejemplo n.º 2
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         GrdViewReturns.DataBind();
     }
     catch (Exception ex)
     {
         TroyLiteExceptionManager.HandleException(ex);
     }
 }
Ejemplo n.º 3
0
    protected void frmViewAdd_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        try
        {
            if (e.Exception == null)
            {
                lnkBtnAdd.Visible = true;
                //MyAccordion.Visible = true;
                frmViewAdd.Visible     = false;
                GrdViewReturns.Visible = true;
                System.Threading.Thread.Sleep(1000);
                GrdViewReturns.DataBind();
            }
            else
            {
                if (e.Exception != null)
                {
                    StringBuilder script = new StringBuilder();
                    //script.Append("alert('Product with this name already exists, Please try with a different name.');");

                    if (e.Exception.InnerException != null)
                    {
                        if (e.Exception.InnerException.Message.IndexOf("duplicate values in the index") > -1)
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "Exception: " + e.Exception.Message, true);
                    }
                }

                lnkBtnAdd.Visible      = true;
                frmViewAdd.Visible     = false;
                GrdViewReturns.Visible = true;
                e.ExceptionHandled     = true;
                //MyAccordion.Visible = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }