public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
 {
     string sSQL = String.Empty;
     SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
     sSQL += sb.BuildQuery("   and ", "NAME"        );
     sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
     return sSQL;
 }
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
            return(sSQL);
        }
 public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
 {
     string sSQL = String.Empty;
     SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
     sSQL += sb.BuildQuery("   and ", "NAME"        );
     sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
     // 12/06/2007 Paul.  Keep the numeric test here because the case number will be a true numeric.
     // We may want to fix this in the future if we change the case number to an alpha numeric.
     if ( Information.IsNumeric(sUnifiedSearch) )
         sSQL += sb.BuildQuery("    or ", "CASE_NUMBER" );
     return sSQL;
 }
 public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
 {
     string sSQL = String.Empty;
     SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
     sSQL += sb.BuildQuery("   and ", "NAME");
     if ( Information.IsNumeric(sUnifiedSearch) )
     {
         sSQL += sb.BuildQuery("    or ", "PHONE_ALTERNATE");
         sSQL += sb.BuildQuery("    or ", "PHONE_FAX"      );
         sSQL += sb.BuildQuery("    or ", "PHONE_OFFICE"   );
     }
     return sSQL;
 }
Example #5
0
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
            if (Information.IsNumeric(sUnifiedSearch))
            {
                sSQL += sb.BuildQuery("    or ", "CASE_NUMBER");
            }
            return(sSQL);
        }
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            if (Information.IsNumeric(sUnifiedSearch))
            {
                sSQL += sb.BuildQuery("    or ", "PHONE_ALTERNATE");
                sSQL += sb.BuildQuery("    or ", "PHONE_FAX");
                sSQL += sb.BuildQuery("    or ", "PHONE_OFFICE");
            }
            return(sSQL);
        }
Example #7
0
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
            // 12/06/2007 Paul.  Keep the numeric test here because the case number will be a true numeric.
            // We may want to fix this in the future if we change the case number to an alpha numeric.
            if (Information.IsNumeric(sUnifiedSearch))
            {
                sSQL += sb.BuildQuery("    or ", "CASE_NUMBER");
            }
            return(sSQL);
        }
Example #8
0
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            // 12/06/2007 Paul.  Skip the attempt to be efficient.  Something as simple as 555-1212 will fail the IsNumeric test.
            // if ( Information.IsNumeric(sUnifiedSearch) )
            {
                sSQL += sb.BuildQuery("    or ", "PHONE_ALTERNATE");
                sSQL += sb.BuildQuery("    or ", "PHONE_FAX");
                sSQL += sb.BuildQuery("    or ", "PHONE_OFFICE");
            }
            return(sSQL);
        }
        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;
            }
        }
 public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
 {
     string sSQL = String.Empty;
     SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
     sSQL += sb.BuildQuery("   and ", "NAME"        );
     //sSQL += sb.BuildQuery("    or ", "LAST_NAME"   );
     //sSQL += sb.BuildQuery("    or ", "FIRST_NAME"  );
     sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
     sSQL += sb.BuildQuery("    or ", "EMAIL1"      );
     sSQL += sb.BuildQuery("    or ", "EMAIL2"      );
     if ( Information.IsNumeric(sUnifiedSearch) )
     {
         sSQL += sb.BuildQuery("    or ", "PHONE_HOME"  );
         sSQL += sb.BuildQuery("    or ", "PHONE_MOBILE");
         sSQL += sb.BuildQuery("    or ", "PHONE_WORK"  );
         sSQL += sb.BuildQuery("    or ", "PHONE_OTHER" );
         sSQL += sb.BuildQuery("    or ", "PHONE_FAX"   );
     }
     return sSQL;
 }
 public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
 {
     string sSQL = String.Empty;
     SearchBuilder sb = new SearchBuilder(sUnifiedSearch, cmd);
     sSQL += sb.BuildQuery("   and ", "NAME"        );
     //sSQL += sb.BuildQuery("    or ", "LAST_NAME"   );
     //sSQL += sb.BuildQuery("    or ", "FIRST_NAME"  );
     sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
     sSQL += sb.BuildQuery("    or ", "EMAIL1"      );
     sSQL += sb.BuildQuery("    or ", "EMAIL2"      );
     // 12/06/2007 Paul.  Skip the attempt to be efficient.  Something as simple as 555-1212 will fail the IsNumeric test.
     // if ( Information.IsNumeric(sUnifiedSearch) )
     {
         sSQL += sb.BuildQuery("    or ", "PHONE_HOME"  );
         sSQL += sb.BuildQuery("    or ", "PHONE_MOBILE");
         sSQL += sb.BuildQuery("    or ", "PHONE_WORK"  );
         sSQL += sb.BuildQuery("    or ", "PHONE_OTHER" );
         sSQL += sb.BuildQuery("    or ", "PHONE_FAX"   );
     }
     return sSQL;
 }
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            //sSQL += sb.BuildQuery("    or ", "LAST_NAME"   );
            //sSQL += sb.BuildQuery("    or ", "FIRST_NAME"  );
            sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
            sSQL += sb.BuildQuery("    or ", "EMAIL1");
            sSQL += sb.BuildQuery("    or ", "EMAIL2");
            if (Information.IsNumeric(sUnifiedSearch))
            {
                sSQL += sb.BuildQuery("    or ", "PHONE_HOME");
                sSQL += sb.BuildQuery("    or ", "PHONE_MOBILE");
                sSQL += sb.BuildQuery("    or ", "PHONE_WORK");
                sSQL += sb.BuildQuery("    or ", "PHONE_OTHER");
                sSQL += sb.BuildQuery("    or ", "PHONE_FAX");
            }
            return(sSQL);
        }
Example #13
0
        public static string UnifiedSearch(string sUnifiedSearch, IDbCommand cmd)
        {
            string        sSQL = String.Empty;
            SearchBuilder sb   = new SearchBuilder(sUnifiedSearch, cmd);

            sSQL += sb.BuildQuery("   and ", "NAME");
            //sSQL += sb.BuildQuery("    or ", "LAST_NAME"   );
            //sSQL += sb.BuildQuery("    or ", "FIRST_NAME"  );
            sSQL += sb.BuildQuery("    or ", "ACCOUNT_NAME");
            sSQL += sb.BuildQuery("    or ", "EMAIL1");
            sSQL += sb.BuildQuery("    or ", "EMAIL2");
            // 12/06/2007 Paul.  Skip the attempt to be efficient.  Something as simple as 555-1212 will fail the IsNumeric test.
            // if ( Information.IsNumeric(sUnifiedSearch) )
            {
                sSQL += sb.BuildQuery("    or ", "PHONE_HOME");
                sSQL += sb.BuildQuery("    or ", "PHONE_MOBILE");
                sSQL += sb.BuildQuery("    or ", "PHONE_WORK");
                sSQL += sb.BuildQuery("    or ", "PHONE_OTHER");
                sSQL += sb.BuildQuery("    or ", "PHONE_FAX");
            }
            return(sSQL);
        }
        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;
            }
        }