Ejemplo n.º 1
0
        public MoveFormSerialEntity SaveSerial(MoveFormSerialEntity moveSerial)
        {
            string sql = string.Empty;

            if (string.IsNullOrEmpty(moveSerial.Id))
            {
                sql = string.Format(@"insert into move_form_serial({0}) values(
@p_id
,@p_move_id
,@p_form_no
,@p_product_id
,@p_from_serial
,@p_to_serial
,@p_count
,@p_package_count)", SERIAL_COLUMNS);

                moveSerial.Id = Guid.NewGuid().ToString();
            }
            else
            {
                sql = @"update move_form_serial set 
move_id        = @p_move_id
,form_no       = @p_form_no
,product_id    = @p_product_id
,from_serial   = @p_from_serial
,to_serial     = @p_to_serial
,count         = @p_count  
,package_count = @p_package_count
where id = @p_id";
            }

            DbCommand dc = Db.GetSqlStringCommand(sql);

            Db.AddInParameter(dc, "p_id", DbType.String, moveSerial.Id);
            Db.AddInParameter(dc, "p_move_id", DbType.String, moveSerial.MoveId);
            Db.AddInParameter(dc, "p_form_no", DbType.Int32, moveSerial.FormNo);
            Db.AddInParameter(dc, "p_product_id", DbType.String, moveSerial.ProductId);
            Db.AddInParameter(dc, "p_from_serial", DbType.String, moveSerial.FromSerial);
            Db.AddInParameter(dc, "p_to_serial", DbType.String, moveSerial.ToSerial);
            Db.AddInParameter(dc, "p_count", DbType.Int32, moveSerial.Count);
            Db.AddInParameter(dc, "p_package_count", DbType.Int32, moveSerial.PackageCount);

            Db.ExecuteNonQuery(dc, DbTrans);

            return(moveSerial);
        }
Ejemplo n.º 2
0
        public MoveFormSerialEntity FindToSerial(string formId, string toSerial)
        {
            var sql = string.Format("select {0} from move_form_serial where move_id = @p_move_id and to_serial = @p_to_serial", SERIAL_COLUMNS);
            var dc  = Db.GetSqlStringCommand(sql);

            Db.AddInParameter(dc, "p_move_id", DbType.String, formId);
            Db.AddInParameter(dc, "p_to_serial", DbType.String, toSerial);

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

                    return(entity);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public List <MoveFormSerialEntity> FindAllSerials(string moveID)
        {
            var sql = string.Format("SELECT {0} FROM move_form_serial WHERE move_id = @p_move_id", SERIAL_COLUMNS);

            var dc = Db.GetSqlStringCommand(sql);

            Db.AddInParameter(dc, "p_move_id", DbType.String, moveID);

            var list = new List <MoveFormSerialEntity>();

            using (var reader = Db.ExecuteReader(dc))
            {
                while (reader.Read())
                {
                    var item = new MoveFormSerialEntity();
                    item.Init(reader);

                    list.Add(item);
                }
            }

            return(list);
        }
Ejemplo n.º 4
0
        private IList <MoveFormSerialEntity> FindSerialByProduct(string formId, string productId)
        {
            var sql = string.Format("select {0} from move_form_serial where move_id = @p_move_id and product_id = @p_product_id", SERIAL_COLUMNS);
            var dc  = Db.GetSqlStringCommand(sql);

            Db.AddInParameter(dc, "p_move_id", DbType.String, formId);
            Db.AddInParameter(dc, "p_product_id", DbType.String, productId);

            var list = new List <MoveFormSerialEntity>();

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

                    list.Add(entity);
                }
            }

            return(list);
        }