Exemplo n.º 1
0
        public static int Update(AllocationStockModel stockModel)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Sm_Allocation_Stock set ");
            builder.Append("number=@number where asid=@asid ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@number", SqlDbType.Int), new SqlParameter("@asid", SqlDbType.NVarChar, 50) };
            commandParameters[0].Value = stockModel.Number;
            commandParameters[1].Value = stockModel.Asid;
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
        }
Exemplo n.º 2
0
        public static int Insert(SqlTransaction trans, AllocationStockModel stockModel)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" insert into Sm_Allocation_Stock(asid,scode,acode,sprice,corp,number) ");
            builder.Append(" values(newid(),@scode,@acode,@sprice,@corp,@number) ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@acode", SqlDbType.NVarChar, 0x40), new SqlParameter("@scode", SqlDbType.VarChar, 50), new SqlParameter("@sprice", SqlDbType.Decimal), new SqlParameter("@corp", SqlDbType.NVarChar, 0x40), new SqlParameter("@number", SqlDbType.Decimal) };
            commandParameters[0].Value = stockModel.ACode;
            commandParameters[1].Value = stockModel.SCode;
            commandParameters[2].Value = stockModel.Sprice;
            commandParameters[3].Value = stockModel.Corp;
            commandParameters[4].Value = stockModel.Number;
            return(SqlHelper.ExecuteNonQuery(trans, CommandType.Text, builder.ToString(), commandParameters));
        }