Пример #1
0
        private MarketCodeData buildMarketCodeData(DataRow row)
        {
            MarketCodeData marketCode = new MarketCodeData();

            marketCode.Code             = (string)row["code"];
            marketCode.CodeForView      = marketCode.Code;
            marketCode.GoodsID          = (string)row["goods_id"];
            marketCode.ActivateDatetime = ((DateTime)row["activate_dt"]).ToString(@"yyyy-MM-dd HH:mm:ss");
            marketCode.OrderID          = (string)row["order_id"];

            return(marketCode);
        }
Пример #2
0
        public List <MarketCodeData> QueryMarketCodesUnused(string goodsId)
        {
            List <MarketCodeData> marketCodes = new List <MarketCodeData>();

            DataSet ds = ExecuteDataSet(@"select code, goods_id, activate_dt, order_id from market_code where goods_id = @goods_id and order_id = ''",
                                        new MySqlParameter("@goods_id", goodsId));

            if (null != ds && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; ++i)
                {
                    DataRow        dr         = ds.Tables[0].Rows[i];
                    MarketCodeData marketCode = buildMarketCodeData(dr);
                    if (null != marketCode)
                    {
                        marketCodes.Add(marketCode);
                    }
                }
            }
            return(marketCodes);
        }