Ejemplo n.º 1
0
        public static IList <CheckFormProductEntity> GetHandleCheckProducts(string formId, string userId)
        {
            var sql = @"
select 
    id,check_id,category,product_id,inv_standard_count,inv_using_package_count,
    check_standard_count,check_using_package_count,status,
    operator_id,operated_time,check_over,created_id,created_time
from check_form_products where check_id=@check_id and status=@p_status and operator_id=@p_user_id";

            var db = DatabaseFactory.CreateDatabase();

            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "check_id", DbType.String, formId);
            db.AddInParameter(cmd, "p_status", DbType.String, CheckProductStatus.Handle);
            db.AddInParameter(cmd, "p_user_id", DbType.String, userId);

            var list = new List <CheckFormProductEntity>();

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

                    list.Add(entity);
                }
            }

            return(list);
        }
Ejemplo n.º 2
0
        public static CheckFormProductEntity GetCheckProduct(string formId, string productId)
        {
            var sql = @"
select 
    id,check_id,category,product_id,inv_standard_count,inv_using_package_count,
    check_standard_count,check_using_package_count,status,
    operator_id,operated_time,check_over,created_id,created_time
from check_form_products where check_id=@check_id and product_id=@p_product_id";

            var db = DatabaseFactory.CreateDatabase();

            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "check_id", DbType.String, formId);
            db.AddInParameter(cmd, "p_product_id", DbType.String, productId);

            var list = new List <CheckFormProductEntity>();

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

                    return(entity);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        private static void UpdateCheckProduct(CheckFormProductEntity checkProduct, Database db, DbTransaction trans)
        {
            var sql = @"update check_form_products 
set check_standard_count=@p_standard_count,check_using_package_count=@p_package_count,
    operator_id=@p_operator_id,operated_time=@p_operated_time
where id=@p_id and check_over=@p_check_over";

            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "p_id", DbType.String, checkProduct.Id);
            db.AddInParameter(cmd, "p_standard_count", DbType.Int32, checkProduct.CheckStandardCount);
            db.AddInParameter(cmd, "p_package_count", DbType.Int32, checkProduct.CheckUsingPackageCount);
            db.AddInParameter(cmd, "p_operator_id", DbType.String, checkProduct.OperatorId);
            db.AddInParameter(cmd, "p_operated_time", DbType.DateTime, checkProduct.OperatedTime);
            db.AddInParameter(cmd, "p_check_over", DbType.Boolean, false);

            db.ExecuteNonQuery(cmd, trans);
        }