예제 #1
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "AdvancedSearch")
         {
             Response.Redirect("default.aspx?Advanced=1");
         }
         else if (e.CommandName == "BasicSearch")
         {
             Response.Redirect("default.aspx?Advanced=0");
         }
         else if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx?Advanced=" + nAdvanced.ToString());
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassUpdate")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "edit", arrID, "PRODUCTS");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     // 07/09/2006 Paul.  The date conversion was moved out of the MassUpdate control.
                     //SqlProcs.spPRODUCTS_MassUpdate(sIDs, ctlMassUpdate.ASSIGNED_USER_ID, ctlMassUpdate.ACCOUNT_ID, ctlMassUpdate.STATUS, T10n.ToServerTime(ctlMassUpdate.START_DATE), T10n.ToServerTime(ctlMassUpdate.END_DATE), T10n.ToServerTime(ctlMassUpdate.COMPANY_SIGNED_DATE), T10n.ToServerTime(ctlMassUpdate.CUSTOMER_SIGNED_DATE));
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "delete", arrID, "PRODUCTS");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spPRODUCTS_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "AdvancedSearch")
         {
             Response.Redirect("default.aspx?Advanced=1");
         }
         else if (e.CommandName == "BasicSearch")
         {
             Response.Redirect("default.aspx?Advanced=0");
         }
         else if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx?Advanced=" + nAdvanced.ToString());
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
예제 #3
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Create")
         {
             Response.Redirect("PopupEdit.aspx?CAMPAIGN_ID=" + Sql.ToString(Request["CAMPAIGN_ID"]));
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Preview.Production")
         {
             ViewState["TEST"] = false;
             CAMPAIGNS_BindData(true);
         }
         else if (e.CommandName == "Preview.Test")
         {
             ViewState["TEST"] = true;
             CAMPAIGNS_BindData(true);
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #5
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "AdvancedSearch")
         {
             Response.Redirect("default.aspx?Advanced=1");
         }
         else if (e.CommandName == "BasicSearch")
         {
             Response.Redirect("default.aspx?Advanced=0");
         }
         else if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx?Advanced=" + nAdvanced.ToString());
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassUpdate")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "edit", arrID, "BUGS");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spBUGS_MassUpdate(sIDs, ctlMassUpdate.ASSIGNED_USER_ID, ctlMassUpdate.STATUS, ctlMassUpdate.PRIORITY, ctlMassUpdate.RESOLUTION, ctlMassUpdate.TYPE, ctlMassUpdate.SOURCE, ctlMassUpdate.PRODUCT_CATEGORY);
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "delete", arrID, "BUGS");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spBUGS_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 // 10/26/2007 Paul.  Use a stack to run the update in blocks of under 200 IDs.
                 //string sIDs = Utils.ValidateIDs(arrID);
                 System.Collections.Stack stk = Utils.FilterByACL_Stack(m_sMODULE, "delete", arrID, "EMAIL_TEMPLATES");
                 if (stk.Count > 0)
                 {
                     DbProviderFactory dbf = DbProviderFactories.GetFactory();
                     using (IDbConnection con = dbf.CreateConnection())
                     {
                         con.Open();
                         using (IDbTransaction trn = con.BeginTransaction())
                         {
                             try
                             {
                                 while (stk.Count > 0)
                                 {
                                     string sIDs = Utils.BuildMassIDs(stk);
                                     SqlProcs.spEMAIL_TEMPLATES_MassDelete(sIDs, trn);
                                 }
                                 trn.Commit();
                             }
                             catch (Exception ex)
                             {
                                 trn.Rollback();
                                 throw(new Exception(ex.Message, ex.InnerException));
                             }
                         }
                     }
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "ACLRole.MakeDefault")
         {
             // 08/08/2006 Paul.  Update the config value.
             string sNAME     = "default_role";
             string sCATEGORY = "system";
             string sVALUE    = Sql.ToString(e.CommandArgument);
             SqlProcs.spCONFIG_Update(sCATEGORY, sNAME, sVALUE);
             Application["CONFIG." + sNAME] = sVALUE;
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "ACLRole.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spACL_ROLES_Delete(gID);
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spACL_ROLES_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         DropDownList lst = ctlSearchView.FindControl("MODULE_NAME") as DropDownList;
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Shortcuts.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spSHORTCUTS_Delete(gID);
             SplendidCache.ClearShortcuts(lst.SelectedValue);
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "Shortcuts.Edit")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             Response.Redirect("edit.aspx?ID=" + gID.ToString());
         }
         else if (lst != null)
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             if (e.CommandName == "Shortcuts.MoveUp")
             {
                 SqlProcs.spSHORTCUTS_ORDER_MoveUp(gID);
                 SplendidCache.ClearShortcuts(lst.SelectedValue);
                 Response.Redirect("default.aspx");
             }
             else if (e.CommandName == "Shortcuts.MoveDown")
             {
                 SqlProcs.spSHORTCUTS_ORDER_MoveDown(gID);
                 SplendidCache.ClearShortcuts(lst.SelectedValue);
                 Response.Redirect("default.aspx");
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "TeamNotices.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spTEAM_NOTICES_Delete(gID);
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "MassUpdate")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spTEAM_NOTICES_MassUpdate(sIDs, T10n.ToServerTime(ctlMassUpdate.DATE_START), T10n.ToServerTime(ctlMassUpdate.DATE_END));
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spTEAM_NOTICES_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #10
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Terminology.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spTERMINOLOGY_Delete(gID);
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     //SqlProcs.spTERMINOLOGY_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "Export")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             SplendidExport.Export(vwMain, m_sMODULE, ctlExportHeader.ExportFormat, ctlExportHeader.ExportRange, grdMain.CurrentPageIndex, grdMain.PageSize, arrID);
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #11
0
        private void TERMINOLOGY_BindData(bool bBind)
        {
            bEnableAdd            = true;
            ctlListHeader.Visible = true;

            try
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *                   " + ControlChars.CrLf
                           + "  from vwMODULES_RenameTabs" + ControlChars.CrLf
                           + " where 1 = 1               " + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;
                        // 11/19/2005 Paul.  The language must be initialized before the search clause is applied.
                        if (!IsPostBack)
                        {
                            ctlSearch.LANGUAGE = L10n.NAME;
                        }
                        ctlSearch.SqlSearchClause(cmd);

                        if (bDebug)
                        {
                            RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
                        }

                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;

                                // 12/14/2007 Paul.  Only set the default sort if it is not already set.  It may have been set by SearchView.
                                if (String.IsNullOrEmpty(grdMain.SortColumn))
                                {
                                    grdMain.SortColumn = "TAB_ORDER";
                                    grdMain.SortOrder  = "asc";
                                }
                                grdMain.ApplySort();
                                if (bBind)
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term("Currencies.LBL_CURRENCY"));
            // 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
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *                 " + ControlChars.CrLf
                           + "  from vwCURRENCIES_List " + ControlChars.CrLf
                           + " order by CONVERSION_RATE" + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;
#if DEBUG
                        Page.RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
#endif
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                // 09/03/2005 Paul.  Convert the term here so that sorting will apply.
                                foreach (DataRow row in dt.Rows)
                                {
                                    // 09/03/2005 Paul.  Don't convert if NULL.
                                    // 04/20/2006 Paul.  Lists are always global (not associated with a module).
                                    row["STATUS"] = L10n.Term(".currency_status_dom.", row["STATUS"]);
                                }
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (!IsPostBack)
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                lblError.Text = ex.Message;
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
예제 #13
0
        protected void BindGrid()
        {
            Guid gUSER_ID = Sql.ToGuid(lstUSERS.SelectedValue);

            if (Sql.IsEmptyGuid(gUSER_ID))
            {
                ctlAccessView.Visible = false;
                btnSelectRole.Visible = false;
                grdMain.Visible       = false;
                return;
            }
            ctlAccessView.USER_ID = gUSER_ID;
            ctlAccessView.Visible = true;
            btnSelectRole.Visible = true;
            grdMain.Visible       = true;

            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                 " + ControlChars.CrLf
                       + "  from vwUSERS_ACL_ROLES " + ControlChars.CrLf
                       + " where 1 = 1             " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    Sql.AppendParameter(cmd, gUSER_ID, "USER_ID");
#if DEBUG
                    Page.RegisterClientScriptBlock("vwUSER_ACL_ROLES", Sql.ClientScriptBlock(cmd));
#endif
                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                // 05/03/2006 Paul.  Always bind, so that we don't have to redirect to show changes.
                                //if ( !IsPostBack )
                                {
                                    grdMain.SortColumn = "ROLE_NAME";
                                    grdMain.SortOrder  = "asc";
                                    grdMain.ApplySort();
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    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)
        {
            // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
            //Page.DataBind();
            string sUnifiedSearch = Sql.ToString(Request["txtUnifiedSearch"]);

            if (!Sql.IsEmptyString(sUnifiedSearch.Trim()))
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *              " + ControlChars.CrLf
                           + "  from vwPROJECTS_List" + ControlChars.CrLf
                           + " where 1 = 1          " + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;
                        SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
                        cmd.CommandText += sb.BuildQuery("   and ", "NAME");

                        if (bDebug)
                        {
                            RegisterClientScriptBlock("vwPROJECTS_List", Sql.ClientScriptBlock(cmd));
                        }

                        try
                        {
                            using (DbDataAdapter da = dbf.CreateDataAdapter())
                            {
                                ((IDbDataAdapter)da).SelectCommand = cmd;
                                using (DataTable dt = new DataTable())
                                {
                                    da.Fill(dt);
                                    vwMain             = dt.DefaultView;
                                    grdMain.DataSource = vwMain;
                                    if (!IsPostBack)
                                    {
                                        grdMain.SortColumn = "NAME";
                                        grdMain.SortOrder  = "asc";
                                        grdMain.ApplySort();
                                        grdMain.DataBind();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                            lblError.Text = ex.Message;
                        }
                    }
                }
                ctlListHeader.Visible = true;
            }
            else
            {
                ctlListHeader.Visible = false;
            }
        }
예제 #15
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Clear")
                {
                    ctlSearch.ClearForm();
                    Server.Transfer("default.aspx");
                }
                else if (e.CommandName == "Search")
                {
                    // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
                    grdMain.CurrentPageIndex = 0;
                    grdMain.ApplySort();
                    grdMain.DataBind();
                }
                else if (e.CommandName == "Config.Delete")
                {
                    Guid gID = Sql.ToGuid(e.CommandArgument);
                    DbProviderFactory dbf = DbProviderFactories.GetFactory();
                    using (IDbConnection con = dbf.CreateConnection())
                    {
                        con.Open();
                        string sSQL;
                        sSQL = "select *            " + ControlChars.CrLf
                               + "  from vwCONFIG_Edit" + ControlChars.CrLf
                               + " where ID = @ID     " + ControlChars.CrLf;
                        using (IDbCommand cmd = con.CreateCommand())
                        {
                            cmd.CommandText = sSQL;
                            Sql.AddParameter(cmd, "@ID", gID);
                            string sNAME = Sql.ToString(cmd.ExecuteScalar());

                            SqlProcs.spCONFIG_Delete(gID);
                            Application.Remove("CONFIG." + sNAME);
                        }
                    }

                    Response.Redirect("default.aspx");
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
예제 #16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SetPageTitle(L10n.Term("Shippers.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
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *         " + ControlChars.CrLf
                           + "  from vwSHIPPERS" + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;

                        if (bDebug)
                        {
                            RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
                        }

                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (!IsPostBack)
                                {
                                    grdMain.SortColumn = "LIST_ORDER";
                                    grdMain.SortOrder  = "asc";
                                    grdMain.ApplySort();
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
예제 #17
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            gID = Sql.ToGuid(Request["ID"]);
            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                         " + ControlChars.CrLf
                       + "  from vwACCOUNTS_PRODUCTS       " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    // 01/23/2007 Paul.
                    cmd.CommandTimeout *= 2;
                    cmd.CommandText     = sSQL;
                    // 11/27/2006 Paul.  Make sure to filter relationship data based on team access rights.
                    Security.Filter(cmd, m_sMODULE, "list");
                    cmd.CommandText += "   and ACCOUNT_ID = @ACCOUNT_ID  " + ControlChars.CrLf;
                    // 03/09/2007 Paul.  vwPRODUCTS does not have an INVOICE_DATE.  Use DATE_PURCHASED instead.
                    cmd.CommandText += " order by DATE_PURCHASED desc    " + ControlChars.CrLf;
                    Sql.AddParameter(cmd, "@ACCOUNT_ID", gID);

                    if (bDebug)
                    {
                        RegisterClientScriptBlock("vwACCOUNTS_PRODUCTS", Sql.ClientScriptBlock(cmd));
                    }

                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                // 09/05/2005 Paul. LinkButton controls will not fire an event unless the the grid is bound.
                                //if ( !IsPostBack )
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                                   " + ControlChars.CrLf
                       + "  from vwOPPORTUNITIES_MyList              " + ControlChars.CrLf
                       + " where ASSIGNED_USER_ID = @ASSIGNED_USER_ID" + ControlChars.CrLf
                       + " order by AMOUNT desc                      " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", Security.USER_ID);
#if DEBUG
                    Page.RegisterClientScriptBlock("vwTASKS_List", Sql.ClientScriptBlock(cmd));
#endif
                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataSet ds = new DataSet())
                            {
                                using (DataTable dt = new DataTable("vwOPPORTUNITIES_MyList"))
                                {
                                    ds.Tables.Add(dt);
                                    // 08/16/2005 Paul.  Instead of TOP, use Fill to restrict the records.
                                    // 04/02/2006 Paul.  Start record should be 0.
                                    da.Fill(ds, 0, 5, "vwOPPORTUNITIES_MyList");
                                    vwMain             = dt.DefaultView;
                                    grdMain.DataSource = vwMain;
                                    if (!IsPostBack)
                                    {
                                        //grdMain.SortColumn = "AMOUNT";
                                        //grdMain.SortOrder  = "desc" ;
                                        //grdMain.ApplySort();
                                    }
                                    // 09/15/2005 Paul. We must always bind, otherwise a Dashboard refresh will display the grid with empty rows.
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
예제 #19
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *           " + ControlChars.CrLf
                       + "  from vwTASKS_List" + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    // 11/27/2006 Paul.  Make sure to filter relationship data based on team access rights.
                    Security.Filter(cmd, m_sMODULE, "list");

                    if (bDebug)
                    {
                        RegisterClientScriptBlock("vwTASKS_List", Sql.ClientScriptBlock(cmd));
                    }

                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                // 07/24/2005 Paul.  Since this is not a dynamic grid, we must convert the task status manually.
                                foreach (DataRow row in dt.Rows)
                                {
                                    row["STATUS"] = L10n.Term(".task_status_dom.", row["STATUS"]);
                                }
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (!IsPostBack)
                                {
                                    grdMain.SortColumn = "NAME";
                                    grdMain.SortOrder  = "asc";
                                    grdMain.ApplySort();
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
     }
     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)
        {
            gID = Sql.ToGuid(Request["ID"]);

            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                           " + ControlChars.CrLf
                       + "  from vwCAMPAIGN_LOG_TrackContacts" + ControlChars.CrLf
                       + " where 1 = 1                       " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText  = sSQL;
                    cmd.CommandText += "   and CAMPAIGN_ID = @CAMPAIGN_ID" + ControlChars.CrLf;
                    cmd.CommandText += " order by ACTIVITY_DATE          " + ControlChars.CrLf;
                    Sql.AddParameter(cmd, "@CAMPAIGN_ID", gID);

                    if (bDebug)
                    {
                        RegisterClientScriptBlock("vwCAMPAIGN_LOG_TrackContacts", Sql.ClientScriptBlock(cmd));
                    }

                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                // 09/05/2005 Paul. LinkButton controls will not fire an event unless the the grid is bound.
                                //if ( !IsPostBack )
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            gID = Sql.ToGuid(Request["ID"]);
            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                       " + ControlChars.CrLf
                       + "  from vwPROJECTS_PROJECT_TASKS" + ControlChars.CrLf
                       + " where PROJECT_ID = @PROJECT_ID" + ControlChars.CrLf
                       + " order by DATE_DUE asc         " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    Sql.AddParameter(cmd, "@PROJECT_ID", gID);
#if DEBUG
                    Page.RegisterClientScriptBlock("vwPROJECTS_PROJECTTASKS", Sql.ClientScriptBlock(cmd));
#endif
                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                // 11/13/2005 Paul.  Convert the term here so that sorting will apply.
                                foreach (DataRow row in dt.Rows)
                                {
                                    row["STATUS"] = L10n.Term(".project_task_status_options.", row["STATUS"]);
                                }
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                // 09/05/2005 Paul. LinkButton controls will not fire an event unless the the grid is bound.
                                //if ( !IsPostBack )
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spEMAILMAN_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "SendQueued")
         {
             // 12/20/2007 Paul.  Send all queued emails, regardless of send date.
             EmailUtils.SendQueued(Application, Guid.Empty, Guid.Empty, true);
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #24
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            gID = Sql.ToGuid(Request["ID"]);

            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *                         " + ControlChars.CrLf
                       + "  from vwDOCUMENT_REVISIONS      " + ControlChars.CrLf
                       + " where DOCUMENT_ID = @DOCUMENT_ID" + ControlChars.CrLf
                       + " order by DATE_ENTERED desc      " + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    Sql.AddParameter(cmd, "@DOCUMENT_ID", gID);

                    if (bDebug)
                    {
                        RegisterClientScriptBlock("vwDOCUMENT_REVISIONS", Sql.ClientScriptBlock(cmd));
                    }

                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (!IsPostBack)
                                {
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE"));
            try
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *                 " + ControlChars.CrLf
                           + "  from vwTERMINOLOGY_HELP" + ControlChars.CrLf
                           + " where 1 = 1             " + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;

                        if (bDebug)
                        {
                            RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
                        }

                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (!IsPostBack)
                                {
                                    grdMain.SortColumn = "NAME";
                                    grdMain.SortOrder  = "asc";
                                    grdMain.ApplySort();
                                    grdMain.DataBind();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
예제 #26
0
        protected void BindInvitees()
        {
            try
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    string sSQL;
                    sSQL = "select *                                                               " + ControlChars.CrLf
                           + "  from vwACTIVITIES_Invitees                                           " + ControlChars.CrLf
                           + " where (INVITEE_TYPE = 'Users' or ASSIGNED_USER_ID = @ASSIGNED_USER_ID)" + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;
                        Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", Security.USER_ID);
                        ctlSearch.SqlSearchClause(cmd);
                        cmd.CommandText += " order by INVITEE_TYPE desc, LAST_NAME asc, FIRST_NAME asc" + ControlChars.CrLf;

                        if (bDebug)
                        {
                            RegisterClientScriptBlock("vwACTIVITIES_Invitees", Sql.ClientScriptBlock(cmd));
                        }

                        try
                        {
                            using (DbDataAdapter da = dbf.CreateDataAdapter())
                            {
                                ((IDbDataAdapter)da).SelectCommand = cmd;
                                using (DataTable dt = new DataTable())
                                {
                                    da.Fill(dt);
                                    vwMain             = dt.DefaultView;
                                    grdMain.DataSource = vwMain;
                                    grdMain.DataBind();
                                    divInvitees.Visible = true;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                            lblError.Text = ex.Message;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Feeds.Add")
         {
             Guid gFEED_ID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spUSERS_FEEDS_Update(Security.USER_ID, gFEED_ID, 0);
             Response.Redirect("default.aspx");
         }
         // 03/20/2007 Michael.  The command should be Feeds.Remove and not Feeds.Delete.
         else if (e.CommandName == "Feeds.Remove")
         {
             Guid gFEED_ID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spUSERS_FEEDS_Delete(Security.USER_ID, gFEED_ID);
             Response.Redirect("default.aspx");
         }
         else
         {
             throw(new Exception("Unknown command: " + e.CommandName));
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
        protected void Bind(bool bBind)
        {
            DbProviderFactory dbf = DbProviderFactories.GetFactory();

            using (IDbConnection con = dbf.CreateConnection())
            {
                string sSQL;
                sSQL = "select *             " + ControlChars.CrLf
                       + "  from vwCALLS_MyList" + ControlChars.CrLf;
                using (IDbCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = sSQL;
                    // 11/24/2006 Paul.  Use new Security.Filter() function to apply Team and ACL security rules.
                    Security.Filter(cmd, m_sMODULE, "list");
                    Sql.AppendParameter(cmd, Security.USER_ID, "ASSIGNED_USER_ID", false);

                    if (bDebug)
                    {
                        RegisterClientScriptBlock("vwCALLS_List", Sql.ClientScriptBlock(cmd));
                    }

                    try
                    {
                        using (DbDataAdapter da = dbf.CreateDataAdapter())
                        {
                            ((IDbDataAdapter)da).SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                da.Fill(dt);
                                vwMain             = dt.DefaultView;
                                grdMain.DataSource = vwMain;
                                if (bBind)
                                {
                                    grdMain.SortColumn = "DATE_START";
                                    grdMain.SortOrder  = "asc";
                                    grdMain.ApplySort();
                                }
                                // 09/15/2005 Paul. We must always bind, otherwise a Dashboard refresh will display the grid with empty rows.
                                grdMain.DataBind();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
        }
예제 #29
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx?Advanced=" + nAdvanced.ToString());
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "delete", arrID, "EMAIL_TEMPLATES");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spEMAIL_TEMPLATES_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Export")
         {
             // 11/03/2006 Paul.  Apply ACL rules to Export.
             int nACLACCESS = SplendidCRM.Security.GetUserAccess(m_sMODULE, "export");
             if (nACLACCESS >= 0)
             {
                 // 05/10/2007 Paul.  ACL_ACCESS.OWNER is not defined for the EMPLOYEES module.
                 //if ( nACLACCESS == ACL_ACCESS.OWNER )
                 //	vwMain.RowFilter = "ASSIGNED_USER_ID = '" + Security.USER_ID.ToString() + "'";
                 string[] arrID = Request.Form.GetValues("chkMain");
                 SplendidExport.Export(vwMain, m_sMODULE, ctlExportHeader.ExportFormat, ctlExportHeader.ExportRange, grdMain.CurrentPageIndex, grdMain.PageSize, arrID);
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }