Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        private static void Create(CheckFormProductValidationEntity entity)
        {
            var sql = @"insert into check_form_products_validation
(
    id,check_id,product_id,barcode,inv_storeroom_id,inv_is_standard,inv_count,
    check_is_standard,check_count,status,created_id,created_time)
values
(   
    @p_id,@p_check_id,@p_product_id,@p_barcode,@p_inv_storeroom_id,@p_inv_is_standard,@p_inv_count,
    @p_check_is_standard,@p_check_count,@p_status,@p_created_id,@p_created_time
)";

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

            entity.Id = Guid.NewGuid().ToString();

            db.AddInParameter(cmd, "p_id", DbType.String, entity.Id);
            db.AddInParameter(cmd, "p_check_id", DbType.String, entity.CheckId);
            db.AddInParameter(cmd, "p_product_id", DbType.String, entity.ProductId);
            db.AddInParameter(cmd, "p_barcode", DbType.String, entity.Barcode);
            db.AddInParameter(cmd, "p_inv_storeroom_id", DbType.String, entity.InvStoreroomId);
            db.AddInParameter(cmd, "p_inv_is_standard", DbType.Boolean, entity.InvIsStandard.HasValue ? (object)entity.InvIsStandard.Value : DBNull.Value);
            db.AddInParameter(cmd, "p_inv_count", DbType.Int32, entity.InvCount.HasValue ? (object)entity.InvCount.Value : DBNull.Value);
            db.AddInParameter(cmd, "p_check_is_standard", DbType.Boolean, entity.CheckIsStandard.HasValue ? (object)entity.CheckIsStandard.Value : DBNull.Value);
            db.AddInParameter(cmd, "p_check_count", DbType.Int32, entity.CheckCount.HasValue ? (object)entity.CheckCount.Value : DBNull.Value);
            db.AddInParameter(cmd, "p_status", DbType.String, entity.Status);
            db.AddInParameter(cmd, "p_created_id", DbType.String, entity.CreatedId);
            db.AddInParameter(cmd, "p_created_time", DbType.DateTime, entity.CreatedTime);

            db.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public static void SaveProductValidation(CheckFormProductValidationEntity entity)
 {
     if (string.IsNullOrEmpty(entity.Id))
     {
         Create(entity);
     }
     else
     {
         Update(entity);
     }
 }
Ejemplo n.º 5
0
        private static void Update(CheckFormProductValidationEntity entity)
        {
            var sql = @"update check_form_products_validation set 
check_is_standard=@p_check_is_standard,check_count=@p_check_count,status=@p_status,
created_id=@p_created_id,created_time=@p_created_time
where id=@p_id";

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

            db.AddInParameter(cmd, "p_id", DbType.String, entity.Id);
            db.AddInParameter(cmd, "p_check_is_standard", DbType.Boolean, entity.CheckIsStandard);
            db.AddInParameter(cmd, "p_check_count", DbType.Int32, entity.CheckCount);
            db.AddInParameter(cmd, "p_status", DbType.String, entity.Status);
            db.AddInParameter(cmd, "p_created_id", DbType.String, entity.CreatedId);
            db.AddInParameter(cmd, "p_created_time", DbType.DateTime, entity.CreatedTime);

            db.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 6
0
 public void SaveProductValidation(CheckFormProductValidationEntity entity)
 {
     CheckFormRepository.SaveProductValidation(entity);
 }