Ejemplo n.º 1
0
        /// <summary>
        /// 根据CustomerId获取商户信息
        /// </summary>
        /// <param name="pID">标识符的值</param>
        public t_customerEntity GetByCustomerID(object pID)
        {
            //参数检查
            if (pID == null)
            {
                return(null);
            }
            string id = pID.ToString();
            //组织SQL
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat("select * from [t_customer] where customer_id='{0}'  ", id.ToString());
            string           conn      = ConfigurationManager.AppSettings["Conn_ap"];
            DefaultSQLHelper sqlHelper = new DefaultSQLHelper(conn);
            //读取数据
            t_customerEntity m = null;

            using (SqlDataReader rdr = sqlHelper.ExecuteReader(sql.ToString()))
            {
                while (rdr.Read())
                {
                    this.Load(rdr, out m);
                    break;
                }
            }
            //返回
            return(m);
        }
Ejemplo n.º 2
0
        public t_customerEntity GetCustomer(string customerCode)
        {
            string sql = string.Format("select * from dbo.t_customer where customer_code='{0}'"
                                       , customerCode.Replace("'", "''"));
            string           conn      = ConfigurationManager.AppSettings["Conn_ap"];
            DefaultSQLHelper sqlHelper = new DefaultSQLHelper(conn);

            using (SqlDataReader rdr = sqlHelper.ExecuteReader(sql))
            {
                if (rdr.Read())
                {
                    t_customerEntity m;
                    this.Load(rdr, out m);
                    return(m);
                }
            }
            return(null);
        }
        /// <summary>
        /// Trade-获取平台微信公众号信息  add by Henry 2014-12-11
        /// </summary>
        /// <param name="pWhereConditions"></param>
        /// <param name="pOrderBys"></param>
        /// <returns></returns>
        public WApplicationInterfaceEntity[] GetCloudWAppInterface(IWhereCondition[] pWhereConditions, OrderBy[] pOrderBys)
        {
            //组织SQL
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat("select * from [WApplicationInterface] where isdelete=0 ");
            if (pWhereConditions != null)
            {
                foreach (var item in pWhereConditions)
                {
                    sql.AppendFormat(" and {0}", item.GetExpression());
                }
            }
            if (pOrderBys != null && pOrderBys.Length > 0)
            {
                sql.AppendFormat(" order by ");
                foreach (var item in pOrderBys)
                {
                    sql.AppendFormat(" {0} {1},", item.FieldName, item.Direction == OrderByDirections.Asc ? "asc" : "desc");
                }
                sql.Remove(sql.Length - 1, 1);
            }
            //执行SQL
            List <WApplicationInterfaceEntity> list = new List <WApplicationInterfaceEntity>();
            string           conn      = ConfigurationManager.AppSettings["Conn_alading"];
            DefaultSQLHelper sqlHelper = new DefaultSQLHelper(conn);

            using (SqlDataReader rdr = sqlHelper.ExecuteReader(sql.ToString()))
            {
                while (rdr.Read())
                {
                    WApplicationInterfaceEntity m;
                    this.Load(rdr, out m);
                    list.Add(m);
                }
            }
            //返回结果
            return(list.ToArray());
        }