Exemplo n.º 1
0
        public static IList <GoodsStateEntity> QueryInvalid(FormType formType, string vendorId, string hospitalId)
        {
            var sql = string.Format(@"select top 30 {0} from goods_state
where future_form_id in (select id from dispatch_form where vendor_id=@p_vendor_id and hospital_id=@p_hospital_id and scan_over=0)
    and future_form_type=@p_future_form_type and future_valid=0", COLUMNS);

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

            db.AddInParameter(dc, "p_future_form_type", DbType.Int32, (int)formType);
            db.AddInParameter(dc, "p_vendor_id", DbType.String, vendorId);
            db.AddInParameter(dc, "p_hospital_id", DbType.String, hospitalId);

            var list = new List <GoodsStateEntity>();

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

                    list.Add(entity);
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public static GoodsStateEntity GetByBarcode(string barcode)
        {
            var sql = string.Format("select {0} from goods_state where barcode=@p_barcode", COLUMNS);
            var db  = DatabaseFactory.CreateDatabase();

            var dc = db.GetSqlStringCommand(sql);

            db.AddInParameter(dc, "p_barcode", DbType.String, barcode);

            using (var reader = db.ExecuteReader(dc))
            {
                if (reader.Read())
                {
                    var entity = new GoodsStateEntity();
                    entity.Init(reader);

                    return(entity);
                }
            }

            return(null);
        }