Ejemplo n.º 1
0
        public static IList <GoodsFlowEntity> QueryWaitingValid(GoodsFlowValidType validType, int formNo, bool isValid, string vendorId, string hospitalId)
        {
            var sql = string.Format(@"select top 30 {0} from goods_flow 
where 1=1 {1} order by barcode", COLUMN_SQL, GetFormNoSql(validType, true));

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

            db.AddInParameter(dc, "p_form_no", DbType.Int32, formNo);
            if (validType == GoodsFlowValidType.Dispatch)
            {
                db.AddInParameter(dc, "p_vendor_id", DbType.String, vendorId);
            }
            db.AddInParameter(dc, "p_hospital_id", DbType.String, hospitalId);
            AddValidValue(db, dc, validType, isValid);

            var list = new List <GoodsFlowEntity>();

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

                    list.Add(entity);
                }
            }

            return(list);
        }
Ejemplo n.º 2
0
        public static GoodsFlowEntity GetByBarcode(GoodsFlowValidType validType, string barcode, string vendorId, string hospitalId)
        {
            var sql = string.Format(@"select {0} from goods_flow 
where 1=1 and barcode=@p_barcode {1}", COLUMN_SQL, GetValidTypeSql(validType));

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

            if (validType == GoodsFlowValidType.Dispatch)
            {
                db.AddInParameter(dc, "p_vendor_id", DbType.String, vendorId);
            }
            db.AddInParameter(dc, "p_hospital_id", DbType.String, hospitalId);
            db.AddInParameter(dc, "p_barcode", DbType.String, barcode);

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

                    return(entity);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public static GoodsFlowEntity GetByBarcode(string barcode)
        {
            var sql = string.Format("select {0} from goods_flow where barcode = @p_barcode", COLUMN_SQL);

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

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

            GoodsFlowEntity entity = null;

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

                    break;
                }
            }

            return(entity);
        }