public int UpdateStockReturnItem(StockReturnItem objStockReturnItem) { using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @"UPDATE StockReturnItem SET StockReturnId = @StockReturnId ,SlNo = @SlNo ,ItemId = @ItemId ,ItemDescription = @ItemDescription,PartNo = @PartNo,Quantity = @Quantity,Unit = @Unit,CreatedBy = @CreatedBy,CreatedDate = @CreatedDate OUTPUT INSERTED.StockReturnItemId WHERE StockReturnItemId = @StockReturnItemId"; var id = connection.Execute(sql, objStockReturnItem); return(id); } }
/// <summary> /// Insert stock return into details table (StockReturnItem table) /// </summary> /// <param name="objStockReturnItem"></param> /// <param name="connection"></param> /// <param name="txn"></param> /// <returns></returns> public int InsertStockReturnItem(StockReturnItem objStockReturnItem, IDbConnection connection, IDbTransaction txn) { try { string sql = @"insert into StockReturnItem(StockReturnId,SlNo,ItemId,Quantity,Remarks) Values (@StockReturnId,@SlNo,@ItemId,@Quantity,@Remarks); SELECT CAST(SCOPE_IDENTITY() as int)"; var id = connection.Query <int>(sql, objStockReturnItem, txn).Single(); return(id); } catch (Exception) { throw; } }