Exemple #1
0
        private void FillRepeater()
        {
            StringBuilder sqlString = new StringBuilder();

            sqlString.Append("SELECT BASE_COMPANIES.*, ");
            sqlString.Append("(ACCOUNT.SURNAME+' '+ACCOUNT.NAME) AS OWNER ");
            sqlString.Append("FROM BASE_COMPANIES ");
            sqlString.Append("LEFT OUTER JOIN ACCOUNT ON BASE_COMPANIES.OWNERID = ACCOUNT.UID");

            sqlString.Append(" WHERE LIMBO=1");


            sqlString.Append(" ORDER BY BASE_COMPANIES.COMPANYNAME");

            Repeaterpaging1.PageSize    = UC.PagingSize;
            Repeaterpaging1.RepeaterObj = Repeater1;
            Repeaterpaging1.sqlRepeater = sqlString.ToString();
            Repeaterpaging1.CurrentPage = 0;
            Repeaterpaging1.BuildGrid();


            if (Repeater1.Items.Count > 0)
            {
                Repeater1.Visible    = true;
                RepeaterInfo.Visible = false;
            }
            else
            {
                RepeaterInfo.Text    = "<center>" + Root.rm.GetString("Bcotxt41") + "</center>";
                Repeater1.Visible    = false;
                RepeaterInfo.Visible = true;
            }
        }
        private void FindProductQuery()
        {
            string        search = DatabaseConnection.FilterInjection(Search.Text);
            StringBuilder q      = new StringBuilder();

            if (FindCatID.Text.Length > 0)
            {
                string c = String.Empty;
                FillQueryCategories(int.Parse(FindCatID.Text), ref c);
                c = c.Substring(0, c.Length - 3);
                q.AppendFormat("SELECT * FROM CATALOGPRODUCTS WHERE ({0}) AND (", c);
                q.AppendFormat("SHORTDESCRIPTION LIKE '{0}%' OR ", search);
                q.AppendFormat("LONGDESCRIPTION LIKE '{0}%' OR ", search);
                q.AppendFormat("CODE LIKE '{0}%') ", search);
                q.Append("ORDER BY CATEGORY");
            }
            else
            {
                q.AppendFormat("SELECT * FROM CATALOGPRODUCTS WHERE (");
                q.AppendFormat("SHORTDESCRIPTION LIKE '{0}%' OR ", search);
                q.AppendFormat("LONGDESCRIPTION LIKE '{0}%' OR ", search);
                q.AppendFormat("CODE LIKE '{0}%') ", search);
                q.Append("ORDER BY CATEGORY");
            }

            Repeaterpaging1.PageSize    = UC.PagingSize;
            Repeaterpaging1.RepeaterObj = ProductRepeater;
            Repeaterpaging1.sqlRepeater = q.ToString();
            Repeaterpaging1.CurrentPage = 0;
            Repeaterpaging1.BuildGrid();

            if (ProductRepeater.Items.Count > 0)
            {
                ProductRepeater.Visible = true;
            }
            else
            {
                ProductRepeater.Visible = false;
            }
            Tabber.Visible = false;
        }