Ejemplo n.º 1
0
        public static List <CPostal> Search(string searchString, int limit, int offset)
        {
            string sql = new StringBuilder(BSql)
                         .Append(" WHERE ")
                         .Append(searchString)
                         .ToString();
            List <MySqlParameter> lp = new List <MySqlParameter>();

            return(CPostal.ExecuteQuery(sql, lp, limit, offset));
        }
Ejemplo n.º 2
0
        public static List <CPostal> SerachByCliente(string cliente, int limit, int offset)
        {
            string sql = new StringBuilder(BSql)
                         .Append(" WHERE ")
                         .Append(string.Format("(`{0}` like @{0})", CPostal.Column.cliente.ToString()))
                         .ToString();
            List <MySqlParameter> lp = new List <MySqlParameter>();

            lp.Add(new MySqlParameter("@" + CPostal.Column.cliente.ToString(), "%" + cliente.Trim().Replace(' ', '%') + "%"));

            return(CPostal.ExecuteQuery(sql, lp, limit, offset));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get a client from database
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public static List <CPostal> GetClient(string client)
        {
            string sql = new StringBuilder(BSql)
                         .Append(" WHERE ")
                         .Append(string.Format("(`{0}` = @{0})", CPostal.Column.cliente.ToString()))
                         .ToString();
            List <MySqlParameter> lp = new List <MySqlParameter>();

            lp.Add(new MySqlParameter("@" + CPostal.Column.cliente.ToString(), client));

            return(CPostal.ExecuteQuery(sql, lp, 1, 0));
        }
Ejemplo n.º 4
0
        public static List <CPostal> SearchByCpostal(string cp, int limit, int offset)
        {
            string p1  = "p";
            string sql = new StringBuilder(BSql)
                         .Append(" WHERE ")
                         .Append(string.Format("(CONCAT(`{0}`,`{1}`) like @{2})", CPostal.Column.cp4, CPostal.Column.cp3, p1))
                         .ToString();
            List <MySqlParameter> lp = new List <MySqlParameter>();

            lp.Add(new MySqlParameter("@" + p1, "%" + Regex.Replace(cp.Trim().Replace("-", "%").Replace(" ", "%"), @"\s?\D?", "") + "%"));

            return(CPostal.ExecuteQuery(sql, lp, limit, offset));
        }
Ejemplo n.º 5
0
        public static List <CPostal> SearchByDisAddress(string distrito, string address, int limit, int offset)
        {
            string sql = new StringBuilder(BSql)
                         .Append(" WHERE ")
                         .Append(string.Format("(`{0}` like @{0})", CPostal.Column.morada.ToString()))
                         .Append(" AND ")
                         .Append(string.Format("(`{0}` = @{0})", CPostal.Column.distrito.ToString()))
                         .ToString();
            List <MySqlParameter> lp = new List <MySqlParameter>();

            lp.Add(new MySqlParameter("@" + CPostal.Column.morada.ToString(), "%" + address.Trim().Replace(' ', '%') + "%"));
            lp.Add(new MySqlParameter("@" + CPostal.Column.distrito.ToString(), distrito));

            return(CPostal.ExecuteQuery(sql, lp, limit, offset));
        }