예제 #1
0
        internal static IList <GoodsRuntimeEntity> FindRuntimes(string applyId, string productId)
        {
            var sql = @"select id,hospital_id,apply_id,serial_id,barcode,count,product_id from goods_runtime where apply_id=@p_apply_id and product_id=@p_product_id";

            var db  = DatabaseFactory.CreateDatabase();
            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "p_apply_id", DbType.String, applyId);
            db.AddInParameter(cmd, "p_product_id", DbType.String, productId);

            var list = new List <GoodsRuntimeEntity>();

            using (var reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    var entity = new GoodsRuntimeEntity();
                    entity.Init(reader);

                    list.Add(entity);
                }
            }

            return(list);
        }
예제 #2
0
        public static GoodsRuntimeEntity GetRuntime(string barcode, string hospitalId)
        {
            var sql = @"select id,hospital_id,apply_id,serial_id,barcode,count,product_id from goods_runtime where barcode=@p_barcode and hospital_id=@p_hospital_id";

            var db  = DatabaseFactory.CreateDatabase();
            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "p_barcode", DbType.String, barcode);
            db.AddInParameter(cmd, "p_hospital_id", DbType.String, hospitalId);

            using (var reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    var entity = new GoodsRuntimeEntity();
                    entity.Init(reader);

                    return(entity);
                }
            }

            return(null);
        }