Exemple #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term("Administration.LBL_RENAME_TABS"));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = SplendidCRM.Security.IS_ADMIN;
            if (!this.Visible)
            {
                return;
            }

            // 09/08/2005 Paul. An empty key is valid, so use a separate INSERT field.
            if (txtRENAME.Value == "1")
            {
                try
                {
                    SqlProcs.spMODULES_TAB_Rename(Guid.Empty, txtKEY.Value, ctlSearch.LANGUAGE, txtVALUE.Value);
                    SplendidCache.ClearList(ctlSearch.LANGUAGE, "moduleList");
                    // 01/17/2006 Paul.  Also need to clear the TabMenu.
                    SplendidCache.ClearTabMenu();
                    // 04/20/2006 Paul.  Also clear the term for the list.
                    L10N.SetTerm(ctlSearch.LANGUAGE, String.Empty, "moduleList", txtKEY.Value, txtVALUE.Value);
                    txtRENAME.Value = "";
                    // 09/09/2005 Paul.  Transfer so that viewstate will be reset completely.
                    // 01/04/2005 Paul.  Redirecting to default.aspx will loose the language setting.  Just rebind.
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                    lblError.Text = ex.Message;
                }
            }
            // Must bind in order for LinkButton to get the argument.
            // ImageButton does not work no matter what I try.
            TERMINOLOGY_BindData(true);
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         Guid gID = Sql.ToGuid(e.CommandArgument);
         if (e.CommandName == "Select")
         {
             TERMINOLOGY_BindData(true);
         }
         else if (e.CommandName == "Dropdown.MoveUp")
         {
             if (Sql.IsEmptyGuid(gID))
             {
                 throw(new Exception("Unspecified argument"));
             }
             SqlProcs.spTERMINOLOGY_LIST_MoveUp(gID);
             // 09/08/2005 Paul.  If the list changes, reset the cached values.
             SplendidCache.ClearList(ctlSearch.LANGUAGE, ctlSearch.DROPDOWN);
             //TERMINOLOGY_BindData(true);
             Response.Redirect("default.aspx?Dropdown=" + ctlSearch.DROPDOWN);
         }
         else if (e.CommandName == "Dropdown.MoveDown")
         {
             if (Sql.IsEmptyGuid(gID))
             {
                 throw(new Exception("Unspecified argument"));
             }
             SqlProcs.spTERMINOLOGY_LIST_MoveDown(gID);
             // 09/08/2005 Paul.  If the list changes, reset the cached values.
             SplendidCache.ClearList(ctlSearch.LANGUAGE, ctlSearch.DROPDOWN);
             //TERMINOLOGY_BindData(true);
             Response.Redirect("default.aspx?Dropdown=" + ctlSearch.DROPDOWN);
         }
         else if (e.CommandName == "Dropdown.Delete")
         {
             if (Sql.IsEmptyGuid(gID))
             {
                 throw(new Exception("Unspecified argument"));
             }
             SqlProcs.spTERMINOLOGY_LIST_Delete(gID);
             // 09/08/2005 Paul.  If the list changes, reset the cached values.
             SplendidCache.ClearList(ctlSearch.LANGUAGE, ctlSearch.DROPDOWN);
             //TERMINOLOGY_BindData(true);
             Response.Redirect("default.aspx?Dropdown=" + ctlSearch.DROPDOWN);
         }
         else
         {
             TERMINOLOGY_BindData(true);
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term("Dropdown.LBL_LIST_FORM_TITLE"));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = SplendidCRM.Security.IS_ADMIN;
            if (!this.Visible)
            {
                return;
            }

            try
            {
                // 09/08/2005 Paul. An empty key is valid, so use a separate INSERT field.
                if (txtINSERT.Value == "1")
                {
                    try
                    {
                        Guid gID = Guid.Empty;
                        SqlProcs.spTERMINOLOGY_LIST_Insert(ref gID, txtKEY.Value, ctlSearch.LANGUAGE, String.Empty, ctlSearch.DROPDOWN, Sql.ToInteger(txtINDEX.Value), txtVALUE.Value);
                        // 01/16/2006 Paul.  Update cache.
                        L10N.SetTerm(ctlSearch.LANGUAGE, String.Empty, ctlSearch.DROPDOWN, txtKEY.Value, txtVALUE.Value);
                        // 07/25/2005 Paul.  In addition to updating the term, we must update the cached list.
                        SplendidCache.ClearList(ctlSearch.LANGUAGE, ctlSearch.DROPDOWN);
                        txtINSERT.Value = "";
                        // 09/09/2005 Paul.  Transfer so that viewstate will be reset completely.
                        Response.Redirect("default.aspx?Dropdown=" + ctlSearch.DROPDOWN);
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                        lblError.Text = ex.Message;
                    }
                }
                if (!IsPostBack)
                {
                    string sDROPDOWN = Sql.ToString(Request["Dropdown"]);
                    if (!Sql.IsEmptyString(sDROPDOWN))
                    {
                        ctlSearch.DROPDOWN = sDROPDOWN;
                        TERMINOLOGY_BindData(true);
                    }
                }
                else
                {
                    // Must bind in order for LinkButton to get the argument.
                    // ImageButton does not work no matter what I try.
                    TERMINOLOGY_BindData(true);
                }
            }
            catch (Exception ex)
            {
                // 01/20/2006 Paul.  Need to catch all errors.  Saw a dropdown error when creating a new dropdown.
                lblError.Text = ex.Message;
            }
        }