示例#1
0
        public static IList <CheckFormProductValidationEntity> GetProductsValidation(string formId)
        {
            var sql = @"
select 
    id,check_id,product_id,barcode,inv_storeroom_id,inv_is_standard,inv_count,
    check_is_standard,check_count,status,adjust_type,created_id,created_time 
from check_form_products_validation
where check_id=@p_check_id and status in (@p_storeroom_status, @p_count_status, @p_no_exist, @p_in_system) order by barcode";

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

            db.AddInParameter(cmd, "p_check_id", DbType.String, formId);
            db.AddInParameter(cmd, "p_storeroom_status", DbType.String, CheckProductValidationStatus.Storeroom);
            db.AddInParameter(cmd, "p_count_status", DbType.String, CheckProductValidationStatus.Count);
            db.AddInParameter(cmd, "p_no_exist", DbType.String, CheckProductValidationStatus.NoExist);
            db.AddInParameter(cmd, "p_in_system", DbType.String, CheckProductValidationStatus.InSystem);

            var list = new List <CheckFormProductValidationEntity>();

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

                    list.Add(entity);
                }
            }

            return(list);
        }
示例#2
0
        public static CheckFormProductValidationEntity GetProductValidation(string formId, string barcode)
        {
            var sql = @"
select 
    id,check_id,product_id,barcode,inv_storeroom_id,inv_is_standard,inv_count,
    check_is_standard,check_count,status,adjust_type,created_id,created_time 
from check_form_products_validation
where check_id=@p_check_id and barcode=@p_barcode";

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

            db.AddInParameter(cmd, "p_check_id", DbType.String, formId);
            db.AddInParameter(cmd, "p_barcode", DbType.String, barcode);

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

                    return(entity);
                }
            }

            return(null);
        }